vagrant-tiktalik 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1e2eae2923158eb685917eacadbb737ec8ee747c
4
+ data.tar.gz: f4970f0c612f94007f6100eb6d0f7bd874e864d9
5
+ SHA512:
6
+ metadata.gz: 0231889c46e50da2c64f7b6c7db035f338313ae0dce1fc24d427e238e659d9bb98d3602f9e2f36ca23d5d99a78fb079f1675fd47316778b2061bc69d8243b025
7
+ data.tar.gz: c444050382f5ffe76320fe08993e1dd17fe634059a8f0615d9302f231be14505a24ba5e39745267a657b34864e380a06c44e3a46e72f42a79717eaabf325b1df
@@ -0,0 +1,16 @@
1
+ # OS-specific
2
+ .DS_Store
3
+
4
+ # Bundler/Rubygems
5
+ *.gem
6
+ .bundle
7
+ pkg/*
8
+ tags
9
+ Gemfile.lock
10
+
11
+ # Vagrant
12
+ .vagrant
13
+ Vagrantfile
14
+
15
+ #
16
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ # We depend on Vagrant for development, but we don't add it as a
7
+ # gem dependency because we expect to be installed within the
8
+ # Vagrant environment itself using `vagrant plugin`.
9
+ gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => "v1.3.2"
10
+ end
11
+
12
+ gem "tiktalik", "~> 1.0.3"
data/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 TECHSTORAGE SP. Z O.O.
4
+ Copyright (c) 2013 Mitchell Hashimoto
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+
10
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,250 @@
1
+ # This is Vagrant Tiktalik.com Provider WORK IN PROGRESS
2
+
3
+ Our plugin is based on excellent Vagrant AWS Provider plugin.
4
+ We'll come up with our own README file but for now please read the original one provided below.
5
+ Don't forget you that our plugin is called vagrant-tiktalik so please adapt commands accordingly.
6
+
7
+ ``
8
+ $ vagrant plugin install vagrant-tiktalik
9
+ ...
10
+ $ vagrant up --provider=tiktalik
11
+ ``
12
+
13
+ # Vagrant AWS Provider
14
+
15
+ This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds an [AWS](http://aws.amazon.com)
16
+ provider to Vagrant, allowing Vagrant to control and provision machines in
17
+ EC2 and VPC.
18
+
19
+ **NOTE:** This plugin requires Vagrant 1.2+,
20
+
21
+ ## Features
22
+
23
+ * Boot EC2 or VPC instances.
24
+ * SSH into the instances.
25
+ * Provision the instances with any built-in Vagrant provisioner.
26
+ * Minimal synced folder support via `rsync`.
27
+ * Define region-specifc configurations so Vagrant can manage machines
28
+ in multiple regions.
29
+
30
+ ## Usage
31
+
32
+ Install using standard Vagrant 1.1+ plugin installation methods. After
33
+ installing, `vagrant up` and specify the `aws` provider. An example is
34
+ shown below.
35
+
36
+ ```
37
+ $ vagrant plugin install vagrant-aws
38
+ ...
39
+ $ vagrant up --provider=aws
40
+ ...
41
+ ```
42
+
43
+ Of course prior to doing this, you'll need to obtain an AWS-compatible
44
+ box file for Vagrant.
45
+
46
+ ## Quick Start
47
+
48
+ After installing the plugin (instructions above), the quickest way to get
49
+ started is to actually use a dummy AWS box and specify all the details
50
+ manually within a `config.vm.provider` block. So first, add the dummy
51
+ box using any name you want:
52
+
53
+ ```
54
+ $ vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
55
+ ...
56
+ ```
57
+
58
+ And then make a Vagrantfile that looks like the following, filling in
59
+ your information where necessary.
60
+
61
+ ```
62
+ Vagrant.configure("2") do |config|
63
+ config.vm.box = "dummy"
64
+
65
+ config.vm.provider :aws do |aws, override|
66
+ aws.access_key_id = "YOUR KEY"
67
+ aws.secret_access_key = "YOUR SECRET KEY"
68
+ aws.keypair_name = "KEYPAIR NAME"
69
+
70
+ aws.ami = "ami-7747d01e"
71
+
72
+ override.ssh.username = "ubuntu"
73
+ override.ssh.private_key_path = "PATH TO YOUR PRIVATE KEY"
74
+ end
75
+ end
76
+ ```
77
+
78
+ And then run `vagrant up --provider=aws`.
79
+
80
+ This will start an Ubuntu 12.04 instance in the us-east-1 region within
81
+ your account. And assuming your SSH information was filled in properly
82
+ within your Vagrantfile, SSH and provisioning will work as well.
83
+
84
+ Note that normally a lot of this boilerplate is encoded within the box
85
+ file, but the box file used for the quick start, the "dummy" box, has
86
+ no preconfigured defaults.
87
+
88
+ If you have issues with SSH connecting, make sure that the instances
89
+ are being launched with a security group that allows SSH access.
90
+
91
+ ## Box Format
92
+
93
+ Every provider in Vagrant must introduce a custom box format. This
94
+ provider introduces `aws` boxes. You can view an example box in
95
+ the [example_box/ directory](https://github.com/mitchellh/vagrant-aws/tree/master/example_box).
96
+ That directory also contains instructions on how to build a box.
97
+
98
+ The box format is basically just the required `metadata.json` file
99
+ along with a `Vagrantfile` that does default settings for the
100
+ provider-specific configuration for this provider.
101
+
102
+ ## Configuration
103
+
104
+ This provider exposes quite a few provider-specific configuration options:
105
+
106
+ * `access_key_id` - The access key for accessing AWS
107
+ * `ami` - The AMI id to boot, such as "ami-12345678"
108
+ * `availability_zone` - The availability zone within the region to launch
109
+ the instance. If nil, it will use the default set by Amazon.
110
+ * `instance_ready_timeout` - The number of seconds to wait for the instance
111
+ to become "ready" in AWS. Defaults to 120 seconds.
112
+ * `instance_type` - The type of instance, such as "m1.small". The default
113
+ value of this if not specified is "m1.small".
114
+ * `keypair_name` - The name of the keypair to use to bootstrap AMIs
115
+ which support it.
116
+ * `private_ip_address` - The private IP address to assign to an instance
117
+ within a [VPC](http://aws.amazon.com/vpc/)
118
+ * `region` - The region to start the instance in, such as "us-east-1"
119
+ * `secret_access_key` - The secret access key for accessing AWS
120
+ * `security_groups` - An array of security groups for the instance. If this
121
+ instance will be launched in VPC, this must be a list of security group
122
+ IDs.
123
+ * `subnet_id` - The subnet to boot the instance into, for VPC.
124
+ * `tags` - A hash of tags to set on the machine.
125
+ * `use_iam_profile` - If true, will use [IAM profiles](http://docs.aws.amazon.com/IAM/latest/UserGuide/instance-profiles.html)
126
+ for credentials.
127
+
128
+ These can be set like typical provider-specific configuration:
129
+
130
+ ```ruby
131
+ Vagrant.configure("2") do |config|
132
+ # ... other stuff
133
+
134
+ config.vm.provider :aws do |aws|
135
+ aws.access_key_id = "foo"
136
+ aws.secret_access_key = "bar"
137
+ end
138
+ end
139
+ ```
140
+
141
+ In addition to the above top-level configs, you can use the `region_config`
142
+ method to specify region-specific overrides within your Vagrantfile. Note
143
+ that the top-level `region` config must always be specified to choose which
144
+ region you want to actually use, however. This looks like this:
145
+
146
+ ```ruby
147
+ Vagrant.configure("2") do |config|
148
+ # ... other stuff
149
+
150
+ config.vm.provider :aws do |aws|
151
+ aws.access_key_id = "foo"
152
+ aws.secret_access_key = "bar"
153
+ aws.region = "us-east-1"
154
+
155
+ # Simple region config
156
+ aws.region_config "us-east-1", :ami => "ami-12345678"
157
+
158
+ # More comprehensive region config
159
+ aws.region_config "us-west-2" do |region|
160
+ region.ami = "ami-87654321"
161
+ region.keypair_name = "company-west"
162
+ end
163
+ end
164
+ end
165
+ ```
166
+
167
+ The region-specific configurations will override the top-level
168
+ configurations when that region is used. They otherwise inherit
169
+ the top-level configurations, as you would probably expect.
170
+
171
+ ## Networks
172
+
173
+ Networking features in the form of `config.vm.network` are not
174
+ supported with `vagrant-aws`, currently. If any of these are
175
+ specified, Vagrant will emit a warning, but will otherwise boot
176
+ the AWS machine.
177
+
178
+ ## Synced Folders
179
+
180
+ There is minimal support for synced folders. Upon `vagrant up`,
181
+ `vagrant reload`, and `vagrant provision`, the AWS provider will use
182
+ `rsync` (if available) to uni-directionally sync the folder to
183
+ the remote machine over SSH.
184
+
185
+ This is good enough for all built-in Vagrant provisioners (shell,
186
+ chef, and puppet) to work!
187
+
188
+ ## Other Examples
189
+
190
+ ### Tags
191
+
192
+ To use tags, simply define a hash of key/value for the tags you want to associate to your instance, like:
193
+
194
+ ```ruby
195
+ Vagrant.configure("2") do |config|
196
+ # ... other stuff
197
+
198
+ config.vm.provider "aws" do |aws|
199
+ aws.tags = {
200
+ 'Name' => 'Some Name',
201
+ 'Some Key' => 'Some Value'
202
+ }
203
+ end
204
+ end
205
+ ```
206
+
207
+ ### User data
208
+
209
+ You can specify user data for the instance being booted.
210
+
211
+ ```ruby
212
+ Vagrant.configure("2") do |config|
213
+ # ... other stuff
214
+
215
+ config.vm.provider "aws" do |aws|
216
+ # Option 1: a single string
217
+ aws.user_data = "#!/bin/bash\necho 'got user data' > /tmp/user_data.log\necho"
218
+
219
+ # Option 2: use a file
220
+ aws.user_data = File.read("user_data.txt")
221
+ end
222
+ end
223
+ ```
224
+
225
+ ## Development
226
+
227
+ To work on the `vagrant-aws` plugin, clone this repository out, and use
228
+ [Bundler](http://gembundler.com) to get the dependencies:
229
+
230
+ ```
231
+ $ bundle
232
+ ```
233
+
234
+ Once you have the dependencies, verify the unit tests pass with `rake`:
235
+
236
+ ```
237
+ $ bundle exec rake
238
+ ```
239
+
240
+ If those pass, you're ready to start developing the plugin. You can test
241
+ the plugin without installing it into your Vagrant environment by just
242
+ creating a `Vagrantfile` in the top level of this directory (it is gitignored)
243
+ and add the following line to your `Vagrantfile`
244
+ ```ruby
245
+ Vagrant.require_plugin "vagrant-aws"
246
+ ```
247
+ Use bundler to execute Vagrant:
248
+ ```
249
+ $ bundle exec vagrant up --provider=aws
250
+ ```
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'rspec/core/rake_task'
4
+
5
+ # Immediately sync all stdout so that tools like buildbot can
6
+ # immediately load in the output.
7
+ $stdout.sync = true
8
+ $stderr.sync = true
9
+
10
+ # Change to the directory of this file.
11
+ Dir.chdir(File.expand_path("../", __FILE__))
12
+
13
+ # This installs the tasks that help with gem creation and
14
+ # publishing.
15
+ Bundler::GemHelper.install_tasks
16
+
17
+ # Install the `spec` task so that we can run tests.
18
+ RSpec::Core::RakeTask.new
19
+
20
+ # Default task is to run the unit tests
21
+ task :default => "spec"
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ tar cvzf tiktalik.box ./metadata.json
@@ -0,0 +1,3 @@
1
+ {
2
+ "provider": "tiktalik.com"
3
+ }
Binary file
@@ -0,0 +1,18 @@
1
+ require "pathname"
2
+
3
+ require "vagrant-tiktalik/plugin"
4
+
5
+ module VagrantPlugins
6
+ module TiktalikVagrant
7
+ lib_path = Pathname.new(File.expand_path("../vagrant-tiktalik", __FILE__))
8
+ autoload :Action, lib_path.join("action")
9
+ autoload :Errors, lib_path.join("errors")
10
+
11
+ # This returns the path to the source of this plugin.
12
+ #
13
+ # @return [Pathname]
14
+ def self.source_root
15
+ @source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,147 @@
1
+ require "pathname"
2
+
3
+ require "vagrant/action/builder"
4
+
5
+ module VagrantPlugins
6
+ module TiktalikVagrant
7
+ module Action
8
+ # Include the built-in modules so we can use them as top-level things.
9
+ include Vagrant::Action::Builtin
10
+
11
+ def self.action_halt
12
+ Vagrant::Action::Builder.new.tap do |builder|
13
+ builder.use ConfigValidate
14
+ builder.use Call, ReadState do |env, b|
15
+ case env[:machine_state_id]
16
+ when :running
17
+ b.use PowerOff
18
+ else
19
+ env[:ui].info I18n.t('vagrant_tiktalik.errors.instance_not_running')
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ # This action is called to terminate the remote machine.
26
+ def self.action_destroy
27
+ Vagrant::Action::Builder.new.tap do |b|
28
+ b.use Call, DestroyConfirm do |env, b2|
29
+ if env[:result]
30
+ b2.use ConfigValidate
31
+ b2.use TerminateInstance
32
+ else
33
+ b2.use MessageWillNotDestroy
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ # This action is called when `vagrant provision` is called.
40
+ def self.action_provision
41
+ Vagrant::Action::Builder.new.tap do |b|
42
+ b.use ConfigValidate
43
+ b.use Call, IsCreated do |env, b2|
44
+ if !env[:result]
45
+ b2.use MessageNotCreated
46
+ next
47
+ end
48
+
49
+ b2.use Provision
50
+ b2.use SyncFolders
51
+ end
52
+ end
53
+ end
54
+
55
+ # This action is called to read the SSH info of the machine. The
56
+ # resulting state is expected to be put into the `:machine_ssh_info`
57
+ # key.
58
+ def self.action_read_ssh_info
59
+ Vagrant::Action::Builder.new.tap do |b|
60
+ b.use ConfigValidate
61
+ b.use ReadSSHInfo
62
+ end
63
+ end
64
+
65
+ # This action is called to read the state of the machine. The
66
+ # resulting state is expected to be put into the `:machine_state_id`
67
+ # key.
68
+ def self.action_read_state
69
+ Vagrant::Action::Builder.new.tap do |b|
70
+ b.use ConfigValidate
71
+ b.use ReadState
72
+ end
73
+ end
74
+
75
+ # This action is called to SSH into the machine.
76
+ def self.action_ssh
77
+ Vagrant::Action::Builder.new.tap do |b|
78
+ b.use ConfigValidate
79
+ b.use Call, IsCreated do |env, b2|
80
+ if !env[:result]
81
+ b2.use MessageNotCreated
82
+ next
83
+ end
84
+
85
+ b2.use SSHExec
86
+ end
87
+ end
88
+ end
89
+
90
+ def self.action_ssh_run
91
+ Vagrant::Action::Builder.new.tap do |b|
92
+ b.use ConfigValidate
93
+ b.use Call, IsCreated do |env, b2|
94
+ if !env[:result]
95
+ b2.use MessageNotCreated
96
+ next
97
+ end
98
+
99
+ b2.use SSHRun
100
+ end
101
+ end
102
+ end
103
+
104
+ # This action is called to bring the box up from nothing.
105
+ def self.action_up
106
+ Vagrant::Action::Builder.new.tap do |b|
107
+ b.use HandleBoxUrl
108
+ b.use ConfigValidate
109
+
110
+ b.use Call, ReadState do |env, b2|
111
+ case env[:machine_state_id]
112
+ when :running
113
+ env[:ui].info I18n.t('vagrant_tiktalik.active_instance')
114
+ when :stopped
115
+ b2.use TimedProvision
116
+ b2.use PowerOn
117
+ b2.use SyncFolders
118
+ when :not_created
119
+ b2.use TimedProvision
120
+ b2.use SyncFolders
121
+ #b2.use WarnNetworks
122
+ b2.use RunInstance
123
+ else
124
+ env[:ui].info I18n.t('vagrant_tiktalik.unknown_state')
125
+ end
126
+ end
127
+ end
128
+ end
129
+
130
+ # The autoload farm
131
+ action_root = Pathname.new(File.expand_path("../action", __FILE__))
132
+ autoload :IsCreated, action_root.join("is_created")
133
+ autoload :MessageAlreadyCreated, action_root.join("message_already_created")
134
+ autoload :MessageNotCreated, action_root.join("message_not_created")
135
+ autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
136
+ autoload :ReadSSHInfo, action_root.join("read_ssh_info")
137
+ autoload :ReadState, action_root.join("read_state")
138
+ autoload :RunInstance, action_root.join("run_instance")
139
+ autoload :SyncFolders, action_root.join("sync_folders")
140
+ autoload :TimedProvision, action_root.join("timed_provision")
141
+ autoload :WarnNetworks, action_root.join("warn_networks")
142
+ autoload :TerminateInstance, action_root.join("terminate_instance")
143
+ autoload :PowerOff, action_root.join("power_off")
144
+ autoload :PowerOn, action_root.join("power_on")
145
+ end
146
+ end
147
+ end