dew 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +46 -12
- data/bin/dew +4 -0
- data/example/dew/accounts/development.yaml +7 -0
- data/example/dew/profiles/template.yaml +14 -0
- data/example/dew/profiles/test-full.yaml +15 -0
- data/example/dew/profiles/test-light.yaml +32 -0
- data/lib/dew.rb +2 -0
- data/lib/dew/models/profile.rb +10 -6
- data/lib/dew/version.rb +1 -1
- metadata +6 -2
data/README.md
CHANGED
@@ -1,31 +1,65 @@
|
|
1
|
-
Dew is
|
1
|
+
**Dew** is an environment management tool intended for use in multi-instance AWS application deployments.
|
2
|
+
|
3
|
+
It's called **dew** as it's a layer under [Fog](http://fog.io) which in turn is a layer under various cloud platforms.
|
2
4
|
|
3
5
|
It includes:
|
6
|
+
|
4
7
|
* one command `dew`, with subcommands eg. `environments`, `amis`
|
8
|
+
|
9
|
+
These subcommands can:
|
5
10
|
|
6
|
-
|
11
|
+
* create and destroy **environments**, a collection of AWS instances, a load balancer and a database
|
12
|
+
* create and destroy **amis**, machine images used to create instances in your environments
|
13
|
+
* configure your **amis** with [Puppet](http://www.puppetlabs.com)
|
14
|
+
* deploy MRI Passenger and JRuby Tomcat applications to your **environments**
|
7
15
|
|
8
|
-
|
16
|
+
This code is Open Source, but some of it is still specific to PlayUp. Running `cucumber` with a correctly configured `development.yaml` will drain whichever credit card you've attached to that account!
|
17
|
+
|
18
|
+
## Getting Started
|
9
19
|
|
10
20
|
$ [sudo] gem install dew
|
11
21
|
|
12
|
-
|
22
|
+
### If you're an employee of PlayUp:
|
13
23
|
|
14
24
|
$ git clone git@github.com:playup/dew-config.git ~/.dew
|
15
25
|
|
16
|
-
|
26
|
+
### Otherwise:
|
27
|
+
|
28
|
+
#### 1. Copy over the example configuration and edit the default account file
|
29
|
+
|
30
|
+
$ cp -r `gem which dew | dirname`/../../example/dew ~/.dew
|
31
|
+
$ vi ~/.dew/accounts/development.yaml
|
32
|
+
|
33
|
+
Replace the `user_id`, `access_key_id` and `secret_access_key` with your AWS credentials.
|
34
|
+
|
35
|
+
#### 2. Install your keypair
|
36
|
+
|
37
|
+
Either pick an existing keypair or create a new one. You'll need to do this once for each account and region you intend to operate in.
|
17
38
|
|
18
|
-
|
19
|
-
$ cat > ~/.dew/accounts/development.yaml
|
20
|
-
aws:
|
21
|
-
user_id: xxxx-xxxx-xxxx
|
22
|
-
access_key_id: YYYYYYYYYYYYYYYYYYYY
|
23
|
-
secret_access_key: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
|
39
|
+
Place the `.pem` file in the following location:
|
24
40
|
|
41
|
+
~/.dew/accounts/keys/$ACCOUNT/$REGION/$KEYPAIRNAME.pem
|
42
|
+
|
43
|
+
For example, the `.pem` file for the `default` key in `development` account and in the `ap-southeast-1` region would go in:
|
25
44
|
|
26
|
-
|
45
|
+
~/.dew/accounts/keys/development/ap-southeast-1/default.pem
|
46
|
+
|
47
|
+
Don't worry about setting permissions for the key - **dew** will manage that itself.
|
48
|
+
|
49
|
+
#### 3. Configure your security groups
|
50
|
+
|
51
|
+
**dew** makes a couple of assumptions about how you've set up your security groups. Unfortunately, **dew** doesn't yet possess the capability to manage this for you:
|
52
|
+
|
53
|
+
* it expects that the `default` security group allows for SSH from the host you're creating the environment from
|
54
|
+
* it expects that the `default` security group in your RDS configuration allows connections from your AWS account's instances
|
55
|
+
|
56
|
+
### Finally:
|
27
57
|
|
28
58
|
$ dew --help
|
59
|
+
|
60
|
+
And perform a basic self-test:
|
61
|
+
|
62
|
+
$ dew environments
|
29
63
|
|
30
64
|
## Creating a Simple Environment
|
31
65
|
|
data/bin/dew
CHANGED
@@ -7,6 +7,10 @@ class DewCommand < DewBaseCommand
|
|
7
7
|
option ['-q', '--quiet'], :flag, "Quiet mode, disables logging", :default => false
|
8
8
|
option ['-v', '--verbose'], :flag, "Verbose mode, print debug output", :default => false
|
9
9
|
option '--debug', :flag, "Show stacktraces on error", :default => false
|
10
|
+
option '--version', :flag, "Prints the dew version" do
|
11
|
+
puts "dew version #{Dew::VERSION}"
|
12
|
+
exit(0)
|
13
|
+
end
|
10
14
|
|
11
15
|
subcommand "environments", "perform subcommands on the environments", EnvironmentsCommand
|
12
16
|
subcommand "amis", "perform subcommands on the AMIs", AMIsCommand
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Template Profile YAML. Use this to create a new Profile.
|
2
|
+
#
|
3
|
+
# ---
|
4
|
+
# instances:
|
5
|
+
# amis: # List of AMI id's for regions you might like to create environments
|
6
|
+
# ap-southeast-1: ami-dcfc858e # An AMI entry *must* appear here for the region you wish to create accounts within
|
7
|
+
# size: m1.large # Size of EC2 to create. More info http://aws.amazon.com/ec2/instance-types
|
8
|
+
# count: 2 # The number of Server(s) to create
|
9
|
+
# keypair: devops # Amazon keypair to deploy onto new Server(s). More info http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?generating-a-keypair.html
|
10
|
+
# elb: # Optional Load Balancer section. More info http://aws.amazon.com/elasticloadbalancing
|
11
|
+
# listener_ports: # List of ports to 'balance' onto Server(s)
|
12
|
+
# - 80
|
13
|
+
# rds: # Optional Database section
|
14
|
+
# size: db.m1.small # Size of Database to create. More info http://aws.amazon.com/rds
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
instances:
|
3
|
+
amis: # http://uec-images.ubuntu.com/releases/10.10/release
|
4
|
+
ap-southeast-1: ami-0c423c5e # https://console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchAmi=ami-0c423c5e
|
5
|
+
eu-west-1: ami-fb9ca98f # https://console.aws.amazon.com/ec2/home?region=eu-west-1#launchAmi=ami-fb9ca98f
|
6
|
+
us-west-1: ami-ad7e2ee8 # https://console.aws.amazon.com/ec2/home?region=us-west-1#launchAmi=ami-ad7e2ee8
|
7
|
+
size: c1.medium
|
8
|
+
count: 2
|
9
|
+
security-group: default
|
10
|
+
keypair: devops
|
11
|
+
elb:
|
12
|
+
listener_ports:
|
13
|
+
- 80
|
14
|
+
rds:
|
15
|
+
size: db.m1.small
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
instances:
|
3
|
+
# An AMI is an image file used as a template to create an instance.
|
4
|
+
#
|
5
|
+
# AMIs aren't shared between regions. You'll need to specify an AMI for each
|
6
|
+
# region you want to create your environment in. AMIs can be created
|
7
|
+
# with the script/ami.rb create command.
|
8
|
+
#
|
9
|
+
# These AMIs, however, are 32-bit Ubuntu 10.10 images from Canonical.
|
10
|
+
# See: http://uec-images.ubuntu.com/releases/10.10/release
|
11
|
+
amis:
|
12
|
+
ap-southeast-1: ami-0c423c5e
|
13
|
+
eu-west-1: ami-fb9ca98f
|
14
|
+
us-west-1: ami-ad7e2ee8
|
15
|
+
|
16
|
+
# Each instance is created with particular size. The size determines
|
17
|
+
# the architecture, CPU and RAM available to the instance.
|
18
|
+
#
|
19
|
+
# m1.small is a 32-bit, dual core instance with 1.7gb of RAM.
|
20
|
+
size: m1.small
|
21
|
+
|
22
|
+
# Create two instances
|
23
|
+
count: 2
|
24
|
+
|
25
|
+
#security-groups:
|
26
|
+
# - default
|
27
|
+
|
28
|
+
keypair: devops
|
29
|
+
|
30
|
+
elb:
|
31
|
+
listener_ports:
|
32
|
+
- 80
|
data/lib/dew.rb
CHANGED
data/lib/dew/models/profile.rb
CHANGED
@@ -27,11 +27,11 @@ class Profile
|
|
27
27
|
end
|
28
28
|
profile
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def has_elb?
|
32
32
|
elb_listener_ports != nil
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def has_rds?
|
36
36
|
rds_size != nil
|
37
37
|
end
|
@@ -42,17 +42,21 @@ class Profile
|
|
42
42
|
# :rds_size, :elb_listener_ports
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
db_instance_str = "%{memory} memory, %{processor} processor, %{platform} platform, %{io_performance} I/O performance"
|
45
|
+
def self.size_to_s(size)
|
47
46
|
#instance_str = "%{memory} memory, %{processor} processor, %{storage} storage, %{platform} platform, %{io_performance} I/O performance"
|
48
47
|
instance_str = "%{memory} GB memory, %{processor} ECUs processor, %{storage} GB storage, %{platform}-bit platform, %{io_performance} I/O performance"
|
49
48
|
flavor = Cloud.compute.flavors.detect { |f| f.id == size }
|
50
49
|
instance_hash = { :memory => flavor.ram.to_s, :processor => flavor.cores.to_s, :storage => flavor.disk.to_s, :platform => flavor.bits.to_s, :io_performance => '??' }
|
50
|
+
instance_hash.inject(instance_str) { |res,(k,v)| res.gsub(/%\{#{k}\}/, v) }
|
51
|
+
end
|
52
|
+
|
53
|
+
def to_s
|
54
|
+
db_instance_str = "%{memory} memory, %{processor} processor, %{platform} platform, %{io_performance} I/O performance"
|
51
55
|
table { |t|
|
52
|
-
t << [ "#{count} instance#{'s' if count > 1}", "#{size.inspect} (#{
|
56
|
+
t << [ "#{count} instance#{'s' if count > 1}", "#{size.inspect} (#{self.class.size_to_s(size)})"]
|
53
57
|
t << ['disk image', ami.inspect]
|
54
58
|
t << ['load balancer', "listener ports: #{elb_listener_ports.inspect}"] if has_elb?
|
55
|
-
t << ['database', "#{rds_size.inspect} (#{
|
59
|
+
t << ['database', "#{rds_size.inspect} (#{AWS_RESOURCES['db_instance_types'][rds_size].inject(db_instance_str) { |res,(k,v)| res.gsub(/%\{#{k}\}/, v) } })"] if has_rds?
|
56
60
|
t << ['security groups', security_groups.inspect]
|
57
61
|
t << ['keypair', keypair.inspect]
|
58
62
|
}.to_s
|
data/lib/dew/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: dew
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- PlayUp Devops
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-22 00:00:00 +10:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -204,6 +204,10 @@ files:
|
|
204
204
|
- lib/dew.rb
|
205
205
|
- README.md
|
206
206
|
- LICENSE
|
207
|
+
- example/dew/profiles/test-full.yaml
|
208
|
+
- example/dew/profiles/template.yaml
|
209
|
+
- example/dew/profiles/test-light.yaml
|
210
|
+
- example/dew/accounts/development.yaml
|
207
211
|
- Rakefile
|
208
212
|
- spec/dew/controllers/deploy_controller_spec.rb
|
209
213
|
- spec/dew/controllers/amis_controller_spec.rb
|