eb_deployer 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/README.md +18 -13
- data/bin/eb_deploy +0 -0
- data/lib/eb_deployer.rb +1 -1
- data/lib/eb_deployer/default_config.yml +35 -32
- data/lib/eb_deployer/version.rb +1 -1
- metadata +4 -2
data/.gitignore
CHANGED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
eb_deployer
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p429
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# EbDeployer
|
2
2
|
|
3
|
-
Low friction deployments should be a breeze. Elastic Beanstalk provides a great foundation for performing Blue-Green deployments, and EbDeployer add a missing
|
3
|
+
Low friction deployments should be a breeze. Elastic Beanstalk provides a great foundation for performing Blue-Green deployments, and EbDeployer add a missing link to automate the whole flow out of box.
|
4
4
|
|
5
|
-
|
5
|
+
EbDeployer thus allows you to do continuous delivery on AWS.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -12,18 +12,22 @@ ElasticBeanstalk Deployer thus allows you to do continuous delivery on AWS.
|
|
12
12
|
|
13
13
|
### Step One: AWS Account Setup
|
14
14
|
|
15
|
-
Create an AWS IAM user for deploy and give it privilege to operate Elastic Beanstalk. Download the access keys for executing the deployment tasks later.
|
15
|
+
Create an AWS IAM user for deploy and give it privilege to operate Elastic Beanstalk. Download the access keys for executing the deployment tasks later. Ensure your command line is primed with appropriate access_keys using one of techniques mentioned on [aws blog](http://ruby.awsblog.com/blog/tag/config). For example using environment variable:
|
16
|
+
|
17
|
+
$ export AWS_ACCESS_KEY_ID=xxx
|
18
|
+
$ export AWS_SECRET_ACCESS_KEY=xxx
|
19
|
+
|
16
20
|
|
17
21
|
### Step Two: Packaging
|
18
22
|
|
19
|
-
You need package your application for Elastic Beanstalk stack first. For Java app
|
23
|
+
You need to package your application for Elastic Beanstalk stack first. For Java app a warball is appropriate. For Ruby on Rails app a tar.gz file is good. You can also package a Rails/Sinatra app as a war ball using warbler and deploy to Java stack. (Please remember to run rake assets:precompile first for a rails app.)
|
20
24
|
|
21
25
|
|
22
26
|
### Step Three: Generate configuration and Configure deployment process
|
23
27
|
|
24
28
|
$ eb_deploy
|
25
29
|
|
26
|
-
This will generate a default configuration at location 'config/eb_deployer.yml'. It is almost empty but working one. And it will generate settings for two
|
30
|
+
This will generate a default configuration at location 'config/eb_deployer.yml'. It is almost empty but working one. And it will generate settings for two environments 'development' and 'production'. Some options can be tweaked. The yml files includes documentation on how you can best suit it to your purpose.
|
27
31
|
|
28
32
|
|
29
33
|
### Step Four: Fasten your seat belt
|
@@ -31,26 +35,27 @@ run deploy
|
|
31
35
|
|
32
36
|
$ eb_deploy -p <package built> -e <environment>
|
33
37
|
|
34
|
-
Then open aws console for Elastic Beanstalk to see
|
38
|
+
Then open aws console for Elastic Beanstalk to see the result of this deployment.
|
35
39
|
|
36
40
|
|
37
|
-
### Smoke Testing your stack
|
41
|
+
### Conifgure Smoke Testing your stack
|
38
42
|
|
39
43
|
EB_Deployer allows you to automate your deployment and then some. You can also add smoke tests to your deployment - thus ensuring that the app you deployed is also working correctly.
|
40
|
-
Adding a smoke test suite is also simple. Check "smoke_test" section in your eb_deployer.yml.
|
44
|
+
Adding a smoke test suite is also simple. Check "smoke_test" section in your eb_deployer.yml. We show a simple curl based smoke test that helps you test if your app is up and responding to http.
|
41
45
|
|
42
|
-
smoke_test:
|
46
|
+
smoke_test: |
|
43
47
|
curl_http_code = "curl -s -o /dev/null -w \"%{http_code}\" http://#{host_name}"
|
44
48
|
Timeout.timeout(600) do
|
45
|
-
|
49
|
+
until ['200', '302'].include?(`#{curl_http_code}`.strip)
|
46
50
|
sleep 5
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
50
54
|
|
55
|
+
Any rakeable test suite can be run as part of the smoke test(selenium, cucumber, capybara, and so on.)
|
51
56
|
You can add more smoke tests by calling arbitrary rake tasks (Please make sure check return status):
|
52
|
-
|
53
|
-
smoke_test:
|
57
|
+
|
58
|
+
smoke_test: |
|
54
59
|
`rake test:smoke HOST_NAME=#{host_name}`
|
55
60
|
raise("Smoke failed!") unless $?.success?
|
56
61
|
|
@@ -67,7 +72,7 @@ Once this new stack is stable or has run for a while you can choose to delete th
|
|
67
72
|
|
68
73
|
### Destroying a stack
|
69
74
|
So you are done with this application or environment, you can destroy it easily as well.
|
70
|
-
|
75
|
+
|
71
76
|
$ eb_deployer -d -e <environment>
|
72
77
|
|
73
78
|
and you are done!
|
data/bin/eb_deploy
CHANGED
File without changes
|
data/lib/eb_deployer.rb
CHANGED
@@ -205,7 +205,7 @@ module EbDeployer
|
|
205
205
|
action = options.delete(:action)
|
206
206
|
|
207
207
|
unless File.exists?(options[:config_file])
|
208
|
-
puts "
|
208
|
+
puts "Generated default configuration at #{options[:config_file]}."
|
209
209
|
DefaultConfig.new(File.basename(Dir.pwd)).write_to(options[:config_file])
|
210
210
|
exit(2)
|
211
211
|
end
|
@@ -9,32 +9,32 @@ common:
|
|
9
9
|
# AWS region to deploy. Default to us-east-1
|
10
10
|
# region: us-west-1
|
11
11
|
|
12
|
-
# There are two deployment strategies: blue-green or inplace-update.
|
13
|
-
# Blue green keep two elastic beanstalk environments and always deploy to
|
14
|
-
# inactive one, to
|
15
|
-
# will only keep one environment, and update the version inplace on
|
16
|
-
# deploy.
|
17
|
-
#
|
18
|
-
#
|
12
|
+
# There are two deployment strategies: 'blue-green' or 'inplace-update'.
|
13
|
+
# Blue green deployments keep two elastic beanstalk environments and always deploy to
|
14
|
+
# inactive one, to achieve zero downtime.
|
15
|
+
# Inplace-update strategy will only keep one environment, and update the version inplace on
|
16
|
+
# deploy. Inplace-update will save resources but will suffer from downtime.
|
17
|
+
# (All old environments need be destroyed when you switching between strategies.)
|
18
|
+
# Default strategy is 'blue-green'.
|
19
19
|
# strategy: blue-green
|
20
20
|
|
21
|
-
# If phoenix mode is
|
22
|
-
# beanstalk environment and recreate on deploy. For blue-green
|
23
|
-
# deployment it terminate the inactive environment first then
|
24
|
-
# recreate it. This is useful to
|
25
|
-
# accumulating state on the ec2 instances. Also it has the
|
21
|
+
# If phoenix mode is turned 'on', it will terminate the old elastic
|
22
|
+
# beanstalk environment and recreate a new one on deploy. For blue-green
|
23
|
+
# deployment it will terminate the inactive environment first then
|
24
|
+
# recreate it. This is useful to avoid configuration drift and
|
25
|
+
# accumulating state on the ec2 instances. Also it has the benefit of
|
26
26
|
# keeping your ec2 instance system package upto date, because everytime ec2
|
27
|
-
# instance
|
28
|
-
#
|
27
|
+
# instance boots up from AMI it does a system update. Default is 'off' but we suggest
|
28
|
+
# you override it to 'on' for production environment.
|
29
29
|
# phoenix_mode: false
|
30
30
|
|
31
|
-
# Generating version label for package be deployed. A readable version label will
|
31
|
+
# Generating version label for package to be deployed. A readable version label will
|
32
32
|
# provide better traceablity of your deployment process.
|
33
33
|
# By default setting is:
|
34
34
|
# version_label: <%%= package_digest %>
|
35
35
|
# which means using MD5 digest of the package file. If you deploy using build
|
36
36
|
# pipeline tool such as GO, switching to pipline counter is highly suggested to
|
37
|
-
# increase the readability. Following example read pipeline counter from environment
|
37
|
+
# increase the readability. Following example will read pipeline counter from environment
|
38
38
|
# variable with a fall back to digest for local deployment:
|
39
39
|
# version_label: <%%= ENV['GO_PIPELINE_COUNTER'] || package_digest %>
|
40
40
|
|
@@ -42,26 +42,27 @@ common:
|
|
42
42
|
# Smoke test value should be a piece of ruby code with access to single variable
|
43
43
|
# "host_name" -- environment DNS name. Smoke test snippet will be evaluated at
|
44
44
|
# the end of the deployment for inplace-update deployment. For blue-green
|
45
|
-
# deployment it will run after inactive environment update
|
46
|
-
# switching.
|
47
|
-
# Defining a smoke test is
|
48
|
-
# simplest one
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
45
|
+
# deployment it will run after inactive environment update is completed and before
|
46
|
+
# switching over.
|
47
|
+
# Defining a smoke test is highly recommended for serious usage. By default we use
|
48
|
+
# The simplest one that just be checking server landing page using curl, e.g.
|
49
|
+
smoke_test: |
|
50
|
+
curl_http_code = "curl -s -o /dev/null -w \"%{http_code}\" http://#{host_name}"
|
51
|
+
Timeout.timeout(600) do
|
52
|
+
until ['200', '302'].include?(`#{curl_http_code}`.strip)
|
53
|
+
sleep 5
|
54
|
+
end
|
55
|
+
end
|
56
56
|
|
57
57
|
|
58
|
-
|
58
|
+
|
59
|
+
# Elastic Beanstalk settings that will apply to the environments you are
|
59
60
|
# deploying.
|
60
61
|
# For all available options take a look at
|
61
62
|
# http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html
|
62
63
|
option_settings:
|
63
64
|
# Following is an option_settings example which changes EC2 instance type
|
64
|
-
# from t1.micro (default) to m1.small.
|
65
|
+
# from t1.micro (default) to m1.small. Instances with t1.micro type sometime
|
65
66
|
# are not very responsible, so m1.small is suggested for saving time.
|
66
67
|
# But if you care about the marginal cost difference you can comment this out to
|
67
68
|
# go back to t1.micro.
|
@@ -82,10 +83,12 @@ common:
|
|
82
83
|
# :capabilities => An array. You need set it to ['CAPABILITY_IAM'] if the
|
83
84
|
# template include IAM Instance Profile.
|
84
85
|
resources:
|
85
|
-
|
86
|
+
|
87
|
+
# For example creating a RDS instance for blue green deployment(check jruby-rails4
|
88
|
+
# sample project which has a working example):
|
86
89
|
# template: config/my_rds.json
|
87
90
|
# inputs:
|
88
|
-
# DBPassword: <%%=
|
91
|
+
# DBPassword: <%%= ENV.fetch("MYDBPASSWORD") %>
|
89
92
|
# outputs:
|
90
93
|
# RDSPassSecurityGroup:
|
91
94
|
# namespace: aws:autoscaling:launchconfiguration
|
@@ -102,7 +105,7 @@ environments:
|
|
102
105
|
# strategy: inplace-update
|
103
106
|
production:
|
104
107
|
option_settings:
|
105
|
-
# example for overriding common option_settings: providing least
|
108
|
+
# example for overriding common option_settings: providing least redundancy
|
106
109
|
# in production environment.
|
107
110
|
# - namespace: aws:autoscaling:asg
|
108
111
|
# option_name: MinSize
|
data/lib/eb_deployer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eb_deployer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-09-
|
13
|
+
date: 2013-09-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: aws-sdk
|
@@ -54,6 +54,8 @@ extensions: []
|
|
54
54
|
extra_rdoc_files: []
|
55
55
|
files:
|
56
56
|
- .gitignore
|
57
|
+
- .ruby-gemset
|
58
|
+
- .ruby-version
|
57
59
|
- Gemfile
|
58
60
|
- LICENSE
|
59
61
|
- README.md
|