forger 1.6.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile +0 -2
- data/Gemfile.lock +30 -38
- data/README.md +49 -53
- data/docs/example/app/{user-data → user_data}/bootstrap.sh +0 -0
- data/forger.gemspec +1 -1
- data/lib/forger.rb +16 -12
- data/lib/forger/cli.rb +10 -4
- data/lib/forger/core.rb +8 -0
- data/lib/forger/create.rb +3 -1
- data/lib/forger/create/error_messages.rb +2 -2
- data/lib/forger/create/info.rb +18 -3
- data/lib/forger/create/waiter.rb +20 -4
- data/lib/forger/help/compile.md +1 -1
- data/lib/forger/help/create.md +6 -0
- data/lib/forger/help/new.md +33 -0
- data/lib/forger/help/upload.md +1 -1
- data/lib/forger/hook.rb +1 -1
- data/lib/forger/network.rb +48 -0
- data/lib/forger/new.rb +75 -0
- data/lib/forger/script.rb +1 -1
- data/lib/forger/script/compress.rb +1 -1
- data/lib/forger/script/templates/extract_forger_scripts.sh +20 -0
- data/lib/forger/script/upload.rb +15 -1
- data/lib/forger/scripts/auto_terminate/functions.sh +2 -1
- data/lib/forger/scripts/auto_terminate/functions/{amazonlinux2.sh → amzn.sh} +0 -0
- data/lib/forger/scripts/auto_terminate/functions/amzn2.sh +10 -0
- data/lib/forger/scripts/cloudwatch/install/{amazonlinux2.sh → amzn.sh} +0 -0
- data/lib/forger/scripts/cloudwatch/install/amzn2.sh +4 -0
- data/lib/forger/scripts/cloudwatch/service/amzn.sh +16 -0
- data/lib/forger/scripts/cloudwatch/service/{amazonlinux2.sh → amzn2.sh} +0 -0
- data/lib/forger/scripts/shared/functions.sh +1 -1
- data/lib/forger/sequence.rb +25 -0
- data/lib/forger/template/helper/core_helper.rb +21 -12
- data/lib/forger/template/helper/script_helper.rb +1 -1
- data/lib/forger/version.rb +1 -1
- data/lib/templates/default/.env.example +1 -0
- data/lib/templates/default/.gitignore +2 -0
- data/lib/templates/default/Gemfile +3 -0
- data/lib/templates/default/README.md +61 -0
- data/lib/templates/default/app/helpers/application_helper.rb +12 -0
- data/lib/templates/default/app/scripts/install/common.sh +14 -0
- data/lib/templates/default/app/scripts/personalize/tung.sh +3 -0
- data/lib/templates/default/app/scripts/shared/functions.sh +22 -0
- data/lib/templates/default/app/user_data/bootstrap.sh.tt +12 -0
- data/lib/templates/default/app/user_data/layouts/default.sh.tt +17 -0
- data/lib/templates/default/config/development.yml.tt +6 -0
- data/lib/templates/default/config/settings.yml.tt +25 -0
- data/lib/templates/default/profiles/default.yml.tt +41 -0
- data/spec/fixtures/demo_project/app/{user-data → user_data}/bootstrap.sh +0 -0
- data/spec/lib/core_helper_spec.rb +19 -0
- data/spec/spec_helper.rb +0 -4
- metadata +34 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40903820dcf27929a6a4772f175612f8ef7090cfba6335134c181609397e2d46
|
4
|
+
data.tar.gz: 7f25db5d64cb8fd19acfe6f420fb4cfb9122395f8628d3bd39de14552e8daa46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ca21504ea5bd44e8f290cb857f81bac99c0d2dfb84486f5bff456916c8f9f12b4292052ba2b99afafe134ce57222263f2332733ecfb7970b6e75df4ce590753
|
7
|
+
data.tar.gz: f3d5fb6bb654c89d50f2ec2510c119f3ae5a1b6b46a4923cf066ed248806236d30200795d8f8013be8b4c56abc2035e097990c2da83794cb14d4e93495e13f3b
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,23 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [2.0.0]
|
7
|
+
- Merge pull request #11 and #12 from tongueroo/new:
|
8
|
+
- forger new: creates a starter project that works right off the bat
|
9
|
+
- Merge pull request #10 from tongueroo/waiter:
|
10
|
+
- New abilities: forger destroy, forger create --ssh, forger create --wait
|
11
|
+
- Bug fixes and improvements:
|
12
|
+
- add key-name option, fix auto terminate for on-demand instances
|
13
|
+
- add spot option in default profile
|
14
|
+
- allow cloudwatch option to be saved in settings
|
15
|
+
- all user-data scripts to be under subfolders
|
16
|
+
- change cloudwatch log group name to forger
|
17
|
+
- detect os by ID in os-release
|
18
|
+
- fix case when s3_folder only has bucket name
|
19
|
+
- improve ssh waiting and add spot max monthly price estimate
|
20
|
+
- install wget and tar when needed for extract_forger_scripts helper
|
21
|
+
- forger create: wait for instance to be ready and provide dns and ssh command by default
|
22
|
+
|
6
23
|
## [1.6.0]
|
7
24
|
- Merge pull request #10 from tongueroo/waiter
|
8
25
|
- forger destroy command
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
forger (
|
4
|
+
forger (2.0.0)
|
5
5
|
activesupport
|
6
6
|
aws-sdk-ec2
|
7
7
|
aws-sdk-s3
|
@@ -16,38 +16,37 @@ PATH
|
|
16
16
|
GEM
|
17
17
|
remote: https://rubygems.org/
|
18
18
|
specs:
|
19
|
-
activesupport (5.2.
|
19
|
+
activesupport (5.2.1)
|
20
20
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
21
|
i18n (>= 0.7, < 2)
|
22
22
|
minitest (~> 5.1)
|
23
23
|
tzinfo (~> 1.1)
|
24
|
-
aws-
|
25
|
-
aws-
|
24
|
+
aws-eventstream (1.0.1)
|
25
|
+
aws-partitions (1.105.0)
|
26
|
+
aws-sdk-core (3.30.0)
|
27
|
+
aws-eventstream (~> 1.0)
|
26
28
|
aws-partitions (~> 1.0)
|
27
29
|
aws-sigv4 (~> 1.0)
|
28
30
|
jmespath (~> 1.0)
|
29
|
-
aws-sdk-ec2 (1.
|
30
|
-
aws-sdk-core (~> 3)
|
31
|
+
aws-sdk-ec2 (1.50.0)
|
32
|
+
aws-sdk-core (~> 3, >= 3.26.0)
|
31
33
|
aws-sigv4 (~> 1.0)
|
32
|
-
aws-sdk-kms (1.
|
33
|
-
aws-sdk-core (~> 3)
|
34
|
+
aws-sdk-kms (1.9.0)
|
35
|
+
aws-sdk-core (~> 3, >= 3.26.0)
|
34
36
|
aws-sigv4 (~> 1.0)
|
35
|
-
aws-sdk-s3 (1.
|
36
|
-
aws-sdk-core (~> 3)
|
37
|
+
aws-sdk-s3 (1.21.0)
|
38
|
+
aws-sdk-core (~> 3, >= 3.26.0)
|
37
39
|
aws-sdk-kms (~> 1)
|
38
40
|
aws-sigv4 (~> 1.0)
|
39
|
-
aws-sigv4 (1.0.
|
41
|
+
aws-sigv4 (1.0.3)
|
40
42
|
byebug (10.0.2)
|
41
|
-
codeclimate-test-reporter (1.0.8)
|
42
|
-
simplecov (<= 0.13)
|
43
43
|
coderay (1.1.2)
|
44
44
|
colorize (0.8.1)
|
45
45
|
concurrent-ruby (1.0.5)
|
46
46
|
diff-lcs (1.3)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
filesize (0.1.1)
|
47
|
+
dotenv (2.5.0)
|
48
|
+
ffi (1.9.25)
|
49
|
+
filesize (0.2.0)
|
51
50
|
formatador (0.2.5)
|
52
51
|
guard (2.14.2)
|
53
52
|
formatador (>= 0.2.4)
|
@@ -67,11 +66,10 @@ GEM
|
|
67
66
|
guard (~> 2.1)
|
68
67
|
guard-compat (~> 1.1)
|
69
68
|
rspec (>= 2.99.0, < 4.0)
|
70
|
-
hashie (3.
|
71
|
-
i18n (1.0
|
69
|
+
hashie (3.6.0)
|
70
|
+
i18n (1.1.0)
|
72
71
|
concurrent-ruby (~> 1.0)
|
73
72
|
jmespath (1.4.0)
|
74
|
-
json (2.1.0)
|
75
73
|
listen (3.1.5)
|
76
74
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
77
75
|
rb-inotify (~> 0.9, >= 0.9.7)
|
@@ -95,26 +93,21 @@ GEM
|
|
95
93
|
activesupport
|
96
94
|
colorize
|
97
95
|
tilt
|
98
|
-
rspec (3.
|
99
|
-
rspec-core (~> 3.
|
100
|
-
rspec-expectations (~> 3.
|
101
|
-
rspec-mocks (~> 3.
|
102
|
-
rspec-core (3.
|
103
|
-
rspec-support (~> 3.
|
104
|
-
rspec-expectations (3.
|
96
|
+
rspec (3.8.0)
|
97
|
+
rspec-core (~> 3.8.0)
|
98
|
+
rspec-expectations (~> 3.8.0)
|
99
|
+
rspec-mocks (~> 3.8.0)
|
100
|
+
rspec-core (3.8.0)
|
101
|
+
rspec-support (~> 3.8.0)
|
102
|
+
rspec-expectations (3.8.1)
|
105
103
|
diff-lcs (>= 1.2.0, < 2.0)
|
106
|
-
rspec-support (~> 3.
|
107
|
-
rspec-mocks (3.
|
104
|
+
rspec-support (~> 3.8.0)
|
105
|
+
rspec-mocks (3.8.0)
|
108
106
|
diff-lcs (>= 1.2.0, < 2.0)
|
109
|
-
rspec-support (~> 3.
|
110
|
-
rspec-support (3.
|
107
|
+
rspec-support (~> 3.8.0)
|
108
|
+
rspec-support (3.8.0)
|
111
109
|
ruby_dep (1.5.0)
|
112
110
|
shellany (0.0.1)
|
113
|
-
simplecov (0.13.0)
|
114
|
-
docile (~> 1.1.0)
|
115
|
-
json (>= 1.8, < 3)
|
116
|
-
simplecov-html (~> 0.10.0)
|
117
|
-
simplecov-html (0.10.2)
|
118
111
|
thor (0.20.0)
|
119
112
|
thread_safe (0.3.6)
|
120
113
|
tilt (2.0.8)
|
@@ -127,7 +120,6 @@ PLATFORMS
|
|
127
120
|
DEPENDENCIES
|
128
121
|
bundler
|
129
122
|
byebug
|
130
|
-
codeclimate-test-reporter
|
131
123
|
forger!
|
132
124
|
guard
|
133
125
|
guard-bundler
|
@@ -135,4 +127,4 @@ DEPENDENCIES
|
|
135
127
|
rake
|
136
128
|
|
137
129
|
BUNDLED WITH
|
138
|
-
1.16.
|
130
|
+
1.16.3
|
data/README.md
CHANGED
@@ -8,55 +8,63 @@ Example:
|
|
8
8
|
* profiles/default.yml: Default settings. Used when no profile is specified.
|
9
9
|
* profiles/myserver.yml: myserver profile. Used when `--profile myserver` is specified.
|
10
10
|
|
11
|
-
##
|
11
|
+
## How It Works
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
In a nutshell, the profile parameters are passed to the ruby aws-sdk [AWS::EC2::Client#run_instances](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/EC2/Client.html#run_instances-instance_method) method. This allows you to specify any parameter you wish that is available in the aws-sdk. To check out what a profile looks like check out [example default profile](docs/example/profiles/default.yml).
|
14
|
+
|
15
|
+
## Usage: Quick Start
|
16
|
+
|
17
|
+
forger new ec2 # generates starter skeleton project
|
18
|
+
cd ec2
|
19
|
+
forger create myserver # creates instance
|
20
|
+
|
21
|
+
## Useful new options
|
22
|
+
|
23
|
+
By default, `forger new` generates a project with some starting values for the files in the `config` and `profiles` folders. You likely want to edit these values using your own values. Things like security groups, subnets, iam role, and the s3_folder option are useful settings to modify. You can also specify a lot of these values as a part of the `new` command. Example:
|
24
|
+
|
25
|
+
forger new ec2 --security-group sg-11223344 --iam MyIamRole --key-name my-keypair --s3-folder my-bucket/my-folder
|
26
|
+
|
27
|
+
Notably, using the `--s3-folder` option generates a project that make use of the `app/scripts` files and inserts some bash code into your user-data script that downloads and extracts the files. For more help:
|
17
28
|
|
18
|
-
|
29
|
+
forger new -h
|
30
|
+
|
31
|
+
## Usage: More Details
|
32
|
+
|
33
|
+
forger create NAME --profile PROFILE
|
34
|
+
forger create myserver --profile myserver
|
19
35
|
|
20
36
|
## Noop mode
|
21
37
|
|
22
38
|
You can do a test run with the `--noop` flag. This will print out what settings will be used to launch the instance. This is one good way to inspect the generated user-data script.
|
23
39
|
|
24
|
-
|
25
|
-
|
26
|
-
cat tmp/user-data.txt # to view generated user-data script
|
27
|
-
```
|
40
|
+
forger create myserver --profile myserver --noop
|
41
|
+
cat tmp/user-data.txt # to view generated user-data script
|
28
42
|
|
29
43
|
## Conventional Profile Name
|
30
44
|
|
31
45
|
If there is a profile name that matches the ec2 specified instance name, you can omit the `--profile` flag. Example
|
32
46
|
|
33
|
-
|
34
|
-
forger create webserver
|
35
|
-
forger create webserver # same as above
|
36
|
-
```
|
47
|
+
forger create webserver --profile webserver
|
48
|
+
forger create webserver # same as above
|
37
49
|
|
38
50
|
It is useful to add a random string to the end of your server name, but not use it for the `--profile` flag. Example:
|
39
51
|
|
40
|
-
|
41
|
-
forger create myserver-
|
42
|
-
forger create myserver-123 --profile myserver
|
43
|
-
```
|
52
|
+
forger create myserver-abc --profile myserver
|
53
|
+
forger create myserver-123 --profile myserver
|
44
54
|
|
45
55
|
You can use the `--randomize` option to do this automatically:
|
46
56
|
|
47
|
-
|
48
|
-
forger create myserver --randomize
|
49
|
-
```
|
57
|
+
forger create myserver --randomize
|
50
58
|
|
51
59
|
## Project Structure
|
52
60
|
|
53
61
|
Directory | Description
|
54
62
|
------------- | -------------
|
55
|
-
app/helpers | Custom helpers methods. Define them as modules and their methods are made available whenever ERB is available: `profiles`, `app/scripts`, `app/
|
63
|
+
app/helpers | Custom helpers methods. Define them as modules and their methods are made available whenever ERB is available: `profiles`, `app/scripts`, `app/user_data` files, etc. For example, you would define a `module FooHelper` in `app/helpers/foo_helper.rb`.
|
56
64
|
app/partials | Your partials that can to be included in other scripts. This is used in conjunction with the `partial` helper method. With great power comes great responsibility. It is recommended to use partials sparely to keep scripts more straightforward.
|
57
65
|
app/scripts | Where you define common scripts that can be used to configure the server. These scripts can be automatically uploaded to an s3 bucket for later downloading in your user-data script by setting the `s3_folder` settings option.
|
58
|
-
app/
|
59
|
-
app/
|
66
|
+
app/user_data | Your user-data scripts that are used to bootstrap EC2 instance.
|
67
|
+
app/user_data/layouts | user-data scripts support layouts. You user-data layouts go in here.
|
60
68
|
config/[FORGER_ENV].yml | The config file where you set configs that you want available in your templating logic. Examples are: `config/development.yml` and `config/production.yml`. You access the config variables with the `<%= config["var"] %>` helper.
|
61
69
|
profiles | Your profile files. These files mainly contain parameters that are passed to the aws-sdk run_instances API method.
|
62
70
|
tmp | Where the generated scripts get compiled to. You can manually invoke the compilation via `forger compile` to inspect what is generated. This is automatically done as part of the `forger` create command.
|
@@ -79,33 +87,27 @@ You can also define custom helpers in the `app/helpers` folder as ruby modules w
|
|
79
87
|
|
80
88
|
## User-Data
|
81
89
|
|
82
|
-
You can provide a user-data script to customize the server upon launch. The user-data scripts are located under the `app/
|
90
|
+
You can provide a user-data script to customize the server upon launch. The user-data scripts are located under the `app/user_data` folder. Example:
|
83
91
|
|
84
|
-
* app/
|
92
|
+
* app/user_data/myserver.yml
|
85
93
|
|
86
94
|
The user-data script is generated on the machine that is running the forger command. If this is your local macosx machine, then the context of your local macosx machine is available. To see the generated user-data script, you can run the create command in `--noop` mode and then inspect the generated script. Example:
|
87
95
|
|
88
|
-
|
89
|
-
|
90
|
-
cat tmp/user-data.txt
|
91
|
-
```
|
96
|
+
forger create myserver --noop
|
97
|
+
cat tmp/user-data.txt
|
92
98
|
|
93
99
|
Another way to view the generated user-data scripts is the `forger compile` command. It generates the files in the `tmp` folder. Example:
|
94
100
|
|
95
|
-
|
96
|
-
forger compile # generates files in tmp folder
|
97
|
-
```
|
101
|
+
forger compile # generates files in tmp folder
|
98
102
|
|
99
103
|
To use the user-data script when creating an EC2 instance, use the `user_data` helper method in the profile file. Here's a grep of an example profile that uses the helper to show you want it looks like. Be sure to surround the ERB call with quotes because the user-data script context is base64 encoded.
|
100
104
|
|
101
|
-
|
102
|
-
|
103
|
-
user_data: "<%= user_data("bootstrap") %>"
|
104
|
-
```
|
105
|
+
$ grep user_data profiles/default.yml
|
106
|
+
user_data: "<%= user_data("bootstrap") %>"
|
105
107
|
|
106
108
|
### User-Data Layouts
|
107
109
|
|
108
|
-
User-data scripts support layouts. This is useful if you have common setup and finish code with your user-data scripts. Here's an example: `app/
|
110
|
+
User-data scripts support layouts. This is useful if you have common setup and finish code with your user-data scripts. Here's an example: `app/user_data/layouts/default.sh`:
|
109
111
|
|
110
112
|
```bash
|
111
113
|
#!/bin/bash
|
@@ -114,11 +116,9 @@ User-data scripts support layouts. This is useful if you have common setup and
|
|
114
116
|
# finish work
|
115
117
|
```
|
116
118
|
|
117
|
-
And `app/
|
119
|
+
And `app/user_data/box.sh`:
|
118
120
|
|
119
|
-
|
120
|
-
yum install -y vim
|
121
|
-
```
|
121
|
+
yum install -y vim
|
122
122
|
|
123
123
|
The resulting generated user-data script will be:
|
124
124
|
|
@@ -173,7 +173,7 @@ development:
|
|
173
173
|
# By setting s3_folder, forger will automatically tarball and upload your scripts
|
174
174
|
# to set. You then can then use the extract_scripts helper method to download
|
175
175
|
# the scripts onto the server.
|
176
|
-
s3_folder:
|
176
|
+
s3_folder: my-bucket/forger
|
177
177
|
# compile_clean: true # uncomment to clean at the end of a compile
|
178
178
|
# extract_scripts:
|
179
179
|
# to: "/opt"
|
@@ -186,7 +186,7 @@ production:
|
|
186
186
|
|
187
187
|
There is only one hook: `before_run_instances`. You can configure this with `config/hooks.yml`: Example:
|
188
188
|
|
189
|
-
```
|
189
|
+
```yaml
|
190
190
|
---
|
191
191
|
before_run_instances: /path/to/my/script.sh
|
192
192
|
```
|
@@ -234,20 +234,16 @@ An example of a spot instance profile is provided in [example/profiles/spot.yml]
|
|
234
234
|
|
235
235
|
## More Help
|
236
236
|
|
237
|
-
|
238
|
-
forger
|
239
|
-
forger
|
240
|
-
forger
|
241
|
-
forger help # general help
|
242
|
-
```
|
237
|
+
forger create help
|
238
|
+
forger ami help
|
239
|
+
forger compile help
|
240
|
+
forger help # general help
|
243
241
|
|
244
242
|
Examples are in the [example](docs/example) folder. You will have to update settings like your subnet and security group ids.
|
245
243
|
|
246
244
|
## Installation
|
247
245
|
|
248
|
-
|
249
|
-
gem install forger
|
250
|
-
```
|
246
|
+
gem install forger
|
251
247
|
|
252
248
|
### Dependencies
|
253
249
|
|
File without changes
|
data/forger.gemspec
CHANGED
@@ -25,9 +25,9 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency "dotenv"
|
26
26
|
spec.add_dependency "filesize"
|
27
27
|
spec.add_dependency "hashie"
|
28
|
+
spec.add_dependency "memoist"
|
28
29
|
spec.add_dependency "render_me_pretty"
|
29
30
|
spec.add_dependency "thor"
|
30
|
-
spec.add_dependency "memoist"
|
31
31
|
|
32
32
|
spec.add_development_dependency "bundler"
|
33
33
|
spec.add_development_dependency "byebug"
|
data/lib/forger.rb
CHANGED
@@ -2,28 +2,32 @@ $:.unshift(File.expand_path("../", __FILE__))
|
|
2
2
|
require "forger/version"
|
3
3
|
require "colorize"
|
4
4
|
require "render_me_pretty"
|
5
|
+
require "memoist"
|
5
6
|
|
6
7
|
module Forger
|
7
|
-
autoload :
|
8
|
-
autoload :Command, "forger/command"
|
9
|
-
autoload :CLI, "forger/cli"
|
8
|
+
autoload :Ami, "forger/ami"
|
10
9
|
autoload :AwsService, "forger/aws_service"
|
11
|
-
autoload :Profile, "forger/profile"
|
12
10
|
autoload :Base, "forger/base"
|
13
|
-
autoload :Create, "forger/create"
|
14
|
-
autoload :Destroy, "forger/destroy"
|
15
|
-
autoload :Ami, "forger/ami"
|
16
|
-
autoload :Wait, "forger/wait"
|
17
11
|
autoload :Clean, "forger/clean"
|
18
|
-
autoload :
|
19
|
-
autoload :
|
12
|
+
autoload :CLI, "forger/cli"
|
13
|
+
autoload :Command, "forger/command"
|
14
|
+
autoload :Completer, "forger/completer"
|
15
|
+
autoload :Completion, "forger/completion"
|
20
16
|
autoload :Config, "forger/config"
|
21
17
|
autoload :Core, "forger/core"
|
18
|
+
autoload :Create, "forger/create"
|
19
|
+
autoload :Destroy, "forger/destroy"
|
22
20
|
autoload :Dotenv, "forger/dotenv"
|
21
|
+
autoload :Help, "forger/help"
|
23
22
|
autoload :Hook, "forger/hook"
|
24
|
-
autoload :
|
25
|
-
autoload :
|
23
|
+
autoload :Network, "forger/network"
|
24
|
+
autoload :New, "forger/new"
|
25
|
+
autoload :Profile, "forger/profile"
|
26
|
+
autoload :Script, "forger/script"
|
27
|
+
autoload :Sequence, "forger/sequence"
|
26
28
|
autoload :Setting, "forger/setting"
|
29
|
+
autoload :Template, "forger/template"
|
30
|
+
autoload :Wait, "forger/wait"
|
27
31
|
extend Core
|
28
32
|
end
|
29
33
|
|
data/lib/forger/cli.rb
CHANGED
@@ -13,16 +13,22 @@ module Forger
|
|
13
13
|
|
14
14
|
common_options = Proc.new do
|
15
15
|
option :auto_terminate, type: :boolean, default: false, desc: "automatically terminate the instance at the end of user-data"
|
16
|
-
option :cloudwatch, type: :boolean,
|
16
|
+
option :cloudwatch, type: :boolean, desc: "enable cloudwatch logging, supported for amazonlinux2 and ubuntu"
|
17
17
|
end
|
18
18
|
|
19
|
+
long_desc Help.text(:new)
|
20
|
+
New.cli_options.each do |args|
|
21
|
+
option *args
|
22
|
+
end
|
23
|
+
register(New, "new", "new NAME", "Generates new forger project")
|
24
|
+
|
19
25
|
desc "create NAME", "create ec2 instance"
|
20
26
|
long_desc Help.text(:create)
|
21
27
|
option :ami_name, desc: "when specified, an ami creation script is appended to the user-data script"
|
22
28
|
option :randomize, type: :boolean, desc: "append random characters to end of name"
|
23
29
|
option :source_ami, desc: "override the source image_id in profile"
|
24
|
-
option :wait, desc: "Wait until the instance is ready and report dns name"
|
25
|
-
option :ssh, desc: "
|
30
|
+
option :wait, type: :boolean, default: true, desc: "Wait until the instance is ready and report dns name"
|
31
|
+
option :ssh, type: :boolean, desc: "Ssh into instance immediately after it's ready"
|
26
32
|
option :ssh_user, default: "ec2-user", desc: "User to use to with the ssh option to log into instance"
|
27
33
|
common_options.call
|
28
34
|
def create(name)
|
@@ -36,7 +42,7 @@ module Forger
|
|
36
42
|
Ami.new(options.merge(name: name)).run
|
37
43
|
end
|
38
44
|
|
39
|
-
desc "compile", "compiles app/scripts and app/
|
45
|
+
desc "compile", "compiles app/scripts and app/user_data to tmp folder"
|
40
46
|
long_desc Help.text(:compile)
|
41
47
|
option :layout, default: "default", desc: "layout for user_data helper"
|
42
48
|
def compile
|