cfn-hup 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +1 -0
- data/README.md +47 -0
- data/Rakefile +6 -0
- data/cfn-hup.gemspec +23 -0
- data/lib/configset.yml +36 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7eca08152ac9d43ff3077b823ad00b037c9cca7a6cdb594ffdfb556a7dfb2758
|
4
|
+
data.tar.gz: b67f50d332910d04fa6293806ed683b60b9dd0f53b7c24c85a1a5fe0f359cc9f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 51ff3e5d4506c0b6ef8ea4dd497b1a06710f1b929aabe0b453bc3a470332ec2916cfb20b2640b79cd513f65ff469473cf4c32210472a606c26c93251039e29ee
|
7
|
+
data.tar.gz: 8cdb519221d8d88c6ef2c249859105601e8564704612c9469c689654051f257aef482acfbc1478fdebc95aa206188ce04cbd466b5e24090bec20f2308afe4b6e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cfn-hup (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (10.5.0)
|
11
|
+
rspec (3.9.0)
|
12
|
+
rspec-core (~> 3.9.0)
|
13
|
+
rspec-expectations (~> 3.9.0)
|
14
|
+
rspec-mocks (~> 3.9.0)
|
15
|
+
rspec-core (3.9.0)
|
16
|
+
rspec-support (~> 3.9.0)
|
17
|
+
rspec-expectations (3.9.0)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.9.0)
|
20
|
+
rspec-mocks (3.9.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.9.0)
|
23
|
+
rspec-support (3.9.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 2.0)
|
30
|
+
cfn-hup!
|
31
|
+
rake (~> 10.0)
|
32
|
+
rspec (~> 3.0)
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
https://www.boltops.com/boltops-community-license
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# cfn-hup configset
|
2
|
+
|
3
|
+
![CodeBuild](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiV3JyMHYvZHVPNlNORnloUVE1YzlNTWJkZUJmNmVtaXdvZ1pKV1U4SUUrcU9VcTVZdm5qbVA2cWdIdUZ0VEIraTVyaFpUajBpK2NvZmNFeTRWaEI1TnI0PSIsIml2UGFyYW1ldGVyU3BlYyI6IjZFRnpCNXh4ZEY3L2dqS00iLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
|
4
|
+
|
5
|
+
[![BoltOps Badge](https://img.boltops.com/boltops/badges/boltops-badge.png)](https://www.boltops.com)
|
6
|
+
|
7
|
+
## Why?
|
8
|
+
|
9
|
+
Configsets are essentially configuration management. Use configsets to configure and update your EC2 instances automatically. Lono allows you to use configsets in a reusable way.
|
10
|
+
|
11
|
+
Configsets work with [AWS::CloudFormation::Init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html) and [cfn-init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-init.html). Configsets do not magically get applied after being added to the CloudFormation template though. The `cfn-init` script must be called to apply the configset.
|
12
|
+
|
13
|
+
Usually the `cfn-init` script is called in the UserData script. This ensures configsets are applied when instances are launched.
|
14
|
+
|
15
|
+
Additionally, the [cfn-hup](https://github.com/boltopspro/cfn-hup) script can be set up to apply configsets continuously.
|
16
|
+
|
17
|
+
This configset configures and runs the cfn-hup daemon. The `cfn-auto-reloader.conf` is configured to detect changes every 1 minute. When the stack [Metatdata AWS::CloudFormation::Init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html) changes, cfn-hup detects this and updates the EC2 instance. This ensures that the EC2 instance will always be up-to-date.
|
18
|
+
|
19
|
+
The cfn-hup configset should usually be one of the first things to be setup.
|
20
|
+
|
21
|
+
## What are lono configsets?
|
22
|
+
|
23
|
+
Lono configsets allow CloudFormation [cfn-init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-init.html) [configsets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html) that are typically embedded in the template to be reusable. More info: [Lono Configsets docs](https://lono.cloud/docs/configsets/).
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Use `configset` to enable the configset for the blueprint. Example:
|
28
|
+
|
29
|
+
configs/demo/configsets/base.rb:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
configset("cfn-hup", resource: "Instance")
|
33
|
+
```
|
34
|
+
|
35
|
+
This adds the configset to the `resource` with the logical id `Instance` in your CloudFormation template. The configset is added to the [Resources[].Metadata.AWS::CloudFormation::Init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html) attribute of the `Instance` resource.
|
36
|
+
|
37
|
+
Here's an example adding to a `LaunchConfig` resource:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
configset("cfn-hup", resource: "LaunchConfig")
|
41
|
+
```
|
42
|
+
|
43
|
+
Here's an example adding to a `LaunchTemplate` resource:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
configset("cfn-hup", resource: "LaunchTemplate")
|
47
|
+
```
|
data/Rakefile
ADDED
data/cfn-hup.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "cfn-hup"
|
3
|
+
spec.version = "0.1.0"
|
4
|
+
spec.authors = ["Tung Nguyen"]
|
5
|
+
spec.email = ["tung@boltops.com"]
|
6
|
+
|
7
|
+
spec.summary = "cfn-hup configset: configures and ensures cfn-hup is running"
|
8
|
+
spec.homepage = "https://github.com/boltopspro/cfn-hup"
|
9
|
+
spec.license = "https://www.boltops.com/boltops-community-license"
|
10
|
+
|
11
|
+
# Specify which files should be added to the gem when it is released.
|
12
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
13
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
14
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
15
|
+
end
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
23
|
+
end
|
data/lib/configset.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
AWS::CloudFormation::Init:
|
2
|
+
configSets:
|
3
|
+
default:
|
4
|
+
- cfn_hup
|
5
|
+
cfn_hup:
|
6
|
+
files:
|
7
|
+
"/etc/cfn/cfn-hup.conf":
|
8
|
+
content:
|
9
|
+
Fn::Sub:
|
10
|
+
- |
|
11
|
+
[main]
|
12
|
+
stack=${AWS::StackId}
|
13
|
+
region=${AWS::Region}
|
14
|
+
interval=1
|
15
|
+
- {}
|
16
|
+
mode: '000400'
|
17
|
+
owner: root
|
18
|
+
group: root
|
19
|
+
"/etc/cfn/hooks.d/cfn-auto-reloader.conf":
|
20
|
+
content:
|
21
|
+
Fn::Sub:
|
22
|
+
- |
|
23
|
+
[cfn-auto-reloader-hook]
|
24
|
+
triggers=post.update
|
25
|
+
path=Resources.<%= @resource %>.Metadata.AWS::CloudFormation::Init
|
26
|
+
action=/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource <%= @resource %> --region ${AWS::Region}
|
27
|
+
runas=root
|
28
|
+
- {}
|
29
|
+
services:
|
30
|
+
sysvinit:
|
31
|
+
cfn-hup:
|
32
|
+
enabled: 'true'
|
33
|
+
ensureRunning: 'true'
|
34
|
+
files:
|
35
|
+
- "/etc/cfn/cfn-hup.conf"
|
36
|
+
- "/etc/cfn/hooks.d/cfn-auto-reloader.conf"
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cfn-hup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tung Nguyen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-01-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- tung@boltops.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- CHANGELOG.md
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- cfn-hup.gemspec
|
71
|
+
- lib/configset.yml
|
72
|
+
homepage: https://github.com/boltopspro/cfn-hup
|
73
|
+
licenses:
|
74
|
+
- https://www.boltops.com/boltops-community-license
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubygems_version: 3.1.2
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: 'cfn-hup configset: configures and ensures cfn-hup is running'
|
95
|
+
test_files: []
|