forger 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b57dbd9ed6cebe6d22408d9eedc61c2a4f0398ee4d37f806f293a91344c2caf6
4
- data.tar.gz: f5a6ac3e67e166cd1a12e4abb10b0080b4912ae51fb41d170de9cd76690d5e0e
3
+ metadata.gz: 833f4ee033176e828f5a04b0fd2fce2544a335113156304db55d24c3b35f2427
4
+ data.tar.gz: e75cf80f65bead5108455185132b1a03de4ce5421349a0eb7c5bbd7c572afeba
5
5
  SHA512:
6
- metadata.gz: a8f11584373cedf9d2c8f20c05219d9094c65b081669210b045a55ce4ef87cde4b575e10dce7ef34670ab3fd16b0f8859dd3be8fced63189233c5a22b6a8359f
7
- data.tar.gz: 3c99722189cf579ff8f2b943bf17f0d5fd543242d6a2e5e9b13ddda807986b5ca47e684dbb0b5481781b7f802de959b03e1d7497575b1b4792d137a7baac3421
6
+ metadata.gz: 4114553f5e2cc98fd4d7dae6409652ad03fa16cf49f9c658974b164b8146233a974359f2466cdcb9da05b776580dc8243be87557173acd31f93ba0eedacf07de
7
+ data.tar.gz: 99905c00a84d3ae79e2155044e40024d98acbd684438f7a4f4597b298810d427b385026d3c326e281a97c63f239b778ea95366c22cc33e8b798a8c5fa376025d
@@ -3,6 +3,12 @@
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.2]
7
+ - Merge pull request #14 from tongueroo/fixes
8
+ - allow cloudwatch support for amzn ami
9
+ - rename cloudwatch group to forger
10
+ - stop user data when there are errors
11
+
6
12
  ## [2.0.1]
7
13
  - Merge pull request #13 from tongueroo/aws-config-fix
8
14
  - configure_aws_cli: always write ~/.aws/config
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- forger (2.0.1)
4
+ forger (2.0.2)
5
5
  activesupport
6
6
  aws-sdk-ec2
7
7
  aws-sdk-s3
@@ -22,19 +22,19 @@ GEM
22
22
  minitest (~> 5.1)
23
23
  tzinfo (~> 1.1)
24
24
  aws-eventstream (1.0.1)
25
- aws-partitions (1.105.0)
26
- aws-sdk-core (3.30.0)
25
+ aws-partitions (1.106.0)
26
+ aws-sdk-core (3.35.0)
27
27
  aws-eventstream (~> 1.0)
28
28
  aws-partitions (~> 1.0)
29
29
  aws-sigv4 (~> 1.0)
30
30
  jmespath (~> 1.0)
31
- aws-sdk-ec2 (1.50.0)
31
+ aws-sdk-ec2 (1.54.0)
32
32
  aws-sdk-core (~> 3, >= 3.26.0)
33
33
  aws-sigv4 (~> 1.0)
34
- aws-sdk-kms (1.9.0)
34
+ aws-sdk-kms (1.11.0)
35
35
  aws-sdk-core (~> 3, >= 3.26.0)
36
36
  aws-sigv4 (~> 1.0)
37
- aws-sdk-s3 (1.21.0)
37
+ aws-sdk-s3 (1.23.0)
38
38
  aws-sdk-core (~> 3, >= 3.26.0)
39
39
  aws-sdk-kms (~> 1)
40
40
  aws-sigv4 (~> 1.0)
@@ -67,7 +67,7 @@ GEM
67
67
  guard-compat (~> 1.1)
68
68
  rspec (>= 2.99.0, < 4.0)
69
69
  hashie (3.6.0)
70
- i18n (1.1.0)
70
+ i18n (1.1.1)
71
71
  concurrent-ruby (~> 1.0)
72
72
  jmespath (1.4.0)
73
73
  listen (3.1.5)
@@ -99,7 +99,7 @@ GEM
99
99
  rspec-mocks (~> 3.8.0)
100
100
  rspec-core (3.8.0)
101
101
  rspec-support (~> 3.8.0)
102
- rspec-expectations (3.8.1)
102
+ rspec-expectations (3.8.2)
103
103
  diff-lcs (>= 1.2.0, < 2.0)
104
104
  rspec-support (~> 3.8.0)
105
105
  rspec-mocks (3.8.0)
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![CircleCI](https://circleci.com/gh/tongueroo/forger.svg?style=svg)](https://circleci.com/gh/tongueroo/forger)
4
4
 
5
- Tool to create AWS ec2 instances consistently with pre-configured settings. The pre-configured settings are stored in the profiles folder of the current project directory.
5
+ Tool to create AWS EC2 instances consistently with pre-configured settings. The pre-configured settings are stored in the profiles folder of the current project directory.
6
6
  Example:
7
7
 
8
8
  * profiles/default.yml: Default settings. Used when no profile is specified.
@@ -42,7 +42,7 @@ You can do a test run with the `--noop` flag. This will print out what settings
42
42
 
43
43
  ## Conventional Profile Name
44
44
 
45
- If there is a profile name that matches the ec2 specified instance name, you can omit the `--profile` flag. Example
45
+ If there is a profile name that matches the EC2 specified instance name, you can omit the `--profile` flag. Example
46
46
 
47
47
  forger create webserver --profile webserver
48
48
  forger create webserver # same as above
@@ -232,6 +232,16 @@ Spot instance is natively supported by the AWS `run_instances` command by adding
232
232
 
233
233
  An example of a spot instance profile is provided in [example/profiles/spot.yml](docs/example/profiles/spot.yml).
234
234
 
235
+ ## CloudWatch Support
236
+
237
+ The output of the logs like `/var/log/cloud-init-output.log` can get sent to CloudWatch. This gets enabled with the `--cloudwatch` flag. Example:
238
+
239
+ forger create myserver --cloudwatch
240
+
241
+ CloudWatch support only works for some OSes and is still somewhat experimental. Here's the OS check in the source: [lib/forger/scripts/cloudwatch.sh](https://github.com/tongueroo/forger/blob/master/lib/forger/scripts/cloudwatch.sh#L16).
242
+
243
+ Note, CloudWatch logs take a few seconds to send from the EC2 instance to CloudWatch. So when using the `--auto-terminate` option the instance might be terminated before all the logs get sent. So you might not capture all the logs. You can add a sleep 10 at the bottom of your user-data script if you think this is happening.
244
+
235
245
  ## More Help
236
246
 
237
247
  forger create help
@@ -18,7 +18,7 @@ module Forger
18
18
 
19
19
  long_desc Help.text(:new)
20
20
  New.cli_options.each do |args|
21
- option *args
21
+ option(*args)
22
22
  end
23
23
  register(New, "new", "new NAME", "Generates new forger project")
24
24
 
@@ -72,14 +72,14 @@ class Forger::Create
72
72
 
73
73
  region = cloudwatch_log_region
74
74
  stream = "#{instance_id}/var/log/cloud-init-output.log"
75
- url = "https://#{region}.console.aws.amazon.com/cloudwatch/home?region=#{region}#logEventViewer:group=ec2;stream=#{stream}"
76
- cw_init_log = "cw tail -f ec2 #{stream}"
75
+ url = "https://#{region}.console.aws.amazon.com/cloudwatch/home?region=#{region}#logEventViewer:group=forger;stream=#{stream}"
76
+ cw_init_log = "cw tail -f forger #{stream}"
77
77
  puts "To view instance's cloudwatch logs visit:"
78
78
  puts " #{url}"
79
79
 
80
80
  puts " #{cw_init_log}" if show_cw
81
81
  if show_cw && @options[:auto_terminate]
82
- cw_terminate_log = "cw tail -f ec2 #{instance_id}/var/log/auto-terminate.log"
82
+ cw_terminate_log = "cw tail -f forger #{instance_id}/var/log/auto-terminate.log"
83
83
  puts " #{cw_terminate_log}"
84
84
  end
85
85
 
@@ -1,3 +1,3 @@
1
1
  #!/bin/bash -eux
2
2
 
3
- /opt/forger/cloudwatch.sh ec2
3
+ /opt/forger/cloudwatch.sh forger # forger will be the cloudwatch log group name
@@ -1,5 +1,9 @@
1
1
  #!/bin/bash -eux
2
2
 
3
+ # extract forger happens very early and the top of the user data script.
4
+ # Set the -e flag here to stop the script if there any errors.
5
+ set -e
6
+
3
7
  # Downloads and extract the scripts.
4
8
  # The extracted folder from github looks like this:
5
9
  # branch-name.tar.gz => forger-branch-name
@@ -13,7 +13,7 @@ LOG_GROUP_NAME=$1
13
13
  # shellcheck disable=SC1091
14
14
  source "/opt/forger/shared/functions.sh"
15
15
  OS=$(os_name)
16
- if [ "$OS" != "amazonlinux2" ] && [ "$OS" != "ubuntu" ] ; then
16
+ if [ "$OS" != "amzn" ] && [ "$OS" != "amazonlinux2" ] && [ "$OS" != "ubuntu" ] ; then
17
17
  echo "Sorry, cloudwatch logging with the forger tool is supported for amazonlinux2 and ubuntu only"
18
18
  exit
19
19
  fi
@@ -14,3 +14,5 @@ script
14
14
  chkconfig awslogs on
15
15
  end script
16
16
  EOL
17
+
18
+ start awslogs
@@ -1,3 +1,3 @@
1
1
  module Forger
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
@@ -41,8 +41,8 @@ It is useful to verify that the instance has launched and completed its bootstra
41
41
  EC2 instance box created: i-03f3c96eaec8ea359 🎉
42
42
  Visit https://console.aws.amazon.com/ec2/home to check on the status
43
43
  To view instance's cloudwatch logs visit:
44
- https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#logEventViewer:group=ec2;stream=i-03f3c96eaec8ea359/var/log/cloud-init-output.log
45
- cw tail -f ec2 i-03f3c96eaec8ea359/var/log/cloud-init-output.log
44
+ https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#logEventViewer:group=forger;stream=i-03f3c96eaec8ea359/var/log/cloud-init-output.log
45
+ cw tail -f forger i-03f3c96eaec8ea359/var/log/cloud-init-output.log
46
46
  Note: It takes a little time for the instance to launch and report logs.
47
47
  Pro tip: The CloudWatch Console Link has been added to your copy-and-paste clipboard.
48
48
  $
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-09 00:00:00.000000000 Z
11
+ date: 2018-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport