convox_installer 1.0.1 → 1.0.6

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: 17cad3f4b73806ac2ed58a97ab6434e79dec6ef71ca6d569118fe5366e7ff195
4
- data.tar.gz: 8ab6d4b135cc5716688ae59519ea85f3600736a9b30cc851ae21c62502f7fefb
3
+ metadata.gz: 5a1bcd87ec2ab1bd0c720397964e8e641ad70017b582e8f72b3ea1c019f33cfc
4
+ data.tar.gz: ccc5bdfc3a20b4107d2fca2712b0d1268ce86ae40946a11bc4ed38f71b2a7021
5
5
  SHA512:
6
- metadata.gz: '08989fb82a81ab02b996852abdbd58319e5bf50f2ce4c44ea44824e4cd798e0b73b785739f445c7ea66b211e925edc5161e0c6bf98b637d58af6b5d4c19f2bf7'
7
- data.tar.gz: a20b0ebcc13e2be8fad48940dc970181e9faa76af1b1e8832759cfb3c22b21a972ab6d4a4c4389a84f1c401b0876e4d6deb9a3232e0434615db076322295294e
6
+ metadata.gz: 8f68b7a76cdc88e96b7cc4e2d24f02c28e95701481f4c33b58a72e2ef691295045fec93bdc39261827ffe510fdadf9c4e7faa0ad832ba31d5eb81fffc0288263
7
+ data.tar.gz: 0f6743f60a94e60ab3e82e94daa853ce5c624cf8f67d508a18e5fa0428748d8798c86487be87b17f9a5b7471c822eb9e5998b9eefa59cb209a1551f36dc99fa4
data/.bundle/config CHANGED
@@ -1,2 +1,2 @@
1
1
  ---
2
- BUNDLE_JOBS: "8"
2
+ BUNDLE_JOBS: "16"
data/README.md CHANGED
@@ -1,23 +1,283 @@
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.
4
+
5
+ ## NOTE: This software is an alpha version
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.
8
+
9
+ ## Features
10
+
11
+ - Idempotent. If this script crashes, you can restart it and it will pick up
12
+ where it left off. Every step looks up the existing state, and only makes a change
13
+ if things are not yet set up (or out of sync).
14
+ - Ensures that the `convox` and `aws` CLI tools are installed
15
+ - Wraps the `convox` CLI and parses JSON output from API calls
16
+ - Add n Docker Repository (e.g. ECR registry)
17
+ - Set up an S3 bucket with an optional CORS policy
18
+
19
+ ## Introduction
20
+
3
21
  [Convox](https://convox.com/) is an awesome open source PaaS, which is like Heroku for your own AWS account. [`convox/rack`](https://github.com/convox/rack) is completely open source and free to use, but you can also sign up for a free or paid account to use the hosted service on convox.com.
4
22
 
5
23
  `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.
6
24
 
7
25
  I've rewritten this installation script in Ruby, which provides very good cross-platform support, and also allows me to write tests.
8
26
 
9
- # Usage
27
+ ## Usage
28
+
29
+ Create a new Ruby file (e.g. `install.rb`), and use `bundler/inline` to install and require the `convox_installer` gem. Your install script should start like this:
30
+
31
+ ```ruby
32
+ #!/usr/bin/env ruby
33
+ require 'bundler/inline'
34
+
35
+ gemfile do
36
+ source 'https://rubygems.org'
37
+ gem 'convox_installer'
38
+ end
39
+
40
+ require "convox_installer"
41
+ include ConvoxInstaller
42
+ ```
10
43
 
11
- You should create a new git repo for your own installation script, and then use the provided classes and methods to build your own installation workflow. You must also include a `convox.yml`.
44
+ Including the `include ConvoxInstaller` gives you some Ruby methods that you can call to construct an installation workflow. See the "`ConvoxInstaller` DSL" section below.
12
45
 
13
- You can see an example in [`examples/full_installation.rb`](./examples/full_installation.rb).
14
- (This Ruby file uses `bundler/inline`, so it will download and install the `convox_installer` gem before running the script.)
46
+ You should create a new git repo for your own installation script, and then use the provided classes and methods to build your own installation workflow. You must also include a `convox.yml` (or a `convox.example.yml`).
15
47
 
16
- # Config
48
+ You can see a complete example in [`examples/full_installation.rb`](./examples/full_installation.rb).
49
+
50
+ ## Config
17
51
 
18
52
  Config is loaded from ENV vars, or from saved JSON data at
19
- `~/.convox/installer_config`.
53
+ `./.installer_config`. The script will save all of the user's responses into `./.installer_config` (in the current directory).
54
+
55
+ ## Customize the Config Prompts
56
+
57
+ You can set your own config prompts in your own installation script, by setting a `@prompts` instance variable. You can extend the default config prompts like this:
58
+
59
+ ```ruby
60
+ @prompts = ConvoxInstaller::Config::DEFAULT_PROMPTS + [
61
+ {
62
+ section: "Docker Authentication",
63
+ info: "You should have received authentication details for the Docker Registry\n" \
64
+ "via email. If not, please contact support@example.com",
65
+ },
66
+ {
67
+ key: :docker_registry_url,
68
+ title: "Docker Registry URL",
69
+ value: "1234567890.dkr.ecr.us-east-1.amazonaws.com",
70
+ },
71
+ {
72
+ key: :docker_registry_username,
73
+ title: "Docker Registry Username",
74
+ },
75
+ {
76
+ key: :docker_registry_password,
77
+ title: "Docker Registry Password",
78
+ }
79
+ ]
80
+ ```
81
+
82
+ ## Prompt API:
83
+
84
+ The `@prompts` variable must be an array of hashes. There are two kinds of hashes:
85
+
86
+ #### Section Heading
87
+
88
+ Shows a heading and optional details.
89
+
90
+ ```ruby
91
+ {
92
+ section: "The heading for this config section",
93
+ info: "Description about this config section"
94
+ }
95
+ ```
96
+
97
+ #### Config Prompt
98
+
99
+ - A config prompt with a default value:
100
+
101
+ ```ruby
102
+ {
103
+ key: :config_key_name,
104
+ title: "Title to show in the user prompt / config summary",
105
+ prompt: "Question to show the user",
106
+ default: "default value",
107
+ }
108
+ ```
109
+
110
+ - Set a value from a `Proc`, and don't prompt the user:
111
+
112
+ ```ruby
113
+ {
114
+ key: :config_key_name,
115
+ title: "Title to show in the config summary",
116
+ value: -> () { "string-with-random-suffix-#{SecureRandom.hex(4)}" },
117
+ }
118
+ ```
119
+
120
+ - Set a value, and hide this setting from the user (even in the summary):
121
+
122
+ ```ruby
123
+ {
124
+ key: :config_key_name,
125
+ value: "Config Value",
126
+ hidden: true,
127
+ },
128
+ ```
129
+
130
+ ## `ConvoxInstaller` DSL
131
+
132
+ #### `ensure_requirements!`
133
+
134
+ Makes sure that the `convox` and `aws` CLI tools are installed on this system. If not, shows installation instructions and exits.
135
+
136
+ #### `prompt_for_config`
137
+
138
+ Loads config from ENV vars, or from saved config at `./.installer_config`.
139
+ 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
+
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
+ #### `install_convox`
146
+
147
+ - **Required Config:** `aws_region`, `aws_access_key_id`, `aws_secret_access_key`,
148
+ `stack_name`, `instance_type`
149
+
150
+ Runs `convox rack install ...`. Has some validations to ensure that all required settings are present.
151
+
152
+ #### `validate_convox_auth_and_set_host!`
153
+
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.)
155
+
156
+ #### `validate_convox_rack!`
157
+
158
+ Calls `convox api get /system` to get the Rack details, then makes sure that everything is correct.
159
+
160
+ #### `convox_rack_data`
161
+
162
+ Returns a Ruby hash with all convox rack data.
163
+
164
+ #### `create_convox_app!`
165
+
166
+ - **Required Config:** `convox_app_name`
167
+
168
+ Checks if the app already exists. If not, calls `convox apps create ... --wait` to create a new app. Then waits for the app to be ready. (Avoids an occasional race condition.)
169
+
170
+ #### `set_default_app_for_directory!`
171
+
172
+ 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
+
174
+ #### `create_s3_bucket!`
175
+
176
+ - **Required Config:** `s3_bucket_name`
177
+
178
+ 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
+
180
+ ```ruby
181
+ {
182
+ key: :s3_bucket_name,
183
+ title: "S3 Bucket for uploads",
184
+ value: -> () { "yourapp-uploads-#{SecureRandom.hex(4)}" },
185
+ }
186
+ ```
187
+
188
+ 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
+
190
+ `create_s3_bucket!` will also call `set_s3_bucket_cors_policy` automatically, so you don't need to call this manually.
191
+
192
+ #### `set_s3_bucket_cors_policy`
193
+
194
+ - **Required Config:** `s3_bucket_name`
195
+
196
+ Set up a CORS policy for your S3 bucket. (`:s3_bucket_name`)
197
+
198
+ _Note: If the `:s3_bucket_cors_policy` setting is not provided, then this method does nothing._
199
+
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:
201
+
202
+ ```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
215
+
216
+ @prompts = [
217
+ {
218
+ key: :s3_bucket_cors_policy,
219
+ value: S3_BUCKET_CORS_POLICY,
220
+ hidden: true,
221
+ }
222
+ ]
223
+ ```
224
+
225
+ #### `s3_bucket_details`
226
+
227
+ - **Required Config:** `s3_bucket_name`
228
+
229
+ Get the S3 bucket details for `s3_bucket_name`. Parses the URL and returns a hash:
230
+
231
+ ```ruby
232
+ {
233
+ access_key_id: "AWS Access Key ID",
234
+ secret_access_key: "AWS Secret Access Key",
235
+ name: "Full S3 Bucket Name (includes the rack/app)",
236
+ }
237
+ ```
238
+
239
+ I use these S3 bucket details to set env variables for my app. (`convox env set ...`)
240
+
241
+ #### `add_docker_registry!`
242
+
243
+ - **Required Config:** `docker_registry_url`, `docker_registry_username`, `docker_registry_password`
244
+
245
+ Checks the list of registries to see if `docker_registry_url` has already been added. If not, runs `convox registries add ...` to add a new Docker registry (e.g. Docker Hub, ECR).
246
+
247
+ #### `default_service_domain_name`
248
+
249
+ - **Required Config:** `convox_app_name`, `default_service`
250
+
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.)
252
+
253
+ Example: `myapp-web.rackname-route-abcdfe123456-123456789.us-west-2.convox.site`
254
+
255
+ Set a default service in your config prompts (e.g. `web`):
256
+
257
+ ```ruby
258
+ @prompts = [
259
+ # ...
260
+ {
261
+ key: :default_service,
262
+ title: "Default Convox Service (for domain)",
263
+ value: "web",
264
+ hidden: true,
265
+ }
266
+ ]
267
+ ```
268
+
269
+ > (This hidden setting isn't visible to the user.)
270
+
271
+ #### `run_convox_command!(cmd)`
272
+
273
+ Runs a `convox` CLI command, and shows all output in the terminal. Crashes the script with an error if the `convox` command has a non-zero exit code.
274
+
275
+ If you want to run `convox env set MYVAR=value`, then you would call:
276
+
277
+ ```ruby
278
+ run_convox_command! 'env set MYVAR=value'
279
+ ```
20
280
 
21
- ### License
281
+ ## License
22
282
 
23
283
  [MIT](./LICENSE)
@@ -35,7 +35,7 @@ JSON
35
35
 
36
36
  @prompts = ConvoxInstaller::Config::DEFAULT_PROMPTS + [
37
37
  {
38
- section: "ECR Authentication",
38
+ section: "Docker Registry Authentication",
39
39
  info: "You should have received authentication details for the Docker Registry\n" \
40
40
  "via email. If not, please contact support@example.com",
41
41
  },
@@ -114,8 +114,8 @@ puts "=> Setting environment variables to configure the application..."
114
114
  env = {
115
115
  "HEALTH_CHECK_PATH" => MINIMAL_HEALTH_CHECK_PATH,
116
116
  "DOMAIN_NAME" => default_service_domain_name,
117
- "AWS_ACCESS_KEY_ID" => config.fetch(:aws_access_key_id),
118
- "AWS_ACCESS_KEY_SECRET" => config.fetch(:aws_secret_access_key),
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
119
  "AWS_UPLOADS_S3_BUCKET" => s3_bucket_details.fetch(:name),
120
120
  "AWS_UPLOADS_S3_REGION" => config.fetch(:aws_region),
121
121
  "SECRET_KEY_BASE" => secret_key_base,
data/lib/convox/client.rb CHANGED
@@ -375,7 +375,8 @@ module Convox
375
375
  app = config.fetch(:convox_app_name)
376
376
  service = config.fetch(:default_service)
377
377
 
378
- "#{app}-#{service}.#{elb_name_and_region}.convox.site"
378
+ # Need to return downcase host so that `config.hosts` works with Rails applications
379
+ "#{app}-#{service}.#{elb_name_and_region}.convox.site".downcase
379
380
  end
380
381
  end
381
382
 
@@ -390,7 +391,11 @@ module Convox
390
391
  def load_auth_from_file
391
392
  return {} unless File.exist?(AUTH_FILE)
392
393
 
393
- JSON.parse(File.read(AUTH_FILE))
394
+ begin
395
+ JSON.parse(File.read(AUTH_FILE))
396
+ rescue
397
+ {}
398
+ end
394
399
  end
395
400
 
396
401
  def require_config(required_keys)
@@ -34,15 +34,16 @@ module ConvoxInstaller
34
34
  install_convox
35
35
  validate_convox_auth_and_set_host!
36
36
  validate_convox_rack!
37
+ convox_rack_data
37
38
  create_convox_app!
38
39
  set_default_app_for_directory!
39
40
  create_s3_bucket!
40
41
  set_s3_bucket_cors_policy
41
- add_docker_registry!
42
42
  s3_bucket_details
43
- convox_rack_data
43
+ add_docker_registry!
44
44
  default_service_domain_name
45
45
  run_convox_command!
46
+ logger
46
47
  ].each do |method|
47
48
  define_method(method) do |*args|
48
49
  client.send(method, *args)
@@ -7,9 +7,9 @@ require "securerandom"
7
7
 
8
8
  module ConvoxInstaller
9
9
  class Config
10
- attr_accessor :logger, :config, :prompts, :highline
10
+ CONFIG_FILE = File.expand_path("./.installer_config").freeze
11
11
 
12
- CONFIG_FILE = File.expand_path("~/.convox/installer_config").freeze
12
+ attr_accessor :logger, :config, :prompts, :highline
13
13
 
14
14
  DEFAULT_PROMPTS = [
15
15
  {
@@ -129,7 +129,7 @@ module ConvoxInstaller
129
129
  return if config[key]
130
130
 
131
131
  default = prompt[:value]
132
- config[key] = default.is_a?(Proc) ? default.call : default
132
+ config[key] = default.is_a?(Proc) ? default.call(config) : default
133
133
  save_config_to_file
134
134
  return
135
135
  end
@@ -169,9 +169,9 @@ module ConvoxInstaller
169
169
  end
170
170
 
171
171
  def save_config_to_file
172
- FileUtils.mkdir_p File.expand_path("~/.convox")
172
+ # FileUtils.mkdir_p File.expand_path("~/.convox")
173
173
  File.open(CONFIG_FILE, "w") do |f|
174
- f.puts({config: config}.to_json)
174
+ f.puts({ config: config }.to_json)
175
175
  end
176
176
  end
177
177
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ConvoxInstaller
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.6"
5
5
  end
@@ -39,8 +39,8 @@ RSpec.describe Convox::Client do
39
39
  client = described_class.new
40
40
  expect { client.install_convox }.to raise_error("aws_region is missing from the config!")
41
41
 
42
- client = described_class.new(config: {aws_region: "asdf"})
43
- expect { client.install_convox }.to raise_error("aws_access_key_id is missing from the config!")
42
+ client = described_class.new(config: {aws_region: "us-east-1"})
43
+ expect { client.install_convox }.to raise_error("stack_name is missing from the config!")
44
44
  end
45
45
 
46
46
  it "should run the correct convox CLI command" do
@@ -4,12 +4,16 @@ require "convox_installer"
4
4
  require "securerandom"
5
5
 
6
6
  RSpec.describe ConvoxInstaller::Config do
7
+ before(:each) do
8
+ stub_const('ConvoxInstaller::Config::CONFIG_FILE', '/path/to/.installer_config')
9
+ end
10
+
7
11
  after(:each) do
8
12
  ENV.delete "AWS_REGION"
9
13
  ENV.delete "AWS_ACCESS_KEY_ID"
10
14
  end
11
15
 
12
- it "loads the saved config from ~/.convox/installer_config" do
16
+ it "loads the saved config from ./.installer_config" do
13
17
  expect(described_class).to receive(:config_file_exists?).and_return(true)
14
18
  expect(described_class).to receive(:read_config_file).and_return(
15
19
  '{ "config": { "aws_region": "us-west-2", "aws_access_key_id": "1234" } }'
@@ -40,7 +44,21 @@ RSpec.describe ConvoxInstaller::Config do
40
44
  output = StringIO.new
41
45
  highline = HighLine.new(input, output)
42
46
 
43
- input << "\nus-north-12\nasdf\nxkcd\n\nn\nconvox-test\n\nsdfg\n\n\ny\n"
47
+ input_details = [
48
+ [:stack_name, ""],
49
+ [:aws_region, ""],
50
+ [:instance_type, "c5.xlarge"],
51
+ [:aws_access_key_id, "asdf"],
52
+ [:aws_secret_access_key, "xkcd"],
53
+ [:confirm?, "n"],
54
+ [:stack_name, "convox-test"],
55
+ [:aws_region, "us-north-12"],
56
+ [:instance_type, "t3.medium"],
57
+ [:aws_access_key_id, "sdfg"],
58
+ [:aws_secret_access_key, ""],
59
+ [:confirm?, "y"],
60
+ ]
61
+ input << input_details.map(&:last).join("\n") << "\n"
44
62
  input.rewind
45
63
 
46
64
  config = described_class.new(highline: highline)
@@ -50,8 +68,8 @@ RSpec.describe ConvoxInstaller::Config do
50
68
  config.prompt_for_config
51
69
  expect(config.config).to eq(
52
70
  :stack_name => "convox-test",
53
- :aws_access_key_id => "sdfg",
54
71
  :aws_region => "us-north-12",
72
+ :aws_access_key_id => "sdfg",
55
73
  :aws_secret_access_key => "xkcd",
56
74
  :instance_type => "t3.medium",
57
75
  )
@@ -59,44 +77,44 @@ RSpec.describe ConvoxInstaller::Config do
59
77
  stripped_output = output.read.lines.map(&:rstrip).join("\n")
60
78
  expected_output = <<-EOS
61
79
  Please enter a name for your Convox installation |convox|
62
- Please enter your AWS Region: |us-east-1|
80
+ Please enter your AWS Region: |us-east-1| Please enter your EC2 Instance Type: |t3.medium|
63
81
  Admin AWS Credentials
64
82
  ============================================
65
83
 
66
- Please enter your AWS Access Key ID: Please enter your AWS Secret Access Key: Please enter your EC2 Instance Type: |t3.medium|
84
+ Please enter your AWS Access Key ID: Please enter your AWS Secret Access Key:
67
85
  ============================================
68
86
  SUMMARY
69
87
  ============================================
70
88
 
71
89
  Convox Stack Name: convox
72
- AWS Region: us-north-12
90
+ AWS Region: us-east-1
91
+ EC2 Instance Type: c5.xlarge
73
92
  AWS Access Key ID: asdf
74
93
  AWS Secret Access Key: xkcd
75
- EC2 Instance Type: t3.medium
76
94
 
77
- We've saved your configuration to: /Users/ndbroadbent/.convox/installer_config
95
+ We've saved your configuration to: /path/to/.installer_config
78
96
  If anything goes wrong during the installation, you can restart the script to reload the config and continue.
79
97
 
80
98
  Please double check all of these configuration details.
81
99
  Would you like to start the Convox installation? (press 'n' to correct any settings)
82
100
 
83
101
  Please enter a name for your Convox installation |convox|
84
- Please enter your AWS Region: |us-north-12|
102
+ Please enter your AWS Region: |us-east-1| Please enter your EC2 Instance Type: |c5.xlarge|
85
103
  Admin AWS Credentials
86
104
  ============================================
87
105
 
88
- Please enter your AWS Access Key ID: |asdf| Please enter your AWS Secret Access Key: |xkcd| Please enter your EC2 Instance Type: |t3.medium|
106
+ Please enter your AWS Access Key ID: |asdf| Please enter your AWS Secret Access Key: |xkcd|
89
107
  ============================================
90
108
  SUMMARY
91
109
  ============================================
92
110
 
93
111
  Convox Stack Name: convox-test
94
112
  AWS Region: us-north-12
113
+ EC2 Instance Type: t3.medium
95
114
  AWS Access Key ID: sdfg
96
115
  AWS Secret Access Key: xkcd
97
- EC2 Instance Type: t3.medium
98
116
 
99
- We've saved your configuration to: /Users/ndbroadbent/.convox/installer_config
117
+ We've saved your configuration to: /path/to/.installer_config
100
118
  If anything goes wrong during the installation, you can restart the script to reload the config and continue.
101
119
 
102
120
  Please double check all of these configuration details.
@@ -143,11 +161,22 @@ EOS
143
161
  },
144
162
  ]
145
163
 
146
- input << "\n\nasdf\nxkcd\n\nsdfg\nqwer\n\ny\n"
164
+ input_details = [
165
+ [:stack_name, ""],
166
+ [:aws_region, ""],
167
+ [:instance_type, "c5.xlarge"],
168
+ [:aws_access_key_id, "asdf"],
169
+ [:aws_secret_access_key, "xkcd"],
170
+ [:docker_registry_username, "bob"],
171
+ [:docker_registry_password, "password1"],
172
+ [:admin_email, "admin@test.com"],
173
+ [:confirm?, "y"],
174
+ ]
175
+ input << input_details.map(&:last).join("\n") << "\n"
147
176
  input.rewind
148
177
 
149
178
  config = described_class.new(highline: highline, prompts: custom_prompts)
150
- expect(config).to receive(:save_config_to_file).exactly(8).times
179
+ expect(config).to receive(:save_config_to_file).exactly(9).times
151
180
  expect(SecureRandom).to receive(:hex).with(8).and_return("99a6f67de0c7a117")
152
181
 
153
182
  expect(config.config).to eq({})
@@ -159,21 +188,21 @@ EOS
159
188
  :aws_region => "us-east-1",
160
189
  :aws_access_key_id => "asdf",
161
190
  :aws_secret_access_key => "xkcd",
162
- :instance_type => "t3.medium",
163
- :docker_registry_username => "sdfg",
164
- :docker_registry_password => "qwer",
165
- :admin_email => "admin@example.com",
191
+ :instance_type => "c5.xlarge",
192
+ :docker_registry_username => "bob",
193
+ :docker_registry_password => "password1",
194
+ :admin_email => "admin@test.com",
166
195
  :admin_password => "99a6f67de0c7a117",
167
196
  )
168
197
  output.rewind
169
198
  stripped_output = output.read.lines.map(&:rstrip).join("\n")
170
199
  expected_output = <<-EOS
171
200
  Please enter a name for your Convox installation |convox|
172
- Please enter your AWS Region: |us-east-1|
201
+ Please enter your AWS Region: |us-east-1| Please enter your EC2 Instance Type: |t3.medium|
173
202
  Admin AWS Credentials
174
203
  ============================================
175
204
 
176
- Please enter your AWS Access Key ID: Please enter your AWS Secret Access Key: Please enter your EC2 Instance Type: |t3.medium|
205
+ Please enter your AWS Access Key ID: Please enter your AWS Secret Access Key:
177
206
  ECR Authentication
178
207
  ============================================
179
208
 
@@ -185,15 +214,15 @@ Please enter your Docker Registry Access Key ID: Please enter your Docker Regist
185
214
 
186
215
  Convox Stack Name: convox
187
216
  AWS Region: us-east-1
217
+ EC2 Instance Type: c5.xlarge
188
218
  AWS Access Key ID: asdf
189
219
  AWS Secret Access Key: xkcd
190
- EC2 Instance Type: t3.medium
191
- Docker Registry Access Key ID: sdfg
192
- Docker Registry Secret Access Key: qwer
193
- Admin Email: admin@example.com
220
+ Docker Registry Access Key ID: bob
221
+ Docker Registry Secret Access Key: password1
222
+ Admin Email: admin@test.com
194
223
  Admin Password: 99a6f67de0c7a117
195
224
 
196
- We've saved your configuration to: /Users/ndbroadbent/.convox/installer_config
225
+ We've saved your configuration to: /path/to/.installer_config
197
226
  If anything goes wrong during the installation, you can restart the script to reload the config and continue.
198
227
 
199
228
  Please double check all of these configuration details.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convox_installer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Form Applications Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -113,7 +113,7 @@ homepage: https://github.com/FormAPI/convox_installer
113
113
  licenses:
114
114
  - MIT
115
115
  metadata: {}
116
- post_install_message:
116
+ post_install_message:
117
117
  rdoc_options: []
118
118
  require_paths:
119
119
  - lib
@@ -128,9 +128,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  requirements: []
131
- rubyforge_project:
132
- rubygems_version: 2.7.8
133
- signing_key:
131
+ rubygems_version: 3.1.2
132
+ signing_key:
134
133
  specification_version: 4
135
134
  summary: Build a Convox installation workflow
136
135
  test_files: