lono 4.2.7 → 5.0.1

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.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/.cody/README.md +6 -0
  3. data/.cody/acceptance.sh +30 -0
  4. data/.cody/buildspec.yml +21 -0
  5. data/.cody/demo.rb +38 -0
  6. data/.cody/project.rb +12 -0
  7. data/.cody/role.rb +1 -0
  8. data/.gitignore +2 -0
  9. data/.gitmodules +6 -3
  10. data/.travis.yml +7 -0
  11. data/CHANGELOG.md +10 -0
  12. data/Gemfile +0 -1
  13. data/LICENSE.txt +1 -22
  14. data/README.md +46 -55
  15. data/lib/lono.rb +20 -27
  16. data/lib/lono/app_file.rb +5 -0
  17. data/lib/lono/app_file/base.rb +19 -0
  18. data/lib/lono/app_file/build.rb +78 -0
  19. data/lib/lono/app_file/registry.rb +14 -0
  20. data/lib/lono/app_file/registry/item.rb +46 -0
  21. data/lib/lono/app_file/upload.rb +39 -0
  22. data/lib/lono/autoloader.rb +22 -0
  23. data/lib/lono/aws_services.rb +46 -0
  24. data/lib/lono/aws_services/util.rb +49 -0
  25. data/lib/lono/blueprint.rb +113 -0
  26. data/lib/lono/blueprint/find.rb +90 -0
  27. data/lib/lono/blueprint/helper.rb +18 -0
  28. data/lib/lono/blueprint/info.rb +10 -0
  29. data/lib/lono/blueprint/list.rb +14 -0
  30. data/lib/lono/blueprint/root.rb +43 -0
  31. data/lib/lono/cfn.rb +31 -19
  32. data/lib/lono/cfn/aws_service.rb +16 -0
  33. data/lib/lono/cfn/base.rb +244 -261
  34. data/lib/lono/cfn/create.rb +36 -32
  35. data/lib/lono/cfn/current.rb +1 -1
  36. data/lib/lono/cfn/delete.rb +2 -2
  37. data/lib/lono/cfn/deploy.rb +11 -0
  38. data/lib/lono/cfn/diff.rb +1 -1
  39. data/lib/lono/cfn/preview.rb +3 -3
  40. data/lib/lono/cfn/rollback.rb +26 -0
  41. data/lib/lono/cfn/status.rb +2 -203
  42. data/lib/lono/cfn/suffix.rb +67 -0
  43. data/lib/lono/cfn/update.rb +61 -53
  44. data/lib/lono/cli.rb +42 -23
  45. data/lib/lono/completer.rb +0 -2
  46. data/lib/lono/configure.rb +37 -0
  47. data/lib/lono/configure/aws_services.rb +18 -0
  48. data/lib/lono/configure/base.rb +94 -0
  49. data/lib/lono/configure/helpers.rb +128 -0
  50. data/lib/lono/conventions.rb +11 -0
  51. data/lib/lono/core.rb +42 -12
  52. data/lib/lono/core/config.rb +5 -4
  53. data/lib/lono/default/settings.yml +0 -11
  54. data/lib/lono/file_uploader.rb +9 -4
  55. data/lib/lono/help.rb +1 -2
  56. data/lib/lono/help/blueprint.md +46 -0
  57. data/lib/lono/help/cfn.md +5 -4
  58. data/lib/lono/help/cfn/create.md +14 -9
  59. data/lib/lono/help/cfn/deploy.md +92 -0
  60. data/lib/lono/help/cfn/diff.md +0 -1
  61. data/lib/lono/help/cfn/update.md +16 -15
  62. data/lib/lono/help/completion.md +3 -3
  63. data/lib/lono/help/generate.md +0 -1
  64. data/lib/lono/help/new.md +40 -34
  65. data/lib/lono/help/param.md +1 -1
  66. data/lib/lono/help/param/generate.md +1 -1
  67. data/lib/lono/help/template.md +2 -2
  68. data/lib/lono/help/xgraph.md +1 -1
  69. data/lib/lono/inspector.rb +1 -1
  70. data/lib/lono/inspector/base.rb +26 -10
  71. data/lib/lono/inspector/graph.rb +7 -3
  72. data/lib/lono/inspector/summary.rb +15 -3
  73. data/lib/lono/md5.rb +46 -0
  74. data/lib/lono/new.rb +40 -28
  75. data/lib/lono/new/helper.rb +2 -3
  76. data/lib/lono/param.rb +12 -11
  77. data/lib/lono/param/generator.rb +96 -42
  78. data/lib/lono/project_checker.rb +27 -8
  79. data/lib/lono/s3.rb +23 -0
  80. data/lib/lono/s3/bucket.rb +123 -0
  81. data/lib/lono/script.rb +4 -8
  82. data/lib/lono/script/base.rb +7 -2
  83. data/lib/lono/script/build.rb +7 -8
  84. data/lib/lono/script/upload.rb +4 -20
  85. data/lib/lono/sequence.rb +19 -16
  86. data/lib/lono/setting.rb +19 -27
  87. data/lib/lono/template.rb +22 -26
  88. data/lib/lono/template/base.rb +13 -0
  89. data/lib/lono/template/context.rb +4 -56
  90. data/lib/lono/template/context/loader.rb +70 -0
  91. data/lib/lono/template/dsl.rb +15 -151
  92. data/lib/lono/template/dsl/builder.rb +60 -0
  93. data/lib/lono/template/dsl/builder/base.rb +14 -0
  94. data/lib/lono/template/dsl/builder/condition.rb +26 -0
  95. data/lib/lono/template/dsl/builder/fn.rb +114 -0
  96. data/lib/lono/template/dsl/builder/helper.rb +64 -0
  97. data/lib/lono/template/dsl/builder/mapping.rb +24 -0
  98. data/lib/lono/template/dsl/builder/output.rb +37 -0
  99. data/lib/lono/template/dsl/builder/parameter.rb +39 -0
  100. data/lib/lono/template/dsl/builder/resource.rb +38 -0
  101. data/lib/lono/template/dsl/builder/section.rb +12 -0
  102. data/lib/lono/template/dsl/builder/syntax.rb +58 -0
  103. data/lib/lono/template/erb.rb +82 -0
  104. data/lib/lono/template/evaluate.rb +39 -0
  105. data/lib/lono/template/generator.rb +29 -0
  106. data/lib/lono/template/helper.rb +7 -29
  107. data/lib/lono/template/post_processor.rb +69 -0
  108. data/lib/lono/template/template.rb +4 -9
  109. data/lib/lono/template/upload.rb +103 -133
  110. data/lib/lono/template/util.rb +48 -0
  111. data/lib/lono/upgrade.rb +5 -3
  112. data/lib/lono/upgrade/upgrade5.rb +55 -0
  113. data/lib/lono/user_data.rb +4 -4
  114. data/lib/lono/version.rb +1 -1
  115. data/lib/templates/blueprint/%blueprint_name%.gemspec.tt +44 -0
  116. data/lib/templates/blueprint/.gitignore +14 -0
  117. data/lib/templates/blueprint/.lono/config.yml.tt +3 -0
  118. data/lib/templates/blueprint/.meta/config.yml.tt +3 -0
  119. data/lib/templates/blueprint/CHANGELOG.md +7 -0
  120. data/lib/templates/blueprint/Gemfile +4 -0
  121. data/lib/templates/blueprint/README.md +37 -0
  122. data/lib/templates/blueprint/Rakefile +6 -0
  123. data/lib/templates/blueprint/setup/configs.rb +54 -0
  124. data/lib/templates/blueprint_configs/configs/%blueprint_name%/params/base.txt +2 -0
  125. data/lib/{starter_projects/skeleton/app/definitions/base.rb → templates/blueprint_configs/configs/%blueprint_name%/params/development.txt} +0 -0
  126. data/lib/templates/blueprint_configs/configs/%blueprint_name%/variables/base.rb +2 -0
  127. data/lib/templates/blueprint_configs/configs/%blueprint_name%/variables/development.rb +0 -0
  128. data/lib/templates/blueprint_types/dsl/app/templates/%blueprint_name%.rb +37 -0
  129. data/lib/templates/blueprint_types/dsl/app/user_data/bootstrap.sh +2 -0
  130. data/lib/templates/blueprint_types/erb/app/definitions/base.rb.tt +1 -0
  131. data/lib/templates/blueprint_types/erb/app/templates/%blueprint_name%.yml +8 -0
  132. data/lib/{starter_projects/autoscaling → templates/skeleton}/.gitignore +1 -0
  133. data/lib/templates/skeleton/Gemfile +3 -0
  134. data/lib/{starter_projects/autoscaling → templates/skeleton}/Guardfile +2 -2
  135. data/lib/templates/skeleton/README.md +58 -0
  136. data/lib/templates/skeleton/configs/settings.yml +17 -0
  137. data/lib/templates/upgrade5/blueprints/main/.lono/config.yml +3 -0
  138. data/lib/templates/upgrade5/blueprints/main/.meta/config.yml +3 -0
  139. data/lono.gemspec +12 -8
  140. data/vendor/cfn-status/CHANGELOG.md +10 -0
  141. data/vendor/cfn-status/Gemfile +4 -0
  142. data/vendor/cfn-status/LICENSE.txt +21 -0
  143. data/vendor/cfn-status/README.md +56 -0
  144. data/vendor/cfn-status/Rakefile +6 -0
  145. data/vendor/cfn-status/bin/console +14 -0
  146. data/vendor/cfn-status/bin/setup +8 -0
  147. data/vendor/cfn-status/cfn-status.gemspec +30 -0
  148. data/vendor/cfn-status/lib/cfn-status.rb +1 -0
  149. data/vendor/cfn-status/lib/cfn/aws_service.rb +51 -0
  150. data/vendor/cfn-status/lib/cfn/status.rb +219 -0
  151. data/vendor/cfn-status/lib/cfn/status/version.rb +5 -0
  152. data/vendor/cfn-status/spec/cfn/status_spec.rb +81 -0
  153. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +1080 -0
  154. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
  155. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
  156. data/vendor/cfn-status/spec/spec_helper.rb +14 -0
  157. data/vendor/cfn_camelizer/CHANGELOG.md +20 -0
  158. data/vendor/cfn_camelizer/Gemfile +4 -0
  159. data/vendor/cfn_camelizer/LICENSE.txt +21 -0
  160. data/vendor/cfn_camelizer/README.md +40 -0
  161. data/vendor/cfn_camelizer/Rakefile +6 -0
  162. data/vendor/cfn_camelizer/bin/console +14 -0
  163. data/vendor/cfn_camelizer/bin/setup +8 -0
  164. data/vendor/cfn_camelizer/cfn_camelizer.gemspec +32 -0
  165. data/vendor/cfn_camelizer/lib/camelizer.yml +37 -0
  166. data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +94 -0
  167. data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +3 -0
  168. data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +86 -0
  169. data/vendor/cfn_camelizer/spec/spec_helper.rb +14 -0
  170. metadata +189 -62
  171. data/.circleci/bin/commit_docs.sh +0 -26
  172. data/.circleci/config.yml +0 -72
  173. data/bin/release +0 -9
  174. data/lib/lono/help/import.md +0 -54
  175. data/lib/lono/importer.rb +0 -134
  176. data/lib/lono/new/message.rb +0 -35
  177. data/lib/starter_projects/autoscaling/Gemfile +0 -3
  178. data/lib/starter_projects/autoscaling/README.md +0 -118
  179. data/lib/starter_projects/autoscaling/app/definitions/base.rb +0 -2
  180. data/lib/starter_projects/autoscaling/app/templates/autoscaling.yml +0 -682
  181. data/lib/starter_projects/autoscaling/config/params/base/autoscaling.txt +0 -6
  182. data/lib/starter_projects/autoscaling/config/settings.yml +0 -33
  183. data/lib/starter_projects/ec2/.gitignore +0 -2
  184. data/lib/starter_projects/ec2/Gemfile +0 -3
  185. data/lib/starter_projects/ec2/Guardfile +0 -12
  186. data/lib/starter_projects/ec2/README.md +0 -86
  187. data/lib/starter_projects/ec2/app/definitions/base.rb +0 -2
  188. data/lib/starter_projects/ec2/app/definitions/development.rb +0 -1
  189. data/lib/starter_projects/ec2/app/definitions/production.rb +0 -1
  190. data/lib/starter_projects/ec2/app/helpers/my_custom_helper.rb +0 -17
  191. data/lib/starter_projects/ec2/app/partials/user_data/bootstrap.sh +0 -4
  192. data/lib/starter_projects/ec2/app/templates/example.yml +0 -430
  193. data/lib/starter_projects/ec2/config/params/base/example.txt +0 -2
  194. data/lib/starter_projects/ec2/config/params/development/example.txt +0 -3
  195. data/lib/starter_projects/ec2/config/params/production/example.txt +0 -2
  196. data/lib/starter_projects/ec2/config/settings.yml +0 -33
  197. data/lib/starter_projects/ec2/config/variables/base.rb +0 -3
  198. data/lib/starter_projects/ec2/config/variables/development.rb +0 -2
  199. data/lib/starter_projects/ec2/config/variables/production.rb +0 -2
  200. data/lib/starter_projects/ec2/welcome.txt +0 -8
  201. data/lib/starter_projects/skeleton/.gitignore +0 -2
  202. data/lib/starter_projects/skeleton/Gemfile +0 -3
  203. data/lib/starter_projects/skeleton/Guardfile +0 -12
  204. data/lib/starter_projects/skeleton/README.md +0 -53
  205. data/lib/starter_projects/skeleton/config/settings.yml +0 -33
  206. data/lib/starter_projects/skeleton/welcome.txt +0 -7
  207. data/vendor/plissken/Gemfile +0 -14
  208. data/vendor/plissken/LICENSE.txt +0 -20
  209. data/vendor/plissken/README.md +0 -46
  210. data/vendor/plissken/Rakefile +0 -56
  211. data/vendor/plissken/VERSION +0 -1
  212. data/vendor/plissken/lib/plissken.rb +0 -1
  213. data/vendor/plissken/lib/plissken/ext/hash/to_snake_keys.rb +0 -45
  214. data/vendor/plissken/plissken.gemspec +0 -61
  215. data/vendor/plissken/spec/lib/to_snake_keys_spec.rb +0 -177
  216. data/vendor/plissken/spec/spec_helper.rb +0 -90
  217. data/vendor/plissken/test/helper.rb +0 -20
  218. data/vendor/plissken/test/plissken/ext/hash/to_snake_keys_test.rb +0 -184
  219. 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
@@ -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
@@ -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::DSL#run method generates the CloudFormation templates
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
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "4.2.7"
2
+ VERSION = "5.0.1"
3
3
  end
@@ -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,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ output
14
+ Gemfile.lock
@@ -0,0 +1,3 @@
1
+ ---
2
+ blueprint_name: <%= blueprint_name %>
3
+ template_type: dsl
@@ -0,0 +1,3 @@
1
+ ---
2
+ blueprint_name: <%= blueprint_name %>
3
+ template_type: dsl
@@ -0,0 +1,7 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
+
6
+ ## [0.1.0]
7
+ - Initial release
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ecs-asg.gemspec
4
+ gemspec
@@ -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,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ task default: :spec
5
+
6
+ RSpec::Core::RakeTask.new
@@ -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
@@ -0,0 +1,2 @@
1
+ # Starter Example
2
+ # InstanceType=t3.micro
@@ -0,0 +1,2 @@
1
+ # Starter Example
2
+ # @variable = "value"
@@ -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,2 @@
1
+ #!/bin/bash
2
+ echo "hello world"
@@ -0,0 +1 @@
1
+ template "<%= blueprint_name %>"
@@ -0,0 +1,8 @@
1
+ ---
2
+ # Simple Starter Example
3
+ Resources:
4
+ EC2Instance:
5
+ Type: AWS::EC2::Instance
6
+ Properties:
7
+ InstanceType: t3.micro
8
+ ImageId: ami-05b186cbeb4bd0170 # us-west-2 Amazon Linux 2 AMI (HVM), SSD Volume Type
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ # gem "lono-pro", git: "git@github.com:boltopspro/lono-pro.git" # optional
@@ -2,8 +2,8 @@
2
2
  # More info at https://github.com/guard/guard#readme
3
3
 
4
4
  guard "lono" do
5
- watch(%r{^config/lono.rb$})
6
- watch(%r{^templates/.*$})
5
+ watch(%r{^blueprints/.*$})
6
+ watch(%r{^configs/.*$})
7
7
  end
8
8
 
9
9
  # Commented out due to CF rate limiting
@@ -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/).