convox_installer 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +274 -7
- data/examples/full_installation.rb +3 -3
- data/lib/convox/client.rb +5 -1
- data/lib/convox_installer.rb +2 -2
- data/lib/convox_installer/version.rb +1 -1
- data/spec/lib/convox/client_spec.rb +2 -2
- data/spec/lib/convox_installer/config_spec.rb +46 -21
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d892f211775c729520e50a17e48b4f086125d468e80928c702f82e9f933552a8
|
4
|
+
data.tar.gz: 90464c717b7ec52844b5f61a236a2b0b41c14f13c76907cb3773bde012d818bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f713ae774ad544fb8e461108f0347086d81ac53f785d198fec22ac8dd90b8f809d67a4f53f9d40b9cdf2e085273c1ea96ccd036bd5df6b560dc46b2ba2cc2416
|
7
|
+
data.tar.gz: 70cc688ec5e59059663f879e024b72c69751519f430d1013d2a13361cca8b8ffb7e4471d55aa930f5aafa61a7205617fa7a6a10625b0cb78ef9bcdb835f38a6e
|
data/README.md
CHANGED
@@ -1,23 +1,290 @@
|
|
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
|
-
|
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
|
+
```
|
43
|
+
|
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.
|
10
45
|
|
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
|
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`).
|
12
47
|
|
13
|
-
You can see
|
14
|
-
(This Ruby file uses `bundler/inline`, so it will download and install the `convox_installer` gem before running the script.)
|
48
|
+
You can see a complete example in [`examples/full_installation.rb`](./examples/full_installation.rb).
|
15
49
|
|
16
|
-
|
50
|
+
|
51
|
+
## Config
|
17
52
|
|
18
53
|
Config is loaded from ENV vars, or from saved JSON data at
|
19
|
-
`~/.convox/installer_config`.
|
54
|
+
`~/.convox/installer_config`. The script will save all of the user's responses into `~/.convox/installer_config`.
|
55
|
+
|
56
|
+
## Customize the Config Prompts
|
57
|
+
|
58
|
+
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:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
@prompts = ConvoxInstaller::Config::DEFAULT_PROMPTS + [
|
62
|
+
{
|
63
|
+
section: "Docker Authentication",
|
64
|
+
info: "You should have received authentication details for the Docker Registry\n" \
|
65
|
+
"via email. If not, please contact support@example.com",
|
66
|
+
},
|
67
|
+
{
|
68
|
+
key: :docker_registry_url,
|
69
|
+
title: "Docker Registry URL",
|
70
|
+
value: "1234567890.dkr.ecr.us-east-1.amazonaws.com",
|
71
|
+
},
|
72
|
+
{
|
73
|
+
key: :docker_registry_username,
|
74
|
+
title: "Docker Registry Username",
|
75
|
+
},
|
76
|
+
{
|
77
|
+
key: :docker_registry_password,
|
78
|
+
title: "Docker Registry Password",
|
79
|
+
}
|
80
|
+
]
|
81
|
+
```
|
82
|
+
|
83
|
+
## Prompt API:
|
84
|
+
|
85
|
+
The `@prompts` variable must be an array of hashes. There are two kinds of hashes:
|
86
|
+
|
87
|
+
#### Section Heading
|
88
|
+
|
89
|
+
Shows a heading and optional details.
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
{
|
93
|
+
section: "The heading for this config section",
|
94
|
+
info: "Description about this config section"
|
95
|
+
}
|
96
|
+
```
|
97
|
+
|
98
|
+
#### Config Prompt
|
99
|
+
|
100
|
+
* A config prompt with a default value:
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
{
|
104
|
+
key: :config_key_name,
|
105
|
+
title: "Title to show in the user prompt / config summary",
|
106
|
+
prompt: "Question to show the user",
|
107
|
+
default: "default value",
|
108
|
+
}
|
109
|
+
```
|
110
|
+
|
111
|
+
* Set a value from a `Proc`, and don't prompt the user:
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
{
|
115
|
+
key: :config_key_name,
|
116
|
+
title: "Title to show in the config summary",
|
117
|
+
value: -> () { "string-with-random-suffix-#{SecureRandom.hex(4)}" },
|
118
|
+
}
|
119
|
+
```
|
120
|
+
|
121
|
+
* Set a value, and hide this setting from the user (even in the summary):
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
{
|
125
|
+
key: :config_key_name,
|
126
|
+
value: "Config Value",
|
127
|
+
hidden: true,
|
128
|
+
},
|
129
|
+
```
|
130
|
+
|
131
|
+
|
132
|
+
## `ConvoxInstaller` DSL
|
133
|
+
|
134
|
+
#### `ensure_requirements!`
|
135
|
+
|
136
|
+
Makes sure that the `convox` and `aws` CLI tools are installed on this system. If not, shows installation instructions and exits.
|
137
|
+
|
138
|
+
#### `prompt_for_config`
|
139
|
+
|
140
|
+
Loads config from ENV vars, or from saved config at `~/.convox/installer_config`.
|
141
|
+
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.
|
142
|
+
|
143
|
+
#### `backup_convox_host_and_rack`
|
144
|
+
|
145
|
+
If there are any existing files at `~/.convox/host` or `~/.convox/rack`, this method moves these to `~/.convox/host.bak` and `~/.convox/rack.bak`.
|
146
|
+
|
147
|
+
#### `install_convox`
|
148
|
+
|
149
|
+
* **Required Config:** `aws_region`, `aws_access_key_id`, `aws_secret_access_key`,
|
150
|
+
`stack_name`, `instance_type`
|
151
|
+
|
152
|
+
Runs `convox rack install ...`. Has some validations to ensure that all required settings are present.
|
153
|
+
|
154
|
+
#### `validate_convox_auth_and_set_host!`
|
155
|
+
|
156
|
+
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.)
|
157
|
+
|
158
|
+
#### `validate_convox_rack!`
|
159
|
+
|
160
|
+
Calls `convox api get /system` to get the Rack details, then makes sure that everything is correct.
|
161
|
+
|
162
|
+
#### `convox_rack_data`
|
163
|
+
|
164
|
+
Returns a Ruby hash with all convox rack data.
|
165
|
+
|
166
|
+
#### `create_convox_app!`
|
167
|
+
|
168
|
+
* **Required Config:** `convox_app_name`
|
169
|
+
|
170
|
+
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.)
|
171
|
+
|
172
|
+
|
173
|
+
#### `set_default_app_for_directory!`
|
174
|
+
|
175
|
+
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.
|
176
|
+
|
177
|
+
|
178
|
+
#### `create_s3_bucket!`
|
179
|
+
|
180
|
+
* **Required Config:** `s3_bucket_name`
|
181
|
+
|
182
|
+
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`:
|
183
|
+
|
184
|
+
```ruby
|
185
|
+
{
|
186
|
+
key: :s3_bucket_name,
|
187
|
+
title: "S3 Bucket for uploads",
|
188
|
+
value: -> () { "yourapp-uploads-#{SecureRandom.hex(4)}" },
|
189
|
+
}
|
190
|
+
```
|
191
|
+
|
192
|
+
The `:value` `Proc` will generate a bucket name with a random suffix. (Avoids conflicts when you are setting up multiple deployments for your app.)
|
193
|
+
|
194
|
+
`create_s3_bucket!` will also call `set_s3_bucket_cors_policy` automatically, so you don't need to call this manually.
|
195
|
+
|
196
|
+
#### `set_s3_bucket_cors_policy`
|
197
|
+
|
198
|
+
* **Required Config:** `s3_bucket_name`
|
199
|
+
|
200
|
+
Set up a CORS policy for your S3 bucket. (`:s3_bucket_name`)
|
201
|
+
|
202
|
+
*Note: If the `:s3_bucket_cors_policy` setting is not provided, then this method does nothing.*
|
203
|
+
|
204
|
+
You should set `:s3_bucket_cors_policy` to a JSON string. Here's how I set this up in my own `install.rb` script:
|
205
|
+
|
206
|
+
```ruby
|
207
|
+
S3_BUCKET_CORS_POLICY = <<-JSON
|
208
|
+
{
|
209
|
+
"CORSRules": [
|
210
|
+
{
|
211
|
+
"AllowedOrigins": ["*"],
|
212
|
+
"AllowedHeaders": ["Authorization", "cache-control", "x-requested-with"],
|
213
|
+
"AllowedMethods": ["PUT", "POST", "GET"],
|
214
|
+
"MaxAgeSeconds": 3000
|
215
|
+
}
|
216
|
+
]
|
217
|
+
}
|
218
|
+
JSON
|
219
|
+
|
220
|
+
@prompts = [
|
221
|
+
{
|
222
|
+
key: :s3_bucket_cors_policy,
|
223
|
+
value: S3_BUCKET_CORS_POLICY,
|
224
|
+
hidden: true,
|
225
|
+
}
|
226
|
+
]
|
227
|
+
```
|
228
|
+
|
229
|
+
|
230
|
+
#### `s3_bucket_details`
|
231
|
+
|
232
|
+
* **Required Config:** `s3_bucket_name`
|
233
|
+
|
234
|
+
Get the S3 bucket details for `s3_bucket_name`. Parses the URL and returns a hash:
|
235
|
+
|
236
|
+
```ruby
|
237
|
+
{
|
238
|
+
access_key_id: "AWS Access Key ID",
|
239
|
+
secret_access_key: "AWS Secret Access Key",
|
240
|
+
name: "Full S3 Bucket Name (includes the rack/app)",
|
241
|
+
}
|
242
|
+
```
|
243
|
+
|
244
|
+
I use these S3 bucket details to set env variables for my app. (`convox env set ...`)
|
245
|
+
|
246
|
+
|
247
|
+
#### `add_docker_registry!`
|
248
|
+
|
249
|
+
* **Required Config:** `docker_registry_url`, `docker_registry_username`, `docker_registry_password`
|
250
|
+
|
251
|
+
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).
|
252
|
+
|
253
|
+
#### `default_service_domain_name`
|
254
|
+
|
255
|
+
* **Required Config:** `convox_app_name`, `default_service`
|
256
|
+
|
257
|
+
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.)
|
258
|
+
|
259
|
+
Example: `myapp-web.rackname-Route-ABCDFE123456-123456789.us-west-2.convox.site`
|
260
|
+
|
261
|
+
Set a default service in your config prompts (e.g. `web`):
|
262
|
+
|
263
|
+
```ruby
|
264
|
+
@prompts = [
|
265
|
+
# ...
|
266
|
+
{
|
267
|
+
key: :default_service,
|
268
|
+
title: "Default Convox Service (for domain)",
|
269
|
+
value: "web",
|
270
|
+
hidden: true,
|
271
|
+
}
|
272
|
+
]
|
273
|
+
```
|
274
|
+
|
275
|
+
> (This hidden setting isn't visible to the user.)
|
276
|
+
|
277
|
+
#### `run_convox_command!(cmd)`
|
278
|
+
|
279
|
+
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.
|
280
|
+
|
281
|
+
If you want to run `convox env set MYVAR=value`, then you would call:
|
282
|
+
|
283
|
+
```ruby
|
284
|
+
run_convox_command! 'env set MYVAR=value'
|
285
|
+
```
|
286
|
+
|
20
287
|
|
21
|
-
|
288
|
+
## License
|
22
289
|
|
23
290
|
[MIT](./LICENSE)
|
@@ -35,7 +35,7 @@ JSON
|
|
35
35
|
|
36
36
|
@prompts = ConvoxInstaller::Config::DEFAULT_PROMPTS + [
|
37
37
|
{
|
38
|
-
section: "
|
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" =>
|
118
|
-
"AWS_ACCESS_KEY_SECRET" =>
|
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
@@ -390,7 +390,11 @@ module Convox
|
|
390
390
|
def load_auth_from_file
|
391
391
|
return {} unless File.exist?(AUTH_FILE)
|
392
392
|
|
393
|
-
|
393
|
+
begin
|
394
|
+
JSON.parse(File.read(AUTH_FILE))
|
395
|
+
rescue
|
396
|
+
{}
|
397
|
+
end
|
394
398
|
end
|
395
399
|
|
396
400
|
def require_config(required_keys)
|
data/lib/convox_installer.rb
CHANGED
@@ -34,13 +34,13 @@ 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
|
-
|
43
|
+
add_docker_registry!
|
44
44
|
default_service_domain_name
|
45
45
|
run_convox_command!
|
46
46
|
].each do |method|
|
@@ -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: "
|
43
|
-
expect { client.install_convox }.to raise_error("
|
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
|
@@ -40,7 +40,21 @@ RSpec.describe ConvoxInstaller::Config do
|
|
40
40
|
output = StringIO.new
|
41
41
|
highline = HighLine.new(input, output)
|
42
42
|
|
43
|
-
|
43
|
+
input_details = [
|
44
|
+
[:stack_name, ""],
|
45
|
+
[:aws_region, ""],
|
46
|
+
[:instance_type, "c5.xlarge"],
|
47
|
+
[:aws_access_key_id, "asdf"],
|
48
|
+
[:aws_secret_access_key, "xkcd"],
|
49
|
+
[:confirm?, "n"],
|
50
|
+
[:stack_name, "convox-test"],
|
51
|
+
[:aws_region, "us-north-12"],
|
52
|
+
[:instance_type, "t3.medium"],
|
53
|
+
[:aws_access_key_id, "sdfg"],
|
54
|
+
[:aws_secret_access_key, ""],
|
55
|
+
[:confirm?, "y"],
|
56
|
+
]
|
57
|
+
input << input_details.map(&:last).join("\n") << "\n"
|
44
58
|
input.rewind
|
45
59
|
|
46
60
|
config = described_class.new(highline: highline)
|
@@ -50,8 +64,8 @@ RSpec.describe ConvoxInstaller::Config do
|
|
50
64
|
config.prompt_for_config
|
51
65
|
expect(config.config).to eq(
|
52
66
|
:stack_name => "convox-test",
|
53
|
-
:aws_access_key_id => "sdfg",
|
54
67
|
:aws_region => "us-north-12",
|
68
|
+
:aws_access_key_id => "sdfg",
|
55
69
|
:aws_secret_access_key => "xkcd",
|
56
70
|
:instance_type => "t3.medium",
|
57
71
|
)
|
@@ -59,20 +73,20 @@ RSpec.describe ConvoxInstaller::Config do
|
|
59
73
|
stripped_output = output.read.lines.map(&:rstrip).join("\n")
|
60
74
|
expected_output = <<-EOS
|
61
75
|
Please enter a name for your Convox installation |convox|
|
62
|
-
Please enter your AWS Region: |us-east-1|
|
76
|
+
Please enter your AWS Region: |us-east-1| Please enter your EC2 Instance Type: |t3.medium|
|
63
77
|
Admin AWS Credentials
|
64
78
|
============================================
|
65
79
|
|
66
|
-
Please enter your AWS Access Key ID: Please enter your AWS Secret Access Key:
|
80
|
+
Please enter your AWS Access Key ID: Please enter your AWS Secret Access Key:
|
67
81
|
============================================
|
68
82
|
SUMMARY
|
69
83
|
============================================
|
70
84
|
|
71
85
|
Convox Stack Name: convox
|
72
|
-
AWS Region: us-
|
86
|
+
AWS Region: us-east-1
|
87
|
+
EC2 Instance Type: c5.xlarge
|
73
88
|
AWS Access Key ID: asdf
|
74
89
|
AWS Secret Access Key: xkcd
|
75
|
-
EC2 Instance Type: t3.medium
|
76
90
|
|
77
91
|
We've saved your configuration to: /Users/ndbroadbent/.convox/installer_config
|
78
92
|
If anything goes wrong during the installation, you can restart the script to reload the config and continue.
|
@@ -81,20 +95,20 @@ Please double check all of these configuration details.
|
|
81
95
|
Would you like to start the Convox installation? (press 'n' to correct any settings)
|
82
96
|
|
83
97
|
Please enter a name for your Convox installation |convox|
|
84
|
-
Please enter your AWS Region: |us-
|
98
|
+
Please enter your AWS Region: |us-east-1| Please enter your EC2 Instance Type: |c5.xlarge|
|
85
99
|
Admin AWS Credentials
|
86
100
|
============================================
|
87
101
|
|
88
|
-
Please enter your AWS Access Key ID: |asdf| Please enter your AWS Secret Access Key: |xkcd|
|
102
|
+
Please enter your AWS Access Key ID: |asdf| Please enter your AWS Secret Access Key: |xkcd|
|
89
103
|
============================================
|
90
104
|
SUMMARY
|
91
105
|
============================================
|
92
106
|
|
93
107
|
Convox Stack Name: convox-test
|
94
108
|
AWS Region: us-north-12
|
109
|
+
EC2 Instance Type: t3.medium
|
95
110
|
AWS Access Key ID: sdfg
|
96
111
|
AWS Secret Access Key: xkcd
|
97
|
-
EC2 Instance Type: t3.medium
|
98
112
|
|
99
113
|
We've saved your configuration to: /Users/ndbroadbent/.convox/installer_config
|
100
114
|
If anything goes wrong during the installation, you can restart the script to reload the config and continue.
|
@@ -143,11 +157,22 @@ EOS
|
|
143
157
|
},
|
144
158
|
]
|
145
159
|
|
146
|
-
|
160
|
+
input_details = [
|
161
|
+
[:stack_name, ""],
|
162
|
+
[:aws_region, ""],
|
163
|
+
[:instance_type, "c5.xlarge"],
|
164
|
+
[:aws_access_key_id, "asdf"],
|
165
|
+
[:aws_secret_access_key, "xkcd"],
|
166
|
+
[:docker_registry_username, "bob"],
|
167
|
+
[:docker_registry_password, "password1"],
|
168
|
+
[:admin_email, "admin@test.com"],
|
169
|
+
[:confirm?, "y"],
|
170
|
+
]
|
171
|
+
input << input_details.map(&:last).join("\n") << "\n"
|
147
172
|
input.rewind
|
148
173
|
|
149
174
|
config = described_class.new(highline: highline, prompts: custom_prompts)
|
150
|
-
expect(config).to receive(:save_config_to_file).exactly(
|
175
|
+
expect(config).to receive(:save_config_to_file).exactly(9).times
|
151
176
|
expect(SecureRandom).to receive(:hex).with(8).and_return("99a6f67de0c7a117")
|
152
177
|
|
153
178
|
expect(config.config).to eq({})
|
@@ -159,21 +184,21 @@ EOS
|
|
159
184
|
:aws_region => "us-east-1",
|
160
185
|
:aws_access_key_id => "asdf",
|
161
186
|
:aws_secret_access_key => "xkcd",
|
162
|
-
:instance_type => "
|
163
|
-
:docker_registry_username => "
|
164
|
-
:docker_registry_password => "
|
165
|
-
:admin_email => "admin@
|
187
|
+
:instance_type => "c5.xlarge",
|
188
|
+
:docker_registry_username => "bob",
|
189
|
+
:docker_registry_password => "password1",
|
190
|
+
:admin_email => "admin@test.com",
|
166
191
|
:admin_password => "99a6f67de0c7a117",
|
167
192
|
)
|
168
193
|
output.rewind
|
169
194
|
stripped_output = output.read.lines.map(&:rstrip).join("\n")
|
170
195
|
expected_output = <<-EOS
|
171
196
|
Please enter a name for your Convox installation |convox|
|
172
|
-
Please enter your AWS Region: |us-east-1|
|
197
|
+
Please enter your AWS Region: |us-east-1| Please enter your EC2 Instance Type: |t3.medium|
|
173
198
|
Admin AWS Credentials
|
174
199
|
============================================
|
175
200
|
|
176
|
-
Please enter your AWS Access Key ID: Please enter your AWS Secret Access Key:
|
201
|
+
Please enter your AWS Access Key ID: Please enter your AWS Secret Access Key:
|
177
202
|
ECR Authentication
|
178
203
|
============================================
|
179
204
|
|
@@ -185,12 +210,12 @@ Please enter your Docker Registry Access Key ID: Please enter your Docker Regist
|
|
185
210
|
|
186
211
|
Convox Stack Name: convox
|
187
212
|
AWS Region: us-east-1
|
213
|
+
EC2 Instance Type: c5.xlarge
|
188
214
|
AWS Access Key ID: asdf
|
189
215
|
AWS Secret Access Key: xkcd
|
190
|
-
|
191
|
-
Docker Registry Access Key
|
192
|
-
|
193
|
-
Admin Email: admin@example.com
|
216
|
+
Docker Registry Access Key ID: bob
|
217
|
+
Docker Registry Secret Access Key: password1
|
218
|
+
Admin Email: admin@test.com
|
194
219
|
Admin Password: 99a6f67de0c7a117
|
195
220
|
|
196
221
|
We've saved your configuration to: /Users/ndbroadbent/.convox/installer_config
|
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.
|
4
|
+
version: 1.0.2
|
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:
|
11
|
+
date: 2021-02-22 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
|
-
|
132
|
-
|
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:
|