lono 4.2.7 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cody/README.md +6 -0
- data/.cody/acceptance.sh +30 -0
- data/.cody/buildspec.yml +21 -0
- data/.cody/demo.rb +38 -0
- data/.cody/project.rb +12 -0
- data/.cody/role.rb +1 -0
- data/.gitignore +2 -0
- data/.gitmodules +6 -3
- data/.travis.yml +7 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +0 -1
- data/LICENSE.txt +1 -22
- data/README.md +46 -55
- data/lib/lono.rb +20 -27
- data/lib/lono/app_file.rb +5 -0
- data/lib/lono/app_file/base.rb +19 -0
- data/lib/lono/app_file/build.rb +78 -0
- data/lib/lono/app_file/registry.rb +14 -0
- data/lib/lono/app_file/registry/item.rb +46 -0
- data/lib/lono/app_file/upload.rb +39 -0
- data/lib/lono/autoloader.rb +22 -0
- data/lib/lono/aws_services.rb +46 -0
- data/lib/lono/aws_services/util.rb +49 -0
- data/lib/lono/blueprint.rb +113 -0
- data/lib/lono/blueprint/find.rb +90 -0
- data/lib/lono/blueprint/helper.rb +18 -0
- data/lib/lono/blueprint/info.rb +10 -0
- data/lib/lono/blueprint/list.rb +14 -0
- data/lib/lono/blueprint/root.rb +43 -0
- data/lib/lono/cfn.rb +31 -19
- data/lib/lono/cfn/aws_service.rb +16 -0
- data/lib/lono/cfn/base.rb +244 -261
- data/lib/lono/cfn/create.rb +36 -32
- data/lib/lono/cfn/current.rb +1 -1
- data/lib/lono/cfn/delete.rb +2 -2
- data/lib/lono/cfn/deploy.rb +11 -0
- data/lib/lono/cfn/diff.rb +1 -1
- data/lib/lono/cfn/preview.rb +3 -3
- data/lib/lono/cfn/rollback.rb +26 -0
- data/lib/lono/cfn/status.rb +2 -203
- data/lib/lono/cfn/suffix.rb +67 -0
- data/lib/lono/cfn/update.rb +61 -53
- data/lib/lono/cli.rb +42 -23
- data/lib/lono/completer.rb +0 -2
- data/lib/lono/configure.rb +37 -0
- data/lib/lono/configure/aws_services.rb +18 -0
- data/lib/lono/configure/base.rb +94 -0
- data/lib/lono/configure/helpers.rb +128 -0
- data/lib/lono/conventions.rb +11 -0
- data/lib/lono/core.rb +42 -12
- data/lib/lono/core/config.rb +5 -4
- data/lib/lono/default/settings.yml +0 -11
- data/lib/lono/file_uploader.rb +9 -4
- data/lib/lono/help.rb +1 -2
- data/lib/lono/help/blueprint.md +46 -0
- data/lib/lono/help/cfn.md +5 -4
- data/lib/lono/help/cfn/create.md +14 -9
- data/lib/lono/help/cfn/deploy.md +92 -0
- data/lib/lono/help/cfn/diff.md +0 -1
- data/lib/lono/help/cfn/update.md +16 -15
- data/lib/lono/help/completion.md +3 -3
- data/lib/lono/help/generate.md +0 -1
- data/lib/lono/help/new.md +40 -34
- data/lib/lono/help/param.md +1 -1
- data/lib/lono/help/param/generate.md +1 -1
- data/lib/lono/help/template.md +2 -2
- data/lib/lono/help/xgraph.md +1 -1
- data/lib/lono/inspector.rb +1 -1
- data/lib/lono/inspector/base.rb +26 -10
- data/lib/lono/inspector/graph.rb +7 -3
- data/lib/lono/inspector/summary.rb +15 -3
- data/lib/lono/md5.rb +46 -0
- data/lib/lono/new.rb +40 -28
- data/lib/lono/new/helper.rb +2 -3
- data/lib/lono/param.rb +12 -11
- data/lib/lono/param/generator.rb +96 -42
- data/lib/lono/project_checker.rb +27 -8
- data/lib/lono/s3.rb +23 -0
- data/lib/lono/s3/bucket.rb +123 -0
- data/lib/lono/script.rb +4 -8
- data/lib/lono/script/base.rb +7 -2
- data/lib/lono/script/build.rb +7 -8
- data/lib/lono/script/upload.rb +4 -20
- data/lib/lono/sequence.rb +19 -16
- data/lib/lono/setting.rb +19 -27
- data/lib/lono/template.rb +22 -26
- data/lib/lono/template/base.rb +13 -0
- data/lib/lono/template/context.rb +4 -56
- data/lib/lono/template/context/loader.rb +70 -0
- data/lib/lono/template/dsl.rb +15 -151
- data/lib/lono/template/dsl/builder.rb +60 -0
- data/lib/lono/template/dsl/builder/base.rb +14 -0
- data/lib/lono/template/dsl/builder/condition.rb +26 -0
- data/lib/lono/template/dsl/builder/fn.rb +114 -0
- data/lib/lono/template/dsl/builder/helper.rb +64 -0
- data/lib/lono/template/dsl/builder/mapping.rb +24 -0
- data/lib/lono/template/dsl/builder/output.rb +37 -0
- data/lib/lono/template/dsl/builder/parameter.rb +39 -0
- data/lib/lono/template/dsl/builder/resource.rb +38 -0
- data/lib/lono/template/dsl/builder/section.rb +12 -0
- data/lib/lono/template/dsl/builder/syntax.rb +58 -0
- data/lib/lono/template/erb.rb +82 -0
- data/lib/lono/template/evaluate.rb +39 -0
- data/lib/lono/template/generator.rb +29 -0
- data/lib/lono/template/helper.rb +7 -29
- data/lib/lono/template/post_processor.rb +69 -0
- data/lib/lono/template/template.rb +4 -9
- data/lib/lono/template/upload.rb +103 -133
- data/lib/lono/template/util.rb +48 -0
- data/lib/lono/upgrade.rb +5 -3
- data/lib/lono/upgrade/upgrade5.rb +55 -0
- data/lib/lono/user_data.rb +4 -4
- data/lib/lono/version.rb +1 -1
- data/lib/templates/blueprint/%blueprint_name%.gemspec.tt +44 -0
- data/lib/templates/blueprint/.gitignore +14 -0
- data/lib/templates/blueprint/.lono/config.yml.tt +3 -0
- data/lib/templates/blueprint/.meta/config.yml.tt +3 -0
- data/lib/templates/blueprint/CHANGELOG.md +7 -0
- data/lib/templates/blueprint/Gemfile +4 -0
- data/lib/templates/blueprint/README.md +37 -0
- data/lib/templates/blueprint/Rakefile +6 -0
- data/lib/templates/blueprint/setup/configs.rb +54 -0
- data/lib/templates/blueprint_configs/configs/%blueprint_name%/params/base.txt +2 -0
- data/lib/{starter_projects/skeleton/app/definitions/base.rb → templates/blueprint_configs/configs/%blueprint_name%/params/development.txt} +0 -0
- data/lib/templates/blueprint_configs/configs/%blueprint_name%/variables/base.rb +2 -0
- data/lib/templates/blueprint_configs/configs/%blueprint_name%/variables/development.rb +0 -0
- data/lib/templates/blueprint_types/dsl/app/templates/%blueprint_name%.rb +37 -0
- data/lib/templates/blueprint_types/dsl/app/user_data/bootstrap.sh +2 -0
- data/lib/templates/blueprint_types/erb/app/definitions/base.rb.tt +1 -0
- data/lib/templates/blueprint_types/erb/app/templates/%blueprint_name%.yml +8 -0
- data/lib/{starter_projects/autoscaling → templates/skeleton}/.gitignore +1 -0
- data/lib/templates/skeleton/Gemfile +3 -0
- data/lib/{starter_projects/autoscaling → templates/skeleton}/Guardfile +2 -2
- data/lib/templates/skeleton/README.md +58 -0
- data/lib/templates/skeleton/configs/settings.yml +17 -0
- data/lib/templates/upgrade5/blueprints/main/.lono/config.yml +3 -0
- data/lib/templates/upgrade5/blueprints/main/.meta/config.yml +3 -0
- data/lono.gemspec +12 -8
- data/vendor/cfn-status/CHANGELOG.md +10 -0
- data/vendor/cfn-status/Gemfile +4 -0
- data/vendor/cfn-status/LICENSE.txt +21 -0
- data/vendor/cfn-status/README.md +56 -0
- data/vendor/cfn-status/Rakefile +6 -0
- data/vendor/cfn-status/bin/console +14 -0
- data/vendor/cfn-status/bin/setup +8 -0
- data/vendor/cfn-status/cfn-status.gemspec +30 -0
- data/vendor/cfn-status/lib/cfn-status.rb +1 -0
- data/vendor/cfn-status/lib/cfn/aws_service.rb +51 -0
- data/vendor/cfn-status/lib/cfn/status.rb +219 -0
- data/vendor/cfn-status/lib/cfn/status/version.rb +5 -0
- data/vendor/cfn-status/spec/cfn/status_spec.rb +81 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
- data/vendor/cfn-status/spec/spec_helper.rb +14 -0
- data/vendor/cfn_camelizer/CHANGELOG.md +20 -0
- data/vendor/cfn_camelizer/Gemfile +4 -0
- data/vendor/cfn_camelizer/LICENSE.txt +21 -0
- data/vendor/cfn_camelizer/README.md +40 -0
- data/vendor/cfn_camelizer/Rakefile +6 -0
- data/vendor/cfn_camelizer/bin/console +14 -0
- data/vendor/cfn_camelizer/bin/setup +8 -0
- data/vendor/cfn_camelizer/cfn_camelizer.gemspec +32 -0
- data/vendor/cfn_camelizer/lib/camelizer.yml +37 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +94 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +3 -0
- data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +86 -0
- data/vendor/cfn_camelizer/spec/spec_helper.rb +14 -0
- metadata +189 -62
- data/.circleci/bin/commit_docs.sh +0 -26
- data/.circleci/config.yml +0 -72
- data/bin/release +0 -9
- data/lib/lono/help/import.md +0 -54
- data/lib/lono/importer.rb +0 -134
- data/lib/lono/new/message.rb +0 -35
- data/lib/starter_projects/autoscaling/Gemfile +0 -3
- data/lib/starter_projects/autoscaling/README.md +0 -118
- data/lib/starter_projects/autoscaling/app/definitions/base.rb +0 -2
- data/lib/starter_projects/autoscaling/app/templates/autoscaling.yml +0 -682
- data/lib/starter_projects/autoscaling/config/params/base/autoscaling.txt +0 -6
- data/lib/starter_projects/autoscaling/config/settings.yml +0 -33
- data/lib/starter_projects/ec2/.gitignore +0 -2
- data/lib/starter_projects/ec2/Gemfile +0 -3
- data/lib/starter_projects/ec2/Guardfile +0 -12
- data/lib/starter_projects/ec2/README.md +0 -86
- data/lib/starter_projects/ec2/app/definitions/base.rb +0 -2
- data/lib/starter_projects/ec2/app/definitions/development.rb +0 -1
- data/lib/starter_projects/ec2/app/definitions/production.rb +0 -1
- data/lib/starter_projects/ec2/app/helpers/my_custom_helper.rb +0 -17
- data/lib/starter_projects/ec2/app/partials/user_data/bootstrap.sh +0 -4
- data/lib/starter_projects/ec2/app/templates/example.yml +0 -430
- data/lib/starter_projects/ec2/config/params/base/example.txt +0 -2
- data/lib/starter_projects/ec2/config/params/development/example.txt +0 -3
- data/lib/starter_projects/ec2/config/params/production/example.txt +0 -2
- data/lib/starter_projects/ec2/config/settings.yml +0 -33
- data/lib/starter_projects/ec2/config/variables/base.rb +0 -3
- data/lib/starter_projects/ec2/config/variables/development.rb +0 -2
- data/lib/starter_projects/ec2/config/variables/production.rb +0 -2
- data/lib/starter_projects/ec2/welcome.txt +0 -8
- data/lib/starter_projects/skeleton/.gitignore +0 -2
- data/lib/starter_projects/skeleton/Gemfile +0 -3
- data/lib/starter_projects/skeleton/Guardfile +0 -12
- data/lib/starter_projects/skeleton/README.md +0 -53
- data/lib/starter_projects/skeleton/config/settings.yml +0 -33
- data/lib/starter_projects/skeleton/welcome.txt +0 -7
- data/vendor/plissken/Gemfile +0 -14
- data/vendor/plissken/LICENSE.txt +0 -20
- data/vendor/plissken/README.md +0 -46
- data/vendor/plissken/Rakefile +0 -56
- data/vendor/plissken/VERSION +0 -1
- data/vendor/plissken/lib/plissken.rb +0 -1
- data/vendor/plissken/lib/plissken/ext/hash/to_snake_keys.rb +0 -45
- data/vendor/plissken/plissken.gemspec +0 -61
- data/vendor/plissken/spec/lib/to_snake_keys_spec.rb +0 -177
- data/vendor/plissken/spec/spec_helper.rb +0 -90
- data/vendor/plissken/test/helper.rb +0 -20
- data/vendor/plissken/test/plissken/ext/hash/to_snake_keys_test.rb +0 -184
- data/vendor/plissken/test/test_plissken.rb +0 -2
@@ -0,0 +1,48 @@
|
|
1
|
+
class Lono::Template
|
2
|
+
module Util
|
3
|
+
def ensure_parent_dir(path)
|
4
|
+
dir = File.dirname(path)
|
5
|
+
FileUtils.mkdir_p(dir) unless File.exist?(dir)
|
6
|
+
end
|
7
|
+
|
8
|
+
def validate_yaml(path)
|
9
|
+
text = IO.read(path)
|
10
|
+
begin
|
11
|
+
YAML.load(text)
|
12
|
+
rescue Psych::SyntaxError => e
|
13
|
+
handle_yaml_syntax_error(e, path)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def handle_yaml_syntax_error(e, path)
|
18
|
+
io = StringIO.new
|
19
|
+
io.puts "Invalid yaml. Output written to debugging: #{path}".color(:red)
|
20
|
+
io.puts "ERROR: #{e.message}".color(:red)
|
21
|
+
|
22
|
+
# Grab line info. Example error:
|
23
|
+
# ERROR: (<unknown>): could not find expected ':' while scanning a simple key at line 2 column 1
|
24
|
+
md = e.message.match(/at line (\d+) column (\d+)/)
|
25
|
+
line = md[1].to_i
|
26
|
+
|
27
|
+
lines = IO.read(path).split("\n")
|
28
|
+
context = 5 # lines of context
|
29
|
+
top, bottom = [line-context-1, 0].max, line+context-1
|
30
|
+
spacing = lines.size.to_s.size
|
31
|
+
lines[top..bottom].each_with_index do |line_content, index|
|
32
|
+
line_number = top+index+1
|
33
|
+
if line_number == line
|
34
|
+
io.printf("%#{spacing}d %s\n".color(:red), line_number, line_content)
|
35
|
+
else
|
36
|
+
io.printf("%#{spacing}d %s\n", line_number, line_content)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
if ENV['TEST']
|
41
|
+
io.string
|
42
|
+
else
|
43
|
+
puts io.string
|
44
|
+
exit 1
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/lono/upgrade.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
require "thor"
|
2
2
|
|
3
3
|
class Lono::Upgrade < Lono::Command
|
4
|
-
autoload :Upgrade4, 'lono/upgrade/upgrade4'
|
5
|
-
autoload :Upgrade42, 'lono/upgrade/upgrade42'
|
6
|
-
|
7
4
|
desc "v3to4", "Upgrade from version 3 to 4."
|
8
5
|
def v3to4
|
9
6
|
Upgrade4.new(options).run
|
@@ -13,4 +10,9 @@ class Lono::Upgrade < Lono::Command
|
|
13
10
|
def v4to4_2
|
14
11
|
Upgrade42.start
|
15
12
|
end
|
13
|
+
|
14
|
+
desc "v4to5", "Upgrade from version 4.2 to 5.0"
|
15
|
+
def v4to5
|
16
|
+
Upgrade5.start
|
17
|
+
end
|
16
18
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
class Lono::Upgrade
|
5
|
+
class Upgrade5 < Lono::Sequence
|
6
|
+
def sanity_check
|
7
|
+
if File.exist?("blueprints")
|
8
|
+
puts "The blueprints folder already exist. The project already seems to have the lono v5 structure."
|
9
|
+
exit
|
10
|
+
end
|
11
|
+
|
12
|
+
unless File.exist?("config/settings.yml")
|
13
|
+
puts "ERROR: The config/settings.yml file does not exist. Are you sure you're within a lono project?".color(:red)
|
14
|
+
exit 1
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_blueprints_folder
|
19
|
+
puts "Creating: blueprints folder"
|
20
|
+
FileUtils.mkdir_p("blueprints/main")
|
21
|
+
end
|
22
|
+
|
23
|
+
def move_to_main_blueprint
|
24
|
+
puts "Moving files to blueprints folder"
|
25
|
+
# Dir.entries includes hidden files
|
26
|
+
Dir.entries('.').each do |p|
|
27
|
+
next if %w[blueprints .git .. .].include?(p)
|
28
|
+
FileUtils.mv(p, "blueprints/main/#{p}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def move_configs
|
33
|
+
puts "Setting up the new configs structure"
|
34
|
+
FileUtils.mkdir_p("configs/main")
|
35
|
+
FileUtils.mv("blueprints/main/config/params", "configs/main/params")
|
36
|
+
FileUtils.mv("blueprints/main/config/variables", "configs/main/variables")
|
37
|
+
FileUtils.mv("blueprints/main/config/settings.yml", "configs/settings.yml")
|
38
|
+
|
39
|
+
FileUtils.rmdir("blueprints/main/config") if Dir.empty?("blueprints/main/config")
|
40
|
+
end
|
41
|
+
|
42
|
+
def starter_files
|
43
|
+
puts "Creating remaining starter lono project files"
|
44
|
+
files = %w[
|
45
|
+
.gitignore
|
46
|
+
Gemfile
|
47
|
+
Guardfile
|
48
|
+
README.md
|
49
|
+
]
|
50
|
+
files.each { |f | template(f) }
|
51
|
+
|
52
|
+
template("../upgrade5/blueprints/main/.meta/config.yml", "blueprints/main/.meta/config.yml")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/lono/user_data.rb
CHANGED
@@ -3,11 +3,11 @@ module Lono
|
|
3
3
|
# exposed to the lono userdata command so users can debug their generated
|
4
4
|
# app/user_data scripts. It is useful for debugging.
|
5
5
|
#
|
6
|
-
# Normally, the Lono::
|
6
|
+
# Normally, the Lono::Erb#run method generates the CloudFormation templates
|
7
7
|
# and embeds user-data script into the template.
|
8
8
|
class UserData
|
9
|
-
def initialize(options)
|
10
|
-
@options = options
|
9
|
+
def initialize(blueprint, options)
|
10
|
+
@blueprint, @options = blueprint, options
|
11
11
|
@name = options[:name]
|
12
12
|
@path = "#{Lono.root}/app/user_data/#{@name}.sh"
|
13
13
|
end
|
@@ -25,7 +25,7 @@ module Lono
|
|
25
25
|
# Context for ERB rendering.
|
26
26
|
# This is where we control what references get passed to the ERB rendering.
|
27
27
|
def context
|
28
|
-
@context ||= Lono::Template::Context.new(@options)
|
28
|
+
@context ||= Lono::Template::Context.new(@blueprint, @options)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/lib/lono/version.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "<%= blueprint_name %>"
|
6
|
+
spec.version = "0.1.0"
|
7
|
+
spec.authors = ["<%= user_info[:author] %>"]
|
8
|
+
spec.email = ["<%= ENV['LONO_EMAIL'] || user_info[:email] %>"]
|
9
|
+
|
10
|
+
spec.summary = "Write a short summary because it's required." # TODO: Change me
|
11
|
+
spec.description = "Write a longer description or delete this line." # TODO: Change me
|
12
|
+
spec.homepage = "https://github.com/user/repo" # TODO: Change me
|
13
|
+
spec.license = "<%= ENV['LONO_LICENSE'] || 'MIT' %>"
|
14
|
+
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata["allowed_push_host"] = "<%= ENV['LONO_ALLOWED_PUSH_HOST'] || "TODO: Set to 'http://mygemserver.com'"%>"
|
19
|
+
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
+
<% if ENV['LONO_SOURCE_CODE_ORG'] -%>
|
22
|
+
spec.metadata["source_code_uri"] = "<%= ENV['LONO_SOURCE_CODE_ORG'] %>/<%= blueprint_name %>"
|
23
|
+
spec.metadata["changelog_uri"] = "<%= ENV['LONO_SOURCE_CODE_ORG'] %>/<%= blueprint_name %>/blob/master/CHANGELOG.md"
|
24
|
+
<% else -%>
|
25
|
+
spec.metadata["source_code_uri"] = "https://github.com/user/repo" # TODO: Change me
|
26
|
+
spec.metadata["changelog_uri"] = "https://github.com/user/repo/blob/master/CHANGELOG.md" # TODO: Change me
|
27
|
+
<% end -%>
|
28
|
+
else
|
29
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
30
|
+
"public gem pushes."
|
31
|
+
end
|
32
|
+
# Specify which files should be added to the gem when it is released.
|
33
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
34
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
35
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
36
|
+
end
|
37
|
+
spec.bindir = "exe"
|
38
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
39
|
+
spec.require_paths = ["lib"]
|
40
|
+
|
41
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
42
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
43
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
44
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Blueprint Starter README
|
2
|
+
|
3
|
+
## Usage
|
4
|
+
|
5
|
+
1. Configure: configs/BLUEPRINT values
|
6
|
+
2. Deploy blueprint
|
7
|
+
|
8
|
+
## Configure
|
9
|
+
|
10
|
+
First you want to configure the `configs/BLUEPRINT/params` and `configs/BLUEPRINT/variables` files.
|
11
|
+
|
12
|
+
If the blueprint has implemented it, you can use `lono configure` to quickly configure starter values for these `config/BLUEPRINT` files.
|
13
|
+
|
14
|
+
LONO_ENV=development lono configure BLUEPRINT --args key1:value1 key2:value2
|
15
|
+
|
16
|
+
To additional environments:
|
17
|
+
|
18
|
+
LONO_ENV=production lono configure BLUEPRINT --args key1:value1 key2:value2
|
19
|
+
|
20
|
+
The generated files in `config/BLUEPRINT` folder look something like this:
|
21
|
+
|
22
|
+
configs/BLUEPRINT/
|
23
|
+
├── params
|
24
|
+
│ ├── development.txt
|
25
|
+
│ └── production.txt
|
26
|
+
└── variables
|
27
|
+
├── development.rb
|
28
|
+
└── production.rb
|
29
|
+
|
30
|
+
The PARAM depends on how the blueprint was authored. The PARAM conventionally defaults to BLUEPRINT.
|
31
|
+
|
32
|
+
## Deploy
|
33
|
+
|
34
|
+
Use the [lono cfn deploy](http://lono.cloud/reference/lono-cfn-deploy/) command to deploy. Example:
|
35
|
+
|
36
|
+
LONO_ENV=development lono cfn deploy BLUEPRINT-development --blueprint BLUEPRINT --iam
|
37
|
+
LONO_ENV=production lono cfn deploy BLUEPRINT-production --blueprint BLUEPRINT --iam
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# This class is used by `lono configure [blueprint]` to create starter config files.
|
2
|
+
# Example files that get created:
|
3
|
+
#
|
4
|
+
# Variables:
|
5
|
+
#
|
6
|
+
# configs/[blueprint]/variables/[Lono.env].rb
|
7
|
+
#
|
8
|
+
# Params:
|
9
|
+
#
|
10
|
+
# configs/[blueprint]/params/[Lono.env].txt - short form
|
11
|
+
# configs/[blueprint]/params/[Lono.env]/[param].txt - medium form
|
12
|
+
# configs/[blueprint]/params/[Lono.env]/[template]/[param].txt - large form
|
13
|
+
#
|
14
|
+
# Subclasses of `Lono::Configure::Base` should implement:
|
15
|
+
#
|
16
|
+
# setup: Hook to perform logic at the beginning. Examples:
|
17
|
+
# * Setting instance variables used in the params or variables template methods.
|
18
|
+
# * Creating pre-defined IAM roles required by the template.
|
19
|
+
# params: Template for generated params file. Contents of what gets created at
|
20
|
+
# configs/[blueprint]/params/development/[param].txt
|
21
|
+
# variables: Template for generated variables file. Contents of what gets created at
|
22
|
+
# configs/[blueprint]/variables/development.rb
|
23
|
+
#
|
24
|
+
class Configs < Lono::Configure::Base
|
25
|
+
# Setup hook
|
26
|
+
def setup
|
27
|
+
# Custom setup logic
|
28
|
+
# set_instance_variables
|
29
|
+
end
|
30
|
+
|
31
|
+
# Template for params
|
32
|
+
def params
|
33
|
+
<<~EOL
|
34
|
+
Parameter1=StarterValue1
|
35
|
+
Parameter2=StarterValue1
|
36
|
+
# Optional
|
37
|
+
# Parameter3=OptionalStarterValue1
|
38
|
+
EOL
|
39
|
+
end
|
40
|
+
|
41
|
+
# Template for variables
|
42
|
+
# def variables
|
43
|
+
# <<~EOL
|
44
|
+
# @variable1=starter_value1
|
45
|
+
# @variable2=starter_value2
|
46
|
+
# EOL
|
47
|
+
# end
|
48
|
+
|
49
|
+
private
|
50
|
+
# Example:
|
51
|
+
# def set_instance_variables
|
52
|
+
# @instance_type = "t3.micro"
|
53
|
+
# end
|
54
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Simple Starter Demo Example
|
2
|
+
aws_template_format_version "2010-09-09"
|
3
|
+
description "Demo stack"
|
4
|
+
|
5
|
+
parameter(:instance_type, "t3.micro")
|
6
|
+
|
7
|
+
mapping(:ami_map,
|
8
|
+
"ap-northeast-1": { ami: "ami-0f9ae750e8274075b" },
|
9
|
+
"ap-northeast-2": { ami: "ami-047f7b46bd6dd5d84" },
|
10
|
+
"ap-south-1": { ami: "ami-0889b8a448de4fc44" },
|
11
|
+
"ap-southeast-1": { ami: "ami-0b419c3a4b01d1859" },
|
12
|
+
"ap-southeast-2": { ami: "ami-04481c741a0311bbb" },
|
13
|
+
"ca-central-1": { ami: "ami-03338e1f67dae0168" },
|
14
|
+
"eu-central-1": { ami: "ami-09def150731bdbcc2" },
|
15
|
+
"eu-north-1": { ami: "ami-d16fe6af" },
|
16
|
+
"eu-west-1": { ami: "ami-07683a44e80cd32c5" },
|
17
|
+
"eu-west-2": { ami: "ami-09ead922c1dad67e4" },
|
18
|
+
"eu-west-3": { ami: "ami-0451ae4fd8dd178f7" },
|
19
|
+
"sa-east-1": { ami: "ami-0669a96e355eac82f" },
|
20
|
+
"us-east-1": { ami: "ami-0de53d8956e8dcf80" },
|
21
|
+
"us-east-2": { ami: "ami-02bcbb802e03574ba" },
|
22
|
+
"us-west-1": { ami: "ami-0019ef04ac50be30f" },
|
23
|
+
"us-west-2": { ami: "ami-061392db613a6357b" }
|
24
|
+
)
|
25
|
+
|
26
|
+
resource(:instance, "AWS::EC2::Instance",
|
27
|
+
instance_type: ref(:instance_type),
|
28
|
+
image_id: find_in_map(:ami_map, ref("AWS::Region"), :ami),
|
29
|
+
security_group_ids: [get_att("security_group.group_id")],
|
30
|
+
user_data: base64(user_data("bootstrap.sh"))
|
31
|
+
)
|
32
|
+
resource(:security_group, "AWS::EC2::SecurityGroup",
|
33
|
+
group_description: "demo security group",
|
34
|
+
)
|
35
|
+
|
36
|
+
output(:instance)
|
37
|
+
output(:security_group, get_att("security_group.group_id"))
|
@@ -0,0 +1 @@
|
|
1
|
+
template "<%= blueprint_name %>"
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Lono CloudFormation Starter README
|
2
|
+
|
3
|
+
This folder contains the code that represents your infrastructure built with CloudFormation.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
The CloudFormations templates are generated by a tool called [lono](http://lono.cloud/).
|
8
|
+
|
9
|
+
## Updating the Infrastructure
|
10
|
+
|
11
|
+
The general steps to update the infrastructure:
|
12
|
+
|
13
|
+
1. Add and edit the blueprints
|
14
|
+
2. Generate CloudFormation templates
|
15
|
+
3. Deploy the stack
|
16
|
+
|
17
|
+
Steps 2-3 are automated with lono and performed together with:
|
18
|
+
|
19
|
+
lono cfn deploy STACK_NAME
|
20
|
+
|
21
|
+
Here are some useful flags:
|
22
|
+
|
23
|
+
lono cfn deploy STACK_NAME --iam --sure
|
24
|
+
|
25
|
+
More info: [lono cfn deploy](http://lono.cloud/reference/lono-cfn-deploy/)
|
26
|
+
|
27
|
+
## Structure
|
28
|
+
|
29
|
+
The structure of a lono project looks like this:
|
30
|
+
|
31
|
+
More info: [Project Structure](http://lono.cloud/docs/structure/)
|
32
|
+
|
33
|
+
## Generating Templates from Blueprints
|
34
|
+
|
35
|
+
If you would like to just generate the templates and not update the CloudFormation stack you can do so with:
|
36
|
+
|
37
|
+
lono generate BLUEPRINT_NAME
|
38
|
+
|
39
|
+
## Configs
|
40
|
+
|
41
|
+
You may want to take a look at the configs folder to change params and variables. For example:
|
42
|
+
|
43
|
+
* configs/demo/params
|
44
|
+
* configs/demo/variables
|
45
|
+
|
46
|
+
## Deploy
|
47
|
+
|
48
|
+
To launch the stack:
|
49
|
+
|
50
|
+
lono cfn deploy demo
|
51
|
+
|
52
|
+
## More help
|
53
|
+
|
54
|
+
You can get help by adding `-h` to the end of commands.
|
55
|
+
|
56
|
+
lono cfn update -h
|
57
|
+
|
58
|
+
Help is also provided in the [Lono Docs](http://lono.cloud/docs/).
|