cloudspin-stack 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a77954b28811b4e70c3b68e38ec4aa222da97576
4
- data.tar.gz: 7d2e8ff6082d11293d69bf87890701c0da1b02c6
3
+ metadata.gz: 0e7bef5adc2239f0f03b92de64f81790bbfaf2b7
4
+ data.tar.gz: e7d0aeb6042c40c76412f944c8742f5960a4b023
5
5
  SHA512:
6
- metadata.gz: 0d21bea647d8da42838070efa33d2ff2462f386c71b3d554e22485accc48ddc943436e1a615eab549e27a1244120340542b470d8c1b3f3d9720626aad154e062
7
- data.tar.gz: d794ab498fcdb482ad0013ae5f0a0730a27e5828117c161a8f9bfc8771720124096fbece73d4fe15cc26ece1eb69fd9c1543b520059e91ffff07a0d2ca5556f9
6
+ metadata.gz: ce1a12b0f4fcf245340c9b64fcde15450e2239a045904c61a0c157e60faa2e246b3c7b693212ced3784f1b4125bc5ead74bf879e1b357721bf687632dfabb2b9
7
+ data.tar.gz: 2800664544aad1ae5980e0413d5cfaea31fe581f697aab9fe2ab1fbe9e7f6e5e6a00646e1b72f0fcd886e79c7dcc5e518470cdeb79cdb603710dceb3fbf91b48
data/README.md CHANGED
@@ -1,8 +1,55 @@
1
1
  # Cloudspin::Stack
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/cloudspin/stack`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ This Ruby library is a prototype for an infrastructure project delivery framework. It is intended as a basis for exploring project structures, conventions, and functionality, but is not currently in a stable state.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Feel free to copy and use this, but be prepared to extend and modify it in order to make it useful for your own project. There isn't likely to be a clean path to upgrade your projects as this thing evolves - my assumption is that nobody else is directly depending on this code or the gems I've published from it.
6
+
7
+
8
+ ## What's here
9
+
10
+ This project creates a ruby gem, which has some classes that can be used to manage instances of infrastructure stacks. These classes can be called used in rspec-based tests. There is also a command line tool included in the gem (`stack`), which can be used to manage stack instances.
11
+
12
+ A separate gem, [cloudspin-stack-rake](https://github.com/cloudspinners/cloudspin-stack-rake), can be used to create rake tasks that use the classes here to manage stacks.
13
+
14
+ The classes and tools in this gem are meant to be primitives. They shouldn't dictate details of how to organise and configure infrastructure and environments, although I've designed them to support patterns that I have in mind, so it's possible some of this has leaked into them.
15
+
16
+
17
+ ## Examples
18
+
19
+ I'm using [spin-stack-network](https://github.com/cloudspinners/spin-stack-network) as an example of an infrastructure stack project to make use of this framework. I may add other projects in the future as the tool is developed.
20
+
21
+
22
+ # Concepts
23
+
24
+ ## What's the point of this?
25
+
26
+ Currently, most people and teams managing infrastructure with tools such as Terraform, CloudFormation, etc. define their own project structures, and write their own wrapper scripts to run that tool and associated tasks. Essentially, each project is a unique snowflake.
27
+
28
+ The goal for cloudspin is to evolve a common structure and build tooling for infrastructure projects, focused on the lifecycle of "[stacks](http://infrastructure-as-code.com/patterns/2018/03/28/defining-stacks.html)" - infrastructure elements provisioned on dynamic infrastructure such as IaaS clouds.
29
+
30
+ Our hypothesis is that, with a common project structure and tooling:
31
+
32
+ - Teams will spend less time building and maintaining snowflake build systems,
33
+ - New team members can more quickly get up to speed when joining an infrastructure project,
34
+ - People can create and share tools and scripts that work with the common structure, creating an ecosystem,
35
+ - People can create and share infrastructure code for running various software and services, creating a community library.
36
+
37
+
38
+ ## Philosophy
39
+
40
+ - [Convention over configuration](https://en.wikipedia.org/wiki/Convention_over_configuration).
41
+ -- The tool should discover elements of the project based on folder structure
42
+ -- A given configuration value should be set in a single place
43
+ -- Implies a highly "[opinionated](https://medium.com/@stueccles/the-rise-of-opinionated-software-ca1ba0140d5b)" approach
44
+ - Encourage good agile engineering practices for the infrastructure code
45
+ -- Writing and running tests should be a natural thing
46
+ -- Building and using [infrastructure pipelines](http://infrastructure-as-code.com/book/2017/08/02/environment-pipeline.html) should be a natural thing
47
+ - Support evolutionary architecture
48
+ -- Loose coupling of infrastructure elements
49
+ - Empower developers / users of infrastructure
50
+
51
+
52
+ # Instructions
6
53
 
7
54
  ## Installation
8
55
 
@@ -20,11 +67,64 @@ Or install it yourself as:
20
67
 
21
68
  $ gem install cloudspin-stack
22
69
 
23
- ## Usage
24
70
 
25
- TODO: Write usage instructions here
71
+ ## Documentation
72
+
73
+
74
+ ### Stack Definition
75
+
76
+ A *stack definition* is a single infrastructure code project, i.e. a Terraform project (but could be implemented for CloudFormation, ARM, or other tools in the future).
77
+
78
+ ### Stack Instance
79
+
80
+ A *stack instance* is an instance of the stack running on your infrastructure platform (I have used it for AWS so far, but it should work for other cloud platforms without much modification).
81
+
82
+ Operations on the stack include:
83
+
84
+ - up: create or update an instance of the stack, from a defintion
85
+ - down: destroy an instance of the stack
26
86
 
27
- ## Development
87
+ Each of these operations can be *planned*, which prints the changes that will be applied, without actually applying them.
88
+
89
+
90
+ ## Usage: Ruby API
91
+
92
+ TODO: Write stuff.
93
+
94
+
95
+ ## Usage: Command line tool
96
+
97
+ Create or update an instance of the stack defined in `TERRAFORM_FOLDER`, using the identifier `STACKNAME` to distinguish it from other instances of the stack:
98
+
99
+ ```bash
100
+ stack up STACKNAME -t TERRAFORM_FOLDER
101
+ ```
102
+
103
+ Destroy the stack instance:
104
+
105
+ ```bash
106
+ stack down STACKNAME -t TERRAFORM_FOLDER
107
+ ```
108
+
109
+ Each of these commands can take the `--dry` and/or `--plan` argument.
110
+
111
+ `--dry` prints out the terraform command to be run, but doesn't do anything. So this doesn't even need AWS credentials to work.
112
+
113
+ `--plan` prints out the changes that will be made to the existing stack instance, if any. This does need AWS credentials.
114
+
115
+
116
+ ## Configuration
117
+
118
+ The classes don't many assumptions about how to configure your stack projects. The classes themselves are very primitive: you'll pass in whatever parameters and resources you need, and then use those in your project files, generally as terraform variables.
119
+
120
+ The stack command line tool, and rake tasks, tests, and your own stuff will tend to put more conventions around parameters and resources.
121
+
122
+ Resources are essentially the same as parameters, but are assumed to relate to other infrastructure, e.g. things you'll need to integrate with, cloud provider credentials, etc.
123
+
124
+ All this needs more documentation and elaboration. For now, you can peruse the code, especially for the example project(s) mentioned above, and hopefully figure stuff out.
125
+
126
+
127
+ # Development
28
128
 
29
129
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
130
 
@@ -33,3 +133,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
33
133
  ## Contributing
34
134
 
35
135
  Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cloudspin-stack.
136
+
137
+
138
+ # Credits
139
+
140
+ This project makes extensive use of ideas and code from Toby Clemson and Jimmy Thompson, particularly [infrablocks](https://github.com/infrablocks). I've also benefited from feedback on implementation concepts from Vincenzo Fabrizi, and other [ThoughtWorkers](https://thoughtworks.com).
141
+
@@ -1,8 +1,3 @@
1
1
  require 'cloudspin/stack/version'
2
2
  require 'cloudspin/stack/definition'
3
3
  require 'cloudspin/stack/instance'
4
-
5
- module Cloudspin
6
- module Stack
7
- end
8
- end
@@ -4,14 +4,21 @@ module Cloudspin
4
4
  module Stack
5
5
  class Definition
6
6
 
7
- attr_reader :parameter_names, :resource_names, :terraform_source_path
7
+ attr_reader :name
8
+ attr_reader :version
9
+ attr_reader :parameter_names
10
+ attr_reader :resource_names
11
+ attr_reader :terraform_source_path
8
12
 
9
13
  def initialize(terraform_source_path: '',
10
14
  parameter_names: [],
11
- resource_names: [])
15
+ resource_names: [],
16
+ stack: {})
12
17
  @terraform_source_path = terraform_source_path
13
18
  @parameter_names = parameter_names
14
19
  @resource_names = resource_names
20
+ @name = stack[:name] || 'NO_NAME'
21
+ @version = stack[:version] || '0'
15
22
  end
16
23
 
17
24
  def self.from_file(specfile)
@@ -1,5 +1,5 @@
1
1
  module Cloudspin
2
2
  module Stack
3
- VERSION = '0.1.10'
3
+ VERSION = '0.1.11'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudspin-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - 'kief '