lono 4.2.7 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
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,11 @@
1
+ module Lono
2
+ module Conventions
3
+ # Think can make this a module, but need to figure out how it fits with lono cfn
4
+ def template_param_convention(options)
5
+ options = options.deep_symbolize_keys
6
+ template = options[:template] || @blueprint
7
+ param = options[:param] || template || @blueprint
8
+ [template, param]
9
+ end
10
+ end
11
+ end
@@ -3,26 +3,42 @@ require 'pathname'
3
3
  module Lono
4
4
  module Core
5
5
  extend Memoist
6
- autoload :Config, 'lono/core/config'
7
6
 
8
7
  def config
9
8
  Config.new
10
9
  end
11
10
  memoize :config
12
11
 
12
+ @@root = nil
13
13
  def root
14
- path = ENV['LONO_ROOT'] || '.'
14
+ path = @@root || ENV['LONO_ROOT'] || Dir.pwd
15
15
  Pathname.new(path)
16
16
  end
17
17
  memoize :root
18
18
 
19
+ @@blueprint_root = nil
20
+ def blueprint_root; @@blueprint_root ; end
21
+ def blueprint_root=(v) ; @@blueprint_root = v ; end
22
+
19
23
  def env
20
- ufo_env = env_from_profile(ENV['AWS_PROFILE']) || 'development'
21
- ufo_env = ENV['LONO_ENV'] if ENV['LONO_ENV'] # highest precedence
22
- ufo_env
24
+ # 2-way binding
25
+ env = env_from_profile(ENV['AWS_PROFILE']) || 'development'
26
+ env = ENV['LONO_ENV'] if ENV['LONO_ENV'] # highest precedence
27
+ env
23
28
  end
24
29
  memoize :env
25
30
 
31
+ # Overrides AWS_PROFILE based on the Lono.env if set in configs/settings.yml
32
+ # 2-way binding.
33
+ def set_aws_profile!
34
+ return unless settings # Only load if within lono project and there's a settings.yml
35
+ data = settings[Lono.env] || {}
36
+ if data["aws_profile"]
37
+ # puts "Using AWS_PROFILE=#{data["aws_profile"]} from LONO_ENV=#{Lono.env} in configs/settings.yml"
38
+ ENV['AWS_PROFILE'] = data["aws_profile"]
39
+ end
40
+ end
41
+
26
42
  # Precedence (highest to lowest)
27
43
  # 1. LONO_SUFFIX
28
44
  # 2. .current/lono
@@ -40,15 +56,29 @@ module Lono
40
56
  end
41
57
  memoize :suffix
42
58
 
43
- private
44
- # Do not use the Setting class to load the profile because it can cause an
59
+ # Do not use the Setting#data to load the profile because it can cause an
45
60
  # infinite loop then if we decide to use Lono.env from within settings class.
61
+ def settings
62
+ setting = Setting.new(false) # check_lono_project to account for `lono new`
63
+ settings_path = setting.lookup_project_settings_path
64
+ return unless settings_path # in case outside of lono project
65
+
66
+ YAML.load_file(settings_path)
67
+ end
68
+ memoize :settings
69
+
70
+ def pro_version
71
+ installed = Gem::Specification.detect { |spec| spec.name == 'lono-pro' }
72
+ installed ? Lono::Pro::VERSION : "not installed"
73
+ end
74
+
75
+ private
46
76
  def env_from_profile(aws_profile)
47
- data = YAML.load_file("#{Lono.root}/config/settings.yml")
48
- env = data.find do |_env, setting|
49
- setting ||= {}
50
- profiles = setting['aws_profiles']
51
- profiles && profiles.include?(aws_profile)
77
+ return unless settings
78
+ env = settings.find do |_env, settings|
79
+ settings ||= {}
80
+ profiles = settings['aws_profile']
81
+ profiles && profiles == aws_profile
52
82
  end
53
83
  env.first if env
54
84
  end
@@ -7,14 +7,15 @@ module Lono::Core
7
7
  scripts_path: "app/scripts",
8
8
  templates_path: "app/templates",
9
9
  user_data_path: "app/user_data",
10
- params_path: "config/params",
11
- variables_path: "config/variables",
12
- output_path: "output",
13
10
  }
14
11
  PATHS.each do |meth, path|
15
12
  define_method meth do
16
- "#{Lono.root}/#{path}"
13
+ "#{Lono.blueprint_root}/#{path}"
17
14
  end
18
15
  end
16
+
17
+ def output_path
18
+ "#{Lono.root}/output"
19
+ end
19
20
  end
20
21
  end
@@ -7,19 +7,8 @@ base:
7
7
  # extract_scripts:
8
8
  # to: "/opt"
9
9
  # as: "ec2-user"
10
- # If s3_folder is set then the generated templates and app/scripts will automatically
11
- # be uploaded to s3.
12
- # There are 2 formats for s3_folder:
13
- # Format 1:
14
- # s3_folder: mybucket/path/to/folder # simple string
15
- # Format 2:
16
- # s3_folder: # Hash options in order to support multiple AWS_PROFILEs
17
- # default: mybucket/folder
18
- # aws_profile1: mybucket/folder
19
- # aws_profile2: another-bucket/storage/folder
20
10
  # stack_name_suffix: random # tack on a 3 char random string at the end of the stack name for lono cfn create
21
11
 
22
-
23
12
  development:
24
13
  # When you have AWS_PROFILE set to one of these values, lono will switch to the desired
25
14
  # environment. This prevents you from switching AWS_PROFILE, forgetting to
@@ -3,17 +3,17 @@ module Lono
3
3
  include Lono::Template::AwsService
4
4
  extend Memoist
5
5
 
6
- def initialize(options={})
7
- @options = options
6
+ def initialize(blueprint, options={})
7
+ @blueprint, @options = blueprint, options
8
8
  @checksums = {}
9
- @prefix = "#{folder_key}/#{Lono.env}/files" # s3://s3-bucket/folder/development/files
9
+ @prefix = "#{folder_key}/#{Lono.env}/#{blueprint}/files" # s3://s3-bucket/folder/development/files
10
10
  end
11
11
 
12
12
  def upload_all
13
13
  puts "Uploading app/files..."
14
14
  load_checksums!
15
15
 
16
- pattern = "#{Lono.root}/app/files/**/*"
16
+ pattern = "#{Lono.blueprint_root}/app/files/**/*"
17
17
  Dir.glob(pattern).each do |path|
18
18
  next if ::File.directory?(path)
19
19
  s3_upload(path)
@@ -50,7 +50,12 @@ module Lono
50
50
  "#{key}-#{md5}.#{ext}"
51
51
  end
52
52
 
53
+ # Inputs:
54
+ #
55
+ # path: can be full path or relative path
56
+ #
53
57
  def s3_upload(path)
58
+ path = path.gsub("#{Lono.root}/",'') # remove Lono.root
54
59
  pretty_path = path.sub(/^\.\//, '')
55
60
  key = md5_key(path)
56
61
  s3_full_path = "s3://#{s3_bucket}/#{key}"
@@ -1,7 +1,6 @@
1
1
  module Lono::Help
2
2
  class << self
3
- # namespaced_command: cfn/create or cfn:create
4
- # both work.
3
+ # namespaced_command: cfn/create or cfn:create both work.
5
4
  def text(namespaced_command)
6
5
  path = namespaced_command.to_s.gsub(':','/')
7
6
  path = File.expand_path("../help/#{path}.md", __FILE__)
@@ -0,0 +1,46 @@
1
+ ## Examples
2
+
3
+ lono blueprint ec2 # skeleton blueprint with barebones structure
4
+
5
+ ## Example Output
6
+
7
+ $ lono blueprint ec2
8
+ => Creating new blueprint called ec2.
9
+ create ec2
10
+ create ec2/ec2.gemspec
11
+ create ec2/.gitignore
12
+ create ec2/Gemfile
13
+ create ec2/README.md
14
+ create ec2/app/definitions/base.rb
15
+ create ec2/setup/configs.rb
16
+ create ec2/app/templates
17
+ => Initialize git repo
18
+ run git init from "."
19
+ Initialized empty Git repository in /home/ec2-user/environment/boltopspro/blueprints/ec2/.git/
20
+ => Installing dependencies with: bundle install
21
+ ================================================================
22
+ Congrats You have successfully created a lono blueprint.
23
+
24
+ Cd into your blueprint and check things out.
25
+
26
+ cd ec2
27
+
28
+ More info: https://lono.cloud/docs/core/blueprints
29
+
30
+ Here's the structure your blueprint:
31
+
32
+ .
33
+ ├── app
34
+ │ ├── definitions
35
+ │ │ └── base.rb
36
+ │ └── templates
37
+ ├── ec2.gemspec
38
+ ├── Gemfile
39
+ ├── Gemfile.lock
40
+ ├── README.md
41
+ └── setup
42
+ └── configs.rb
43
+
44
+ 4 directories, 6 files
45
+
46
+ $
@@ -1,6 +1,7 @@
1
1
  ## Examples
2
2
 
3
- lono cfn create my-stack
4
- lono cfn preview my-stack
5
- lono cfn update my-stack
6
- lono cfn delete my-stack
3
+ lono cfn deploy demo
4
+ lono cfn create demo
5
+ lono cfn preview demo
6
+ lono cfn update demo
7
+ lono cfn delete demo
@@ -1,21 +1,26 @@
1
1
  ## Examples
2
2
 
3
- Provided that you are in a lono project and have a `my-stack` lono template definition. To create a stack you can run:
3
+ Provided that you are in a lono project and have a `demo` lono blueprint that contains a `demo` template. To create a stack you can run:
4
4
 
5
- lono cfn create my-stack
5
+ lono cfn create demo
6
6
 
7
- The above command will generate and use the template in `output/templates/my-stack.json` and parameters in `output/params/my-stack.txt`. By [convention]({% link _docs/conventions.md %}), the template defaults to the name of the stack. In turn, the params defaults to the name of the template.
7
+ The above command will generate:
8
+
9
+ * template: output/demo/templates/demo.yml
10
+ * parameters: output/demo/params/development.json
11
+
12
+ By [convention]({% link _docs/conventions/cli.md %}), the blueprint name is the same as the stack name. In turn, template name is the same as the blueprint name. Lastly, the param name will default to the template name.
8
13
 
9
14
  Here are examples of overriding the template and params name conventions.
10
15
 
11
- lono cfn create my-stack --template different1
16
+ lono cfn create demo --template different1
12
17
 
13
- The template used is `output/templates/different1.json` and the parameters used is `output/params/different1.json`.
18
+ The template used is `app/templates/different1.rb` and the parameters used is `configs/demo/params/development/demo/different1.txt`.
14
19
 
15
- lono cfn create my-stack --param different2
20
+ lono cfn create demo --param different2
16
21
 
17
- The template used is `output/templates/my-stack.json` and the parameters used is `output/params/different2.json`.
22
+ The template used is `app/templates/demo.rb` and the parameters used is `configs/demo/params/development/demo/different2.json`.
18
23
 
19
- lono cfn create my-stack --template different3 --param different4
24
+ lono cfn create demo --template different3 --param different4
20
25
 
21
- The template used is `output/templates/different3.json` and the parameters used is `output/params/different4.json`.
26
+ The template used is `app/templates/different3.rb` and the parameters used is `configs/demo/params/different3/different4.json`.
@@ -0,0 +1,92 @@
1
+ The `cfn deploy` command figures out whether or not it should perform a stack create or update. It delegates to `cfn create` or `cfn update`. This saves you from thinking about it
2
+
3
+ # Examples
4
+
5
+ Provided that you are in a lono project and have a `demo` lono blueprint that contains a `demo` template. To create a stack you can run:
6
+
7
+ lono cfn deploy demo
8
+
9
+ The above command will generate:
10
+
11
+ * template: output/demo/templates/demo.yml
12
+ * parameters: output/demo/params/development.json
13
+
14
+ By [convention]({% link _docs/conventions/cli.md %}), the blueprint name is the same as the stack name. In turn, template name is the same as the blueprint name. Lastly, the param name will default to the template name. Some examples follow to help explain.
15
+
16
+ ## Convention: Stack, Blueprint, Template and Parameter are All the Same
17
+
18
+ Let's say you have a blueprint in `blueprints/demo` with a structure the looks something like this:
19
+
20
+ .
21
+ ├── blueprints
22
+ │ └── demo
23
+ │ └── app
24
+ │ └── templates
25
+ │ ├── demo.rb
26
+ │ └── ec2.rb
27
+ └── configs
28
+ └── demo
29
+ └── params
30
+ ├── base.txt
31
+ └── development.txt
32
+
33
+ The command:
34
+
35
+ lono cfn deploy demo
36
+
37
+ Will use:
38
+
39
+ * blueprint: blueprints/demo
40
+ * template: blueprints/demo/app/templates/demo.rb
41
+ * param: configs/demo/params/development.txt
42
+
43
+ ## Stack and Blueprint Do Not Match But Everything Else Does
44
+
45
+ This is a common case, where the stack name is different from the blueprint name.
46
+
47
+ lono cfn deploy my-demo --blueprint demo
48
+
49
+ The stack will be called my-demo and the blueprint is `demo`. Since by convention, templates default to the blueprint name we're pretty much set. Lono will use:
50
+
51
+ * blueprint: blueprints/demo
52
+ * template: blueprints/demo/app/templates/demo.rb
53
+ * param: configs/demo/params/development.txt
54
+
55
+ Everything is the same as when the stack name matches the blueprint name.
56
+
57
+ ## Blueprint and Template Name Do Not Match, But Template and Param Name Matches
58
+
59
+ lono cfn deploy my-demo --blueprint demo --template ec2
60
+
61
+ In this case we are using the ec2 template within the demo blueprint. We'll add another param file `configs/demo/params/ec2.txt`
62
+
63
+ └── configs
64
+ └── demo
65
+ └── params
66
+ └── ec2.txt
67
+
68
+ Lono will use these files:
69
+
70
+ * blueprint: blueprints/demo
71
+ * template: blueprints/demo/app/templates/ec2.rb
72
+ * param: configs/demo/params/ec2.txt
73
+
74
+ ## Template Name and Param Name Do Not Match
75
+
76
+ The form with most control is the one with all options explicitly specified.
77
+
78
+ lono cfn deploy my-demo --blueprint demo --template ec2 --param large
79
+
80
+ We'll add another parameter file here: `configs/demo/params/ec2/large.txt`
81
+
82
+ └── configs
83
+ └── demo
84
+ └── params
85
+ └── ec2
86
+ └── large.txt
87
+
88
+ Lono will use these files:
89
+
90
+ * blueprint: blueprints/demo
91
+ * template: blueprints/demo/app/templates/ec2.rb
92
+ * param: configs/demo/params/ec2/large.txt
@@ -15,7 +15,6 @@ Displays code diff of the generated CloudFormation template locally vs the exist
15
15
  < Default: t2.small
16
16
  ---
17
17
  > Default: t2.medium
18
- $ subl -a ~/.lono/settings.yml
19
18
  $
20
19
 
21
20
  Here's a screenshot of the output with the colored diff:
@@ -2,9 +2,7 @@
2
2
 
3
3
  Let's say we make a simple change to a template, like changing the default InstanceType from `t2.small` to `t2.micro`. Here's what happens when you run `lono cfn update`
4
4
 
5
- ```sh
6
- lono cfn update ec2
7
- ```
5
+ lono cfn update ec2
8
6
 
9
7
  The output should look similiar to this:
10
8
 
@@ -19,30 +17,33 @@ You are prompted with an "Are you sure?" confirmation before lono continues.
19
17
 
20
18
  By default, the update command will display a preview of the stack changes before applying the update and prompt to check if you are sure. If you want to bypass the are you sure prompt, use the `--sure` option.
21
19
 
22
- ```
23
- lono cfn update ec2 --sure
24
- ```
20
+ lono cfn update ec2 --sure
25
21
 
26
22
  ## Conventions: template and param
27
23
 
28
24
  Lono follows some [coventions](http://lono.cloud/docs/conventions/) that helps keep the commands short. We'll go through an example to explain:
29
25
 
30
- Provided that you are in a lono project and have a `my-stack` lono template definition. To update a stack you can simply run:
26
+ Provided that you are in a lono project and have a `demo` lono blueprint that contains a `demo` template. To update a stack you can run:
31
27
 
32
- lono cfn update my-stack
28
+ lono cfn update demo
33
29
 
34
- The above command will generate and use the template in `output/templates/my-stack.json` and parameters in `output/params/my-stack.txt`. The template by convention defaults to the name of the stack. In turn, the params by convention defaults to the name of the template.
30
+ The above command will generate:
31
+
32
+ * template: output/demo/templates/demo.yml
33
+ * parameters: output/demo/params/development.json
34
+
35
+ By [convention]({% link _docs/conventions/cli.md %}), the blueprint name is the same as the stack name. In turn, template name is the same as the blueprint name. Lastly, the param name will default to the template name.
35
36
 
36
37
  Here are examples of overriding the template and params name conventions.
37
38
 
38
- lono cfn update my-stack --template different1
39
+ lono cfn update demo --template different1
39
40
 
40
- The template used is `output/templates/different1.json` and the parameters used is `output/params/different1.json`.
41
+ The template used is `app/templates/different1.rb` and the parameters used is `configs/demo/params/development/demo/different1.txt`.
41
42
 
42
- lono cfn update my-stack --param different2
43
+ lono cfn update demo --param different2
43
44
 
44
- The template used is `output/templates/my-stack.json` and the parameters used is `output/params/different2.json`.
45
+ The template used is `app/templates/demo.rb` and the parameters used is `configs/demo/params/development/demo/different2.json`.
45
46
 
46
- lono cfn update my-stack --template different3 --param different4
47
+ lono cfn update demo --template different3 --param different4
47
48
 
48
- The template used is `output/templates/different3.json` and the parameters used is `output/params/different4.json`.
49
+ The template used is `app/templates/different3.rb` and the parameters used is `configs/demo/params/different3/different4.json`.
@@ -8,7 +8,7 @@ Prints words for TAB auto-completion.
8
8
 
9
9
  lono completion
10
10
  lono completion cfn
11
- lono completion cfn create
11
+ lono completion cfn deploy
12
12
 
13
13
  To enable, TAB auto-completion add the following to your profile:
14
14
 
@@ -18,5 +18,5 @@ Auto-completion example usage:
18
18
 
19
19
  lono [TAB]
20
20
  lono cfn [TAB]
21
- lono cfn create [TAB]
22
- lono cfn create --[TAB]
21
+ lono cfn deploy [TAB]
22
+ lono cfn deploy --[TAB]