convox_installer 1.0.8 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae064bb3fa4954c0edd52b0d97127477ed73f0059c36b6c71f0f091b5b93608e
4
- data.tar.gz: 8cadcac34a2eeaf4b68f323b5e9c2dd9ec528be4cf14a5fe2b9145cb0cb9d8cd
3
+ metadata.gz: ea8a81c025b1a5046d3145beeee5cba92f8448cc8751182d911f3548b289c31a
4
+ data.tar.gz: 8eb61f167e06eb67bcd86eada0196d138995b3e61b237ce04f11891f6eb1426c
5
5
  SHA512:
6
- metadata.gz: b4ba638e5dffe9ab773f4b5f5bad934fc112c2cdc2cede74ca7e8ae2351bf900d33a7681ec20e9bbcbd7813e62e1e4b927aa78ba30041ec0cc3644bd2a753f4e
7
- data.tar.gz: a1e4ef7404bf7da3d425c0d5ac0192d035949bf3467a28fee45b244316e07473cff3dcfe361768f7f638984ac1949c5ccdc68d5cb9ddcfc16c1da1bcb9c19186
6
+ metadata.gz: db7f9e671230b4054a888397461056af9f8ee2d631e0d05fb4eda32a138ae947e7f7fdee8706ea3b9b695254d9fa8b5c2971222a68d8ba4ad8a1326917357f65
7
+ data.tar.gz: 8dd7d82786491eca18253d6dc405675fbe6c188c0276878ed352e3f9c17770aca9a4906b8819d061dd6940a203832e0808e9f1aa8427bddc9505d89974f39c69
data/.rubocop.yml CHANGED
@@ -1,7 +1,14 @@
1
1
  require: rubocop-rspec
2
- TargetRubyVersion: "2.3"
3
2
 
4
- Metrics/LineLength:
3
+ AllCops:
4
+ NewCops: enable
5
+ TargetRubyVersion: 2.5
6
+
7
+ Style/MixinUsage:
8
+ Exclude:
9
+ - examples/**/*
10
+
11
+ Layout/LineLength:
5
12
  Max: 100
6
13
 
7
14
  Style/StringLiterals:
@@ -39,3 +46,18 @@ Metrics/BlockLength:
39
46
 
40
47
  Metrics/BlockNesting:
41
48
  Max: 7
49
+
50
+ RSpec/MessageSpies:
51
+ Enabled: false
52
+
53
+ RSpec/StubbedMock:
54
+ Enabled: false
55
+
56
+ RSpec/MultipleExpectations:
57
+ Enabled: false
58
+
59
+ RSpec/ExampleLength:
60
+ Enabled: false
61
+
62
+ RSpec/AnyInstance:
63
+ Enabled: false
@@ -1,4 +1,5 @@
1
1
  {
2
2
  "editor.formatOnSave": true,
3
- "editor.formatOnSaveTimeout": 5000
4
- }
3
+ "editor.formatOnSaveTimeout": 5000,
4
+ "ruby.rubocop.executePath": "/usr/local/bin/rubocop-daemon-wrapper/"
5
+ }
data/Gemfile CHANGED
@@ -5,10 +5,11 @@ source 'https://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  group :test do
8
- gem 'pry'
9
- gem 'pry-byebug'
8
+ gem 'pry', require: false
9
+ gem 'pry-byebug', require: false
10
10
  gem 'rspec'
11
11
  gem 'rubocop'
12
+ gem 'rubocop-daemon'
12
13
  gem 'rubocop-rspec'
13
14
  gem 'vcr'
14
15
  gem 'webmock'
data/README.md CHANGED
@@ -1,10 +1,26 @@
1
1
  # Convox Installer
2
2
 
3
- A Ruby gem that makes it easier to build a Convox installation script. This is like Chef/Ansible/Terraform for your initial Convox setup.
3
+ A Ruby gem that makes it easier to build a Convox installation script. The main purpose of this gem is to make it easier to set up on-premise installations of your app for enterprise users.
4
4
 
5
- ## NOTE: This software is an alpha version
5
+ This gem provides a DSL so that you can write a script that walks your users through setting up Convox and getting your app and running, setting up S3 buckets, etc.
6
6
 
7
- Please note that the code quality is not very good, and the test coverage needs to be improved. However, I've successfully set up a number of test and production deployments using this gem, and everything seems to work very well. The library also facilitates idempotency and crash-resistance, so you can easily re-run your installation script if something goes wrong.
7
+ ## Requirements
8
+
9
+ - MacOS
10
+ - Convox v3 CLI
11
+ - Runtime integration installed in your AWS account. See: https://docs.convox.com/getting-started/introduction/
12
+
13
+ _Please let us know if you need to run this script on Linux. Linux support should not be too difficult to implement, but unfortunately we probably won't be able to support Windows._
14
+
15
+ ### Requires Convox >= 3
16
+
17
+ This version of `convox_installer` is only designed to work with Convox 3 and later. You can run `convox version` to check your version. Please install the Convox v3 CLI by following the instructions here: https://docs.convox.com/getting-started/introduction/
18
+
19
+ _If you want to set up a Convox v2 rack (deprecated), the last version of `convox_installer` that supports the v2 CLI is `1.0.9`. (Take a look at [the `convox2` branch](https://github.com/DocSpring/convox_installer/tree/convox2).)_
20
+
21
+ ## USE AT YOUR OWN RISK! THIS CODE IS PROVIDED WITHOUT ANY WARRANTIES OR GUARANTEES
22
+
23
+ We have successfully set up a number of test and production deployments using this gem. Everything seems to work very well. The library also facilitates idempotency and crash-resistance, so you can easily re-run your installation script if something goes wrong. However, if anything goes wrong, then you can end up with a large AWS bill if you're not careful. If anything crashes then make sure you double-check everything in your AWS account and shut down any leftover resources. **USE THIS SOFTWARE AT YOUR OWN RISK.**
8
24
 
9
25
  ## Features
10
26
 
@@ -22,7 +38,7 @@ Please note that the code quality is not very good, and the test coverage needs
22
38
 
23
39
  `convox_installer` is a Ruby gem that makes it much easier to build an installation script for `convox/rack` (the open source PaaS). The Convox CLI is awesome, but it's missing a nice way to script a full deployment. I originally wrote a bash script that made API calls and used [`jq`](https://stedolan.github.io/jq/) and `sed`, but this was very error-prone and it did not have good cross-platform support.
24
40
 
25
- I've rewritten this installation script in Ruby, which provides very good cross-platform support, and also allows me to write tests.
41
+ I've written this installation script in Ruby, which provides very good cross-platform support, and also allows me to write tests.
26
42
 
27
43
  ## Usage
28
44
 
@@ -34,7 +50,7 @@ require 'bundler/inline'
34
50
 
35
51
  gemfile do
36
52
  source 'https://rubygems.org'
37
- gem 'convox_installer'
53
+ gem 'convox_installer', '3.0.0'
38
54
  end
39
55
 
40
56
  require "convox_installer"
@@ -138,10 +154,6 @@ Makes sure that the `convox` and `aws` CLI tools are installed on this system. I
138
154
  Loads config from ENV vars, or from saved config at `./.installer_config.json`.
139
155
  If any config settings are missing, it prompts the user for input. Finally, it shows a summary of the config, and asks the user if they want to proceed with the installation. If the user enters `y` (or `yes`), the `prompt_for_config` method completes. If they enter `n` (or `no`), we loop over every setting and let them press "enter" to keep the current value, or provide a new value to correct any mistakes.
140
156
 
141
- #### `backup_convox_host_and_rack`
142
-
143
- If there are any existing files at `~/.convox/host` or `~/.convox/rack`, this method moves these to `~/.convox/host.bak` and `~/.convox/rack.bak`.
144
-
145
157
  #### `install_convox`
146
158
 
147
159
  - **Required Config:** `aws_region`, `aws_access_key_id`, `aws_secret_access_key`,
@@ -149,13 +161,13 @@ If there are any existing files at `~/.convox/host` or `~/.convox/rack`, this me
149
161
 
150
162
  Runs `convox rack install ...`. Has some validations to ensure that all required settings are present.
151
163
 
152
- #### `validate_convox_auth_and_set_host!`
164
+ #### `validate_convox_rack_and_write_current!`
153
165
 
154
- After running `install_convox`, call this method to ensure that the the `~/.convox/auth` file has been updated with the correct details (checks the rack name and AWS region.) Then it sets the rack host in `~/.convox/host` (if not already set.)
166
+ Ensures that the local machine contains a directory for the rack's terraform config, and sets the current rack for Convox CLI commands.
155
167
 
156
- #### `validate_convox_rack!`
168
+ #### `validate_convox_rack_api!`
157
169
 
158
- Calls `convox api get /system` to get the Rack details, then makes sure that everything is correct.
170
+ Makes an API request (`convox api get /system`) to get the rack details, and makes sure that everything is correct.
159
171
 
160
172
  #### `convox_rack_data`
161
173
 
@@ -171,10 +183,14 @@ Checks if the app already exists. If not, calls `convox apps create ... --wait`
171
183
 
172
184
  Writes the app name into `./.convox/app` (in the current directory.) The `convox` CLI reads this file, so you don't need to specify the `--app` flag for future commands.
173
185
 
174
- #### `create_s3_bucket!`
186
+ #### `add_s3_bucket`
187
+
188
+ Adds an S3 bucket to your Terraform config.
175
189
 
176
190
  - **Required Config:** `s3_bucket_name`
177
191
 
192
+ NOTE: This method just writes a new Terraform configuration file. You must run `apply_terraform_update!` to apply the changes and create the S3 bucket.
193
+
178
194
  Creates an S3 bucket from the `:s3_bucket_name` config setting. This is not a default setting, so you can add something like this to your custom `@prompts`:
179
195
 
180
196
  ```ruby
@@ -187,41 +203,97 @@ Creates an S3 bucket from the `:s3_bucket_name` config setting. This is not a de
187
203
 
188
204
  The `:value` `Proc` will generate a bucket name with a random suffix. (Avoids conflicts when you are setting up multiple deployments for your app.)
189
205
 
190
- `create_s3_bucket!` will also call `set_s3_bucket_cors_policy` automatically, so you don't need to call this manually.
206
+ You can also set a CORS policy for your S3 bucket. (`:s3_bucket_name`)
207
+ We set the `cors_rule` option for the `aws_s3_bucket` resource in the Terraform configuration. Example:
191
208
 
192
- #### `set_s3_bucket_cors_policy`
193
-
194
- - **Required Config:** `s3_bucket_name`
209
+ ```
210
+ cors_rule {
211
+ allowed_headers = ["*"]
212
+ allowed_methods = ["PUT", "POST"]
213
+ allowed_origins = ["https://s3-website-test.hashicorp.com"]
214
+ expose_headers = ["ETag"]
215
+ max_age_seconds = 3000
216
+ }
217
+ ```
195
218
 
196
- Set up a CORS policy for your S3 bucket. (`:s3_bucket_name`)
219
+ See: https://registry.terraform.io/providers/hashicorp/aws/3.33.0/docs/resources/s3_bucket#using-cors
197
220
 
198
- _Note: If the `:s3_bucket_cors_policy` setting is not provided, then this method does nothing._
221
+ _Note: If the `:s3_bucket_cors_rule` setting is not provided, then it is skipped._
199
222
 
200
- You should set `:s3_bucket_cors_policy` to a JSON string. Here's how I set this up in my own `install.rb` script:
223
+ Here's how we set up a CORS policy in our own `install.rb` script:
201
224
 
202
225
  ```ruby
203
- S3_BUCKET_CORS_POLICY = <<-JSON
204
- {
205
- "CORSRules": [
206
- {
207
- "AllowedOrigins": ["*"],
208
- "AllowedHeaders": ["Authorization", "cache-control", "x-requested-with"],
209
- "AllowedMethods": ["PUT", "POST", "GET"],
210
- "MaxAgeSeconds": 3000
211
- }
212
- ]
213
- }
214
- JSON
226
+ xxxxc = <<-TERRAFORM
227
+ cors_rule {
228
+ allowed_headers = ["Authorization", "cache-control", "x-requested-with"]
229
+ allowed_methods = ["PUT", "POST", "GET"]
230
+ allowed_origins = ["*"]
231
+ expose_headers = []
232
+ max_age_seconds = 3000
233
+ }
234
+ TERRAFORM
215
235
 
216
236
  @prompts = [
217
237
  {
218
- key: :s3_bucket_cors_policy,
219
- value: S3_BUCKET_CORS_POLICY,
238
+ key: :s3_bucket_cors_rule,
239
+ value: S3_BUCKET_CORS_RULE,
220
240
  hidden: true,
221
241
  }
222
242
  ]
223
243
  ```
224
244
 
245
+ #### `add_rds_database`
246
+
247
+ Adds an RDS database to your Terraform config.
248
+
249
+ - **Required Config:**
250
+ - `database_username`
251
+ - `database_password`
252
+ - **Optional Config:**
253
+ - `database_allocated_storage` _(default: 30)_
254
+ - `database_engine` _(default: 'postgres')_
255
+ - `database_engine_version` _(default: '14.2')_
256
+ - `database_instance_class` _(default: 'db.t3.medium')_
257
+ - `database_multi_az` _(default: true)_
258
+
259
+ #### `add_add_elasticache_cluster`
260
+
261
+ Adds an Elasticache cluster to your Terraform config.
262
+
263
+ - **Optional Config:**
264
+ - `engine` _(default: 'redis')_
265
+ - `engine_version` _(default: '6.2.5')_
266
+ - `node_type` _(default: 'cache.m3.medium')_
267
+ - `database_instance_class` _(default: 'db.t3.medium')_
268
+ - `num_cache_nodes` _(default: 1)_
269
+ - `port` _(default: 6379)_
270
+
271
+ _IMPORTANT: Make sure you specify a full version string (e.g. `6.2.5`), and not a partial version (e.g. `6.2`.) A partial version will cause Terraform to delete and recreate the cluster on every run._
272
+
273
+ #### `apply_terraform_update!`
274
+
275
+ Runs `terraform apply -auto-approve` to apply any changes to your Terraform configuration (add new resources, etc.)
276
+
277
+ #### `rds_details`
278
+
279
+ Returns information about the created RDS database resource.
280
+
281
+ ```ruby
282
+ {
283
+ postgres_url: "Full URL for the RDS database (including auth)",
284
+ }
285
+ ```
286
+
287
+ #### `elasticache_details`
288
+
289
+ Returns information about the created RDS database resource.
290
+
291
+ ```ruby
292
+ {
293
+ redis_url: "Full URL for the Redis cluster",
294
+ }
295
+ ```
296
+
225
297
  #### `s3_bucket_details`
226
298
 
227
299
  - **Required Config:** `s3_bucket_name`
@@ -246,13 +318,14 @@ Checks the list of registries to see if `docker_registry_url` has already been a
246
318
 
247
319
  #### `default_service_domain_name`
248
320
 
249
- - **Required Config:** `convox_app_name`, `default_service`
321
+ - **Required Config:** `convox_app_name`
322
+ - **Optional Config:** `default_service`
250
323
 
251
- Parses the rack router ELB name and region, and returns the default `convox.site` domain for your default service. (You can visit this URL in the browser to access your app.)
324
+ Finds the default `*.convox.cloud` URL for the web service. (You can visit this URL in the browser to access your app.)
252
325
 
253
- Example: `myapp-web.rackname-route-abcdfe123456-123456789.us-west-2.convox.site`
326
+ Example: `web.docspring.dc6bae48c2e36366.convox.cloud`
254
327
 
255
- Set a default service in your config prompts (e.g. `web`):
328
+ You can override the default service name in your config (e.g. `web`):
256
329
 
257
330
  ```ruby
258
331
  @prompts = [
@@ -1,28 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.push File.expand_path("lib", __dir__)
4
- require "convox_installer/version"
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+ require 'convox_installer/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "convox_installer"
7
+ s.name = 'convox_installer'
8
8
  s.version = ConvoxInstaller::VERSION
9
9
  s.platform = Gem::Platform::RUBY
10
- s.authors = ["Form Applications Inc."]
11
- s.email = ["support@formapi.io"]
12
- s.homepage = "https://github.com/FormAPI/convox_installer"
13
- s.summary = "Build a Convox installation workflow"
14
- s.description = "Build a Convox installation workflow"
15
- s.license = "MIT"
16
- s.required_ruby_version = ">= 2.3"
10
+ s.authors = ['Form Applications Inc.']
11
+ s.email = ['support@formapi.io']
12
+ s.homepage = 'https://github.com/FormAPI/convox_installer'
13
+ s.summary = 'Build a Convox installation workflow'
14
+ s.description = 'Build a Convox installation workflow'
15
+ s.license = 'MIT'
16
+ s.required_ruby_version = '>= 2.5'
17
17
 
18
- s.add_runtime_dependency "highline", ">= 1.7.10"
19
- s.add_runtime_dependency "json", ">= 2.2.0"
20
- s.add_runtime_dependency "os", ">= 1.0.1"
21
- s.add_runtime_dependency "httparty", ">= 0.17.0"
22
- s.add_runtime_dependency "activesupport", ">= 5.2.3"
18
+ s.add_runtime_dependency 'activesupport', '>= 5.2.3'
19
+ s.add_runtime_dependency 'highline', '>= 1.7.10'
20
+ s.add_runtime_dependency 'httparty', '>= 0.17.0'
21
+ s.add_runtime_dependency 'json', '>= 2.2.0'
22
+ s.add_runtime_dependency 'os', '>= 1.0.1'
23
23
 
24
- s.files = `git ls-files`.split("\n").uniq.sort.reject(&:empty?) - ["Gemfile.lock"]
24
+ s.files = `git ls-files`.split("\n").uniq.sort.reject(&:empty?) - ['Gemfile.lock']
25
25
  s.test_files = `git ls-files spec test`.split("\n")
26
26
  s.executables = []
27
- s.require_paths = ["lib"]
27
+ s.require_paths = ['lib']
28
+ s.metadata['rubygems_mfa_required'] = 'true'
28
29
  end
@@ -9,82 +9,89 @@
9
9
  # gem "convox_installer"
10
10
  # end
11
11
 
12
- $LOAD_PATH << File.expand_path("../../lib", __FILE__)
13
- require "pry-byebug"
12
+ $LOAD_PATH << File.expand_path('../lib', __dir__)
13
+ require 'pry-byebug'
14
14
 
15
- require "convox_installer"
15
+ require 'convox_installer'
16
16
  include ConvoxInstaller
17
17
 
18
18
  @log_level = Logger::DEBUG
19
19
 
20
- MINIMAL_HEALTH_CHECK_PATH = "/health/site"
21
- COMPLETE_HEALTH_CHECK_PATH = "/health"
22
-
23
- S3_BUCKET_CORS_POLICY = <<-JSON
24
- {
25
- "CORSRules": [
26
- {
27
- "AllowedOrigins": ["*"],
28
- "AllowedHeaders": ["Authorization", "cache-control", "x-requested-with"],
29
- "AllowedMethods": ["PUT", "POST", "GET"],
30
- "MaxAgeSeconds": 3000
31
- }
32
- ]
33
- }
34
- JSON
20
+ MINIMAL_HEALTH_CHECK_PATH = '/health/site'
21
+ COMPLETE_HEALTH_CHECK_PATH = '/health'
22
+
23
+ S3_BUCKET_CORS_RULE = <<-TERRAFORM
24
+ cors_rule {
25
+ allowed_headers = ["Authorization", "cache-control", "x-requested-with"]
26
+ allowed_methods = ["PUT", "POST", "GET"]
27
+ allowed_origins = ["*"]
28
+ expose_headers = []
29
+ max_age_seconds = 3000
30
+ }
31
+ TERRAFORM
35
32
 
36
33
  @prompts = ConvoxInstaller::Config::DEFAULT_PROMPTS + [
37
34
  {
38
- section: "Docker Registry Authentication",
35
+ section: 'Docker Registry Authentication',
39
36
  info: "You should have received authentication details for the Docker Registry\n" \
40
- "via email. If not, please contact support@example.com",
37
+ 'via email. If not, please contact support@example.com'
41
38
  },
42
39
  {
43
40
  key: :docker_registry_url,
44
- title: "Docker Registry URL",
45
- value: "691950705664.dkr.ecr.us-east-1.amazonaws.com",
41
+ title: 'Docker Registry URL',
42
+ value: '691950705664.dkr.ecr.us-east-1.amazonaws.com'
46
43
  },
47
44
  {
48
45
  key: :docker_registry_username,
49
- title: "Docker Registry Username",
46
+ title: 'Docker Registry Username'
50
47
  },
51
48
  {
52
49
  key: :docker_registry_password,
53
- title: "Docker Registry Password",
50
+ title: 'Docker Registry Password'
54
51
  },
55
52
  {
56
53
  key: :convox_app_name,
57
- title: "Convox App Name",
58
- value: "convox-app",
54
+ title: 'Convox App Name',
55
+ value: 'convox-app'
59
56
  },
60
57
  {
61
58
  key: :default_service,
62
- title: "Default Convox Service (for domain)",
63
- value: "web",
64
- hidden: true,
59
+ title: 'Default Convox Service (for domain)',
60
+ value: 'web',
61
+ hidden: true
65
62
  },
66
63
  {
67
64
  key: :admin_email,
68
- title: "Admin User Email",
69
- prompt: "Please enter the email address you would like to use " \
70
- "for the default admin user",
71
- default: "admin@example.com",
65
+ title: 'Admin User Email',
66
+ prompt: 'Please enter the email address you would like to use ' \
67
+ 'for the default admin user',
68
+ default: 'admin@example.com'
72
69
  },
73
70
  {
74
71
  key: :admin_password,
75
- title: "Admin User Password",
76
- value: -> () { SecureRandom.hex(8) },
72
+ title: 'Admin User Password',
73
+ value: -> { SecureRandom.hex(8) }
77
74
  },
78
75
  {
79
76
  key: :s3_bucket_name,
80
- title: "S3 Bucket for Uploads",
81
- value: -> () { "app-uploads-#{SecureRandom.hex(4)}" },
77
+ title: 'S3 Bucket for Uploads',
78
+ value: -> { "app-uploads-#{SecureRandom.hex(4)}" }
82
79
  },
83
80
  {
84
- key: :s3_bucket_cors_policy,
85
- value: S3_BUCKET_CORS_POLICY,
86
- hidden: true,
81
+ key: :s3_bucket_cors_rule,
82
+ value: S3_BUCKET_CORS_RULE,
83
+ hidden: true
87
84
  },
85
+ {
86
+ key: :database_username,
87
+ value: 'example_app',
88
+ hidden: true
89
+ },
90
+ {
91
+ key: :database_password,
92
+ value: -> { SecureRandom.hex(16) },
93
+ hidden: true
94
+ }
88
95
  ]
89
96
 
90
97
  ensure_requirements!
@@ -93,78 +100,78 @@ config = prompt_for_config
93
100
  backup_convox_host_and_rack
94
101
  install_convox
95
102
 
96
- validate_convox_auth_and_set_host!
97
- validate_convox_rack!
103
+ validate_convox_auth_and_write_host!
104
+ validate_convox_rack_api!
98
105
 
99
106
  create_convox_app!
100
107
  set_default_app_for_directory!
101
108
  add_docker_registry!
102
109
  create_s3_bucket!
103
110
 
104
- puts "=> Generating secret keys for authentication sessions and encryption..."
111
+ puts '=> Generating secret keys for authentication sessions and encryption...'
105
112
  secret_key_base = SecureRandom.hex(64)
106
113
  data_encryption_key = SecureRandom.hex(32)
107
114
 
108
115
  puts "======> Default domain: #{default_service_domain_name}"
109
- puts " You can use this as a CNAME record after configuring a domain in convox.yml"
110
- puts " (Note: SSL will be configured automatically.)"
116
+ puts ' You can use this as a CNAME record after configuring a domain in convox.yml'
117
+ puts ' (Note: SSL will be configured automatically.)'
111
118
 
112
- puts "=> Setting environment variables to configure the application..."
119
+ puts '=> Setting environment variables to configure the application...'
113
120
 
114
121
  env = {
115
- "HEALTH_CHECK_PATH" => MINIMAL_HEALTH_CHECK_PATH,
116
- "DOMAIN_NAME" => default_service_domain_name,
117
- "AWS_ACCESS_KEY_ID" => s3_bucket_details.fetch(:access_key_id),
118
- "AWS_ACCESS_KEY_SECRET" => s3_bucket_details.fetch(:secret_access_key),
119
- "AWS_UPLOADS_S3_BUCKET" => s3_bucket_details.fetch(:name),
120
- "AWS_UPLOADS_S3_REGION" => config.fetch(:aws_region),
121
- "SECRET_KEY_BASE" => secret_key_base,
122
- "DATA_ENCRYPTION_KEY" => data_encryption_key,
123
- "ADMIN_NAME" => "Admin",
124
- "ADMIN_EMAIL" => config.fetch(:admin_email),
125
- "ADMIN_PASSWORD" => config.fetch(:admin_password),
122
+ 'HEALTH_CHECK_PATH' => MINIMAL_HEALTH_CHECK_PATH,
123
+ 'DOMAIN_NAME' => default_service_domain_name,
124
+ 'AWS_ACCESS_KEY_ID' => s3_bucket_details.fetch(:access_key_id),
125
+ 'AWS_ACCESS_KEY_SECRET' => s3_bucket_details.fetch(:secret_access_key),
126
+ 'AWS_UPLOADS_S3_BUCKET' => s3_bucket_details.fetch(:name),
127
+ 'AWS_UPLOADS_S3_REGION' => config.fetch(:aws_region),
128
+ 'SECRET_KEY_BASE' => secret_key_base,
129
+ 'DATA_ENCRYPTION_KEY' => data_encryption_key,
130
+ 'ADMIN_NAME' => 'Admin',
131
+ 'ADMIN_EMAIL' => config.fetch(:admin_email),
132
+ 'ADMIN_PASSWORD' => config.fetch(:admin_password)
126
133
  }
127
134
 
128
- env_command_params = env.map { |k, v| "#{k}=\"#{v}\"" }.join(" ")
135
+ env_command_params = env.map { |k, v| "#{k}=\"#{v}\"" }.join(' ')
129
136
  run_convox_command! "env set #{env_command_params}"
130
137
 
131
- puts "=> Initial deploy..."
132
- puts "-----> Documentation: https://docs.convox.com/deployment/builds"
133
- run_convox_command! "deploy --wait"
138
+ puts '=> Initial deploy...'
139
+ puts '-----> Documentation: https://docs.convox.com/deployment/deploying-changes/'
140
+ run_convox_command! 'deploy --wait'
134
141
 
135
- puts "=> Setting up the database..."
136
- run_convox_command! "run web rake db:create db:migrate db:seed"
142
+ puts '=> Setting up the database...'
143
+ run_convox_command! 'run web rake db:create db:migrate db:seed'
137
144
 
138
- puts "=> Updating the health check path to include database tests..."
145
+ puts '=> Updating the health check path to include database tests...'
139
146
  run_convox_command! "env set --promote --wait HEALTH_CHECK_PATH=#{COMPLETE_HEALTH_CHECK_PATH}"
140
147
 
141
148
  puts
142
- puts "All done!"
149
+ puts 'All done!'
143
150
  puts
144
151
  puts "You can now visit #{default_service_domain_name} and sign in with:"
145
152
  puts
146
153
  puts " Email: #{config.fetch(:admin_email)}"
147
154
  puts " Password: #{config.fetch(:admin_password)}"
148
155
  puts
149
- puts "You can configure a custom domain name, auto-scaling, and other options in convox.yml."
150
- puts "To deploy your changes, run: convox deploy --wait"
156
+ puts 'You can configure a custom domain name, auto-scaling, and other options in convox.yml.'
157
+ puts 'To deploy your changes, run: convox deploy --wait'
151
158
  puts
152
159
  puts "IMPORTANT: You should be very careful with the 'resources' section in convox.yml."
153
- puts "If you remove, rename, or change these resources, then Convox will delete"
154
- puts "your database. This will result in downtime and a loss of data."
155
- puts "To prevent this from happening, you can sign into your AWS account,"
156
- puts "visit the RDS and ElastiCache services, and enable \"Termination Protection\""
157
- puts "for your database resources."
160
+ puts 'If you remove, rename, or change these resources, then Convox will delete'
161
+ puts 'your database. This will result in downtime and a loss of data.'
162
+ puts 'To prevent this from happening, you can sign into your AWS account,'
163
+ puts 'visit the RDS and ElastiCache services, and enable "Termination Protection"'
164
+ puts 'for your database resources.'
158
165
  puts
159
- puts "To learn more about the convox CLI, run: convox --help"
166
+ puts 'To learn more about the convox CLI, run: convox --help'
160
167
  puts
161
- puts " * View the Convox documentation: https://docs.convox.com/"
168
+ puts ' * View the Convox documentation: https://docs.convox.com/'
162
169
  puts
163
170
  puts
164
- puts "To completely uninstall Convox from your AWS account,"
165
- puts "run the following steps (in this order):"
171
+ puts 'To completely uninstall Convox from your AWS account,'
172
+ puts 'run the following steps (in this order):'
166
173
  puts
167
- puts " 1) Disable \"Termination Protection\" for any resource where it was enabled."
174
+ puts ' 1) Disable "Termination Protection" for any resource where it was enabled.'
168
175
  puts
169
176
  puts " 2) Delete all files from the #{config.fetch(:s3_bucket_name)} S3 bucket:"
170
177
  puts
@@ -176,7 +183,7 @@ puts " 3) Delete the #{config.fetch(:s3_bucket_name)} S3 bucket:"
176
183
  puts
177
184
  puts " convox rack resources delete #{config.fetch(:s3_bucket_name)} --wait"
178
185
  puts
179
- puts " 4) Uninstall Convox (deletes all CloudFormation stacks and AWS resources):"
186
+ puts ' 4) Uninstall Convox (deletes all CloudFormation stacks and AWS resources):'
180
187
  puts
181
188
  puts " convox rack uninstall aws #{config.fetch(:stack_name)}"
182
189
  puts