enhanced-elastic-beanstalk 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ module Elastic
2
+ module Beanstalk
3
+ VERSION = '1.2.3'
4
+ end
5
+ end
@@ -0,0 +1,125 @@
1
+ require 'spec_helper'
2
+
3
+ describe EbConfig do
4
+ # not sure why, but clear appears to unreliably run before each test. Sometimes does, sometimes doesn't.
5
+ #before do
6
+ # EbConfig.clear
7
+ # puts 'clear'
8
+ #end
9
+
10
+ before(:each) do
11
+ EbConfig.clear
12
+ end
13
+
14
+ it '#set_option' do
15
+ EbConfig.set_option('aws:elasticbeanstalk:application:environment', 'RACK_ENV', 'staging')
16
+ expect(EbConfig.options[:'aws:elasticbeanstalk:application:environment'][:'RACK_ENV']).to eq 'staging'
17
+ end
18
+
19
+ it '#find_option_setting_value' do
20
+ EbConfig.set_option(:'aws:elasticbeanstalk:application:environment', 'RACK_ENV', 'staging')
21
+ expect(EbConfig.find_option_setting_value('RACK_ENV')).to eql 'staging'
22
+ end
23
+ it '#find_option_setting' do
24
+ EbConfig.set_option(:'aws:elasticbeanstalk:application:environment', 'RACK_ENV', 'staging')
25
+ expect(EbConfig.find_option_setting('RACK_ENV')).to eql ({:namespace => 'aws:elasticbeanstalk:application:environment', :option_name => 'RACK_ENV', :value => 'staging'})
26
+ end
27
+
28
+ it '#set_option should allow options to be overridden' do
29
+ EbConfig.set_option(:'aws:elasticbeanstalk:application:environment', 'RACK_ENV', 'staging')
30
+ assert_option 'RACK_ENV', 'staging'
31
+ EbConfig.set_option(:'aws:elasticbeanstalk:application:environment', 'RACK_ENV', 'foo')
32
+ assert_option 'RACK_ENV', 'foo'
33
+ end
34
+
35
+ it '#set_option should work with strings or deep symbols' do
36
+ option_input = [ :'aws:elasticbeanstalk:application:environment', :'RACK_ENV', :TEST_VALUE ]
37
+ method_order = [:to_sym, :to_s, :to_sym]
38
+ method_order.each do |current_method|
39
+ option_input.map!(&current_method)
40
+ EbConfig.clear
41
+ EbConfig.set_option(*option_input)
42
+ assert_option option_input[1].to_s, option_input[2].to_s
43
+ end
44
+ end
45
+
46
+ it '#set_option should work with environment variable interpolation' do
47
+ ENV['test_value'] = 'foo'
48
+ EbConfig.set_option(:'aws:elasticbeanstalk:application:environment', 'TEST_VAR', '<%= ENV["test_value"] %>')
49
+ assert_option 'TEST_VAR', 'foo'
50
+ end
51
+
52
+ it 'should read file with nil environment' do
53
+ sleep 1
54
+ #expect(EbConfig.strategy).to be_nil
55
+
56
+ EbConfig.load!(nil, config_file_path)
57
+ assert_common_top_level_settings()
58
+ assert_option 'InstanceType', 'foo'
59
+ #expect(EbConfig.strategy).to be_nil
60
+ expect(EbConfig.environment).to be_nil
61
+ end
62
+
63
+ it 'should read file and override with development environment' do
64
+ EbConfig.load!(:development, config_file_path)
65
+ assert_option 'InstanceType', 't1.micro'
66
+ expect(EbConfig.strategy).to eql 'inplace-update'
67
+ expect(EbConfig.environment).to eql :development
68
+ end
69
+
70
+ it 'should read file and override with production environment' do
71
+ EbConfig.load!(:production, config_file_path)
72
+ assert_option 'InstanceType', 't1.small'
73
+ expect(EbConfig.environment).to eql :production
74
+ end
75
+
76
+ private
77
+ def assert_option(name, value)
78
+ expect(EbConfig.find_option_setting_value(name)).to eql value
79
+ end
80
+
81
+ def assert_inactive(name, value)
82
+ expect(EbConfig.find_inactive_setting_value(name)).to eql value
83
+ end
84
+
85
+ def assert_common_top_level_settings
86
+ expect(EbConfig.app).to eql 'acme'
87
+ expect(EbConfig.region).to eql 'us-east-1'
88
+ expect(EbConfig.secrets_dir).to eql '~/.aws'
89
+ expect(EbConfig.strategy).to eql :blue_green
90
+ expect(EbConfig.solution_stack_name).to eql '64bit Amazon Linux running Ruby 1.9.3'
91
+ expect(EbConfig.disallow_environments).to eql %w(cucumber test)
92
+
93
+ expect(EbConfig.package[:dir]).to eql 'pkg'
94
+ expect(EbConfig.package[:verbose]).to be_truthy
95
+ expect(EbConfig.package[:includes]).to eql %w(**/* .ebextensions/**/*)
96
+ expect(EbConfig.package[:exclude_files]).to eql %w(resetdb.sh rspec.xml README* db/*.sqlite3)
97
+ expect(EbConfig.package[:exclude_dirs]).to eql %w(pkg tmp log test-reports solr features)
98
+
99
+ # assert set_option new
100
+ EbConfig.set_option(:'aws:elasticbeanstalk:application:environment', 'RACK_ENV', 'staging')
101
+ assert_option 'RACK_ENV', 'staging'
102
+
103
+ # assert set_option overwrite
104
+ EbConfig.set_option(:'aws:elasticbeanstalk:application:environment', 'RAILS_ENV', 'staging')
105
+ assert_option 'RAILS_ENV', 'staging'
106
+
107
+ assert_option 'EC2KeyName', 'eb-ssh'
108
+
109
+ assert_option 'SecurityGroups', 'acme-production-control'
110
+ assert_option 'MinSize', '1'
111
+ assert_option 'MaxSize', '5'
112
+ assert_option 'SSLCertificateId', 'arn:aws:iam::XXXXXXX:server-certificate/acme'
113
+ assert_option 'LoadBalancerHTTPSPort', '443'
114
+ assert_option 'Stickiness Policy', 'true'
115
+ assert_option 'Notification Endpoint', 'alerts@acme.com'
116
+ assert_option 'Application Healthcheck URL', '/healthcheck'
117
+
118
+ assert_inactive 'MinSize', '0'
119
+ assert_inactive 'Cooldown', '900'
120
+ end
121
+
122
+ def config_file_path
123
+ File.expand_path('../eb_spec.yml', __FILE__)
124
+ end
125
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe EbExtensions do
4
+
5
+ before do
6
+ EbConfig.clear
7
+ EbConfig.load!(:development, config_file_path)
8
+ end
9
+
10
+ it "#write_extensions and #delete_extensions" do
11
+ EbExtensions.write_extensions
12
+
13
+ EbConfig.ebextensions.each_key do |filename|
14
+ filename = EbExtensions.absolute_file_name(filename)
15
+ expect(File.exists? filename).to be_truthy
16
+ end
17
+
18
+ EbExtensions.delete_extensions
19
+ EbConfig.ebextensions.each_key do |filename|
20
+ filename = EbExtensions.absolute_file_name(filename)
21
+ expect(File.exists? filename).to be_falsey
22
+ end
23
+ end
24
+
25
+ def config_file_path
26
+ File.expand_path('../eb_spec.yml', __FILE__)
27
+ end
28
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe EbExtensions do
4
+
5
+
6
+ ###this is a driver only, perhaps make this a reasonable test someday...
7
+ #it "#test_url" do
8
+ # #url = 'http://acme-development-inactive.elasticbeanstalk.com/ping'
9
+ # #url = 'http://google.com'
10
+ # expected_text = 'You came to this page by mistake, go back where you came from'
11
+ # EbSmokeTester.test_url(url, 10, 2, expected_text)
12
+ #end
13
+ end
@@ -0,0 +1,81 @@
1
+ # http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html#command-options-ruby
2
+ ---
3
+ app: acme
4
+ region: us-east-1
5
+ solution_stack_name: 64bit Amazon Linux running Ruby 1.9.3
6
+ package:
7
+ verbose: true
8
+ exclude_files: [resetdb.sh, rspec.xml, README*, db/*.sqlite3]
9
+ exclude_dirs: [solr, features]
10
+ #--
11
+ ebextensions:
12
+ 01settings.config:
13
+ # Run rake tasks before an application deployment
14
+ container_commands:
15
+ 01seed:
16
+ command: rake db:seed
17
+ leader_only: true
18
+
19
+ 05-start-faye-server.config:
20
+ files:
21
+ "/opt/elasticbeanstalk/hooks/appdeploy/post/05_start_faye_server.sh":
22
+ mode: "000755"
23
+ owner: root
24
+ group: root
25
+ content: |
26
+ #!/usr/bin/env bash
27
+ # Loading environment data
28
+ EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user)
29
+ EB_APP_DEPLOY_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir)
30
+ EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
31
+ EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
32
+ # Setting up correct environment and ruby version so that bundle can load all gems
33
+ . $EB_SUPPORT_DIR/envvars
34
+ . $EB_SCRIPT_DIR/use-app-ruby.sh
35
+ # Now we can do the actual restart of the worker. Make sure to have double quotes when using env vars in the command.
36
+ cd $EB_APP_DEPLOY_DIR
37
+ su -s /bin/bash -c "RAILS_ENV=production bundle exec thin -C config/private_pub_thin.yml --timeout 60 start -d" $EB_APP_USER
38
+
39
+ #---
40
+ options:
41
+ aws:elasticbeanstalk:application:environment:
42
+ RAILS_ENV: foobar
43
+
44
+ aws:autoscaling:launchconfiguration:
45
+ InstanceType: foo
46
+ EC2KeyName: eb-ssh
47
+ SecurityGroups: 'acme-production-control'
48
+
49
+ aws:autoscaling:asg:
50
+ MinSize: 1
51
+ MaxSize: 5
52
+
53
+ aws:elb:loadbalancer:
54
+ SSLCertificateId: 'arn:aws:iam::XXXXXXX:server-certificate/acme'
55
+ LoadBalancerHTTPSPort: 443
56
+
57
+ aws:elb:policies:
58
+ Stickiness Policy: true
59
+
60
+ aws:elasticbeanstalk:sns:topics:
61
+ Notification Endpoint: 'alerts@acme.com'
62
+
63
+ aws:elasticbeanstalk:application:
64
+ Application Healthcheck URL: '/healthcheck'
65
+
66
+ inactive:
67
+ aws:autoscaling:asg:
68
+ MinSize: 0
69
+ Cooldown: 900
70
+
71
+ #---
72
+ development:
73
+ strategy: inplace-update
74
+ options:
75
+ aws:autoscaling:launchconfiguration:
76
+ InstanceType: t1.micro
77
+ #---
78
+ production:
79
+ options:
80
+ aws:autoscaling:launchconfiguration:
81
+ InstanceType: t1.small
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ # our gem
5
+ require 'elastic/beanstalk'
6
+
7
+ RSpec.configure do |config|
8
+ end
metadata ADDED
@@ -0,0 +1,266 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: enhanced-elastic-beanstalk
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.3
5
+ platform: ruby
6
+ authors:
7
+ - Matt E. Patterson
8
+ - Kevin Ross
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2016-02-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec_junit_formatter
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: railties
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '3.2'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '3.2'
84
+ - !ruby/object:Gem::Dependency
85
+ name: eb_deployer
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 0.6.1
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 0.6.1
98
+ - !ruby/object:Gem::Dependency
99
+ name: awesome_print
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: time_diff
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rubyzip
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :runtime
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: table_print
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :runtime
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ - !ruby/object:Gem::Dependency
155
+ name: nokogiri
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ type: :runtime
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ - !ruby/object:Gem::Dependency
169
+ name: dry-config
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: 1.2.0
175
+ type: :runtime
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: 1.2.0
182
+ - !ruby/object:Gem::Dependency
183
+ name: hipchat
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ type: :runtime
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ description: |2
197
+ The simplest way to configure and deploy an Elastic Beanstalk application via rake.
198
+
199
+ This fork of `elastic-beanstalk` has some enhancements that we felt weren't
200
+ worthy of a pull request to the original project, thus the forked version.
201
+ Unless you specifically need HipChat support and custom eb env names, it is
202
+ recommended you go use the latest version of the original gem. https://github.com/alienfast/elastic-beanstalk
203
+ email:
204
+ - mepatterson@skillsengine.com
205
+ - kevin.ross@alienfast.com
206
+ executables:
207
+ - elastic-beanstalk
208
+ extensions: []
209
+ extra_rdoc_files: []
210
+ files:
211
+ - ".DS_Store"
212
+ - ".gitignore"
213
+ - ".rspec"
214
+ - ".ruby-gemset"
215
+ - ".ruby-version"
216
+ - Gemfile
217
+ - LICENSE.txt
218
+ - README.md
219
+ - Rakefile
220
+ - bin/elastic-beanstalk
221
+ - enhanced-elastic-beanstalk.gemspec
222
+ - lib/elastic/beanstalk.rb
223
+ - lib/elastic/beanstalk/config.rb
224
+ - lib/elastic/beanstalk/extensions.rb
225
+ - lib/elastic/beanstalk/railtie.rb
226
+ - lib/elastic/beanstalk/smoke_tester.rb
227
+ - lib/elastic/beanstalk/spinner.rb
228
+ - lib/elastic/beanstalk/tasks/eb.rake
229
+ - lib/elastic/beanstalk/version.rb
230
+ - spec/lib/elastic/beanstalk/eb_config_spec.rb
231
+ - spec/lib/elastic/beanstalk/eb_extensions_spec.rb
232
+ - spec/lib/elastic/beanstalk/eb_smoke_tester_spec.rb
233
+ - spec/lib/elastic/beanstalk/eb_spec.yml
234
+ - spec/spec_helper.rb
235
+ homepage: https://github.com/mepatterson/enhanced-elastic-beanstalk
236
+ licenses:
237
+ - MIT
238
+ metadata: {}
239
+ post_install_message:
240
+ rdoc_options: []
241
+ require_paths:
242
+ - lib
243
+ required_ruby_version: !ruby/object:Gem::Requirement
244
+ requirements:
245
+ - - ">="
246
+ - !ruby/object:Gem::Version
247
+ version: '0'
248
+ required_rubygems_version: !ruby/object:Gem::Requirement
249
+ requirements:
250
+ - - ">="
251
+ - !ruby/object:Gem::Version
252
+ version: '0'
253
+ requirements: []
254
+ rubyforge_project:
255
+ rubygems_version: 2.4.8
256
+ signing_key:
257
+ specification_version: 4
258
+ summary: Configure and deploy a rails app to Elastic Beanstalk via rake in 60 seconds.
259
+ Maintain multiple environment DRY configurations and .ebextensions in one easy to
260
+ use configuration file.
261
+ test_files:
262
+ - spec/lib/elastic/beanstalk/eb_config_spec.rb
263
+ - spec/lib/elastic/beanstalk/eb_extensions_spec.rb
264
+ - spec/lib/elastic/beanstalk/eb_smoke_tester_spec.rb
265
+ - spec/lib/elastic/beanstalk/eb_spec.yml
266
+ - spec/spec_helper.rb