poise-application 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.kitchen.travis.yml +9 -0
- data/.kitchen.yml +8 -0
- data/.travis.yml +23 -0
- data/Berksfile +28 -0
- data/CHANGELOG.md +92 -0
- data/Gemfile +34 -0
- data/LICENSE +201 -0
- data/README.md +239 -0
- data/Rakefile +17 -0
- data/SUPPORTERS.md +81 -0
- data/lib/poise_application.rb +25 -0
- data/lib/poise_application/app_mixin.rb +69 -0
- data/lib/poise_application/cheftie.rb +17 -0
- data/lib/poise_application/error.rb +24 -0
- data/lib/poise_application/resources.rb +22 -0
- data/lib/poise_application/resources/application.rb +259 -0
- data/lib/poise_application/service_mixin.rb +116 -0
- data/lib/poise_application/utils.rb +51 -0
- data/lib/poise_application/version.rb +20 -0
- data/poise-application.gemspec +42 -0
- data/test/cookbooks/application_test/metadata.rb +18 -0
- data/test/cookbooks/application_test/providers/test_plugin.rb +25 -0
- data/test/cookbooks/application_test/recipes/default.rb +61 -0
- data/test/cookbooks/application_test/resources/test_plugin.rb +20 -0
- data/test/gemfiles/chef-12.2.gemfile +19 -0
- data/test/gemfiles/chef-12.3.gemfile +19 -0
- data/test/gemfiles/chef-12.gemfile +19 -0
- data/test/gemfiles/master.gemfile +23 -0
- data/test/integration/default/serverspec/default_spec.rb +43 -0
- data/test/spec/app_mixin_spec.rb +49 -0
- data/test/spec/resources/application_spec.rb +148 -0
- data/test/spec/service_mixin_spec.rb +76 -0
- data/test/spec/spec_helper.rb +18 -0
- data/test/spec/utils_spec.rb +65 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c93e07d070d363f881e7672ab97cf22c68b978c7
|
4
|
+
data.tar.gz: 1c69c0bbd8a5a8ec56898d6fcef659e4fd30b15f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5da9fc90970d626ea3b33b32416bd91f0b123c4d81e495fca950a408afa921e2a5ea7947ae7a3485be59a140694a4d71a9664c513cba2ae492e2f38fcf4ca585
|
7
|
+
data.tar.gz: 5ba5b931737ee9fde0447f8980f3ba772f05e9c58b94ee6033ae0e26d2fe96b19527c4e7b566b923b0bc39c2918d3d3af84a3ece1e34b2b5a070f6983bf0a460
|
data/.gitignore
ADDED
data/.kitchen.travis.yml
ADDED
data/.kitchen.yml
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
sudo: false
|
2
|
+
cache: bundler
|
3
|
+
language: ruby
|
4
|
+
rvm:
|
5
|
+
- '2.2'
|
6
|
+
addons:
|
7
|
+
apt:
|
8
|
+
packages:
|
9
|
+
- libgecode-dev
|
10
|
+
env:
|
11
|
+
global:
|
12
|
+
- USE_SYSTEM_GECODE=true
|
13
|
+
- KITCHEN_LOCAL_YAML=.kitchen.travis.yml
|
14
|
+
- secure: QXR/BZQJDLzdefxrG4WOJYiUCey9l8hNzc5rAAlVqAGWa7Mg5WaPw9adkPD6StZE3k6NN6dnwrX84wL4x5R89RnB2oCU7e1mxfCPR+RRoQcm+BG/7PcLyFz/jO99wZ9R0DYVrT3PwTfTad6ABaQ+II/f+UZQBh4Xf4+rImMCXo8=
|
15
|
+
- secure: IZ0ingfE5sdwCCrBqIxCtiLI8UDoKQBf8eXGsVcanLRI13yo8Tn58XM+NgYE+WOuiQhfdGC2Q8UX8U3df/KVdqftP+JNZ1At7D55i4Pgy3d0ywvBKaxvhPGEs72krqjfT84bsNx2NZwQko2BHPxw9pozxnrEF/h7WR2GZSlJicI=
|
16
|
+
bundler_args: "--binstubs=$PWD/bin --jobs 3 --retry 3"
|
17
|
+
script:
|
18
|
+
- "./bin/rake travis"
|
19
|
+
gemfile:
|
20
|
+
- test/gemfiles/chef-12.gemfile
|
21
|
+
- test/gemfiles/chef-12.2.gemfile
|
22
|
+
- test/gemfiles/chef-12.3.gemfile
|
23
|
+
- test/gemfiles/master.gemfile
|
data/Berksfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
source 'https://supermarket.chef.io/'
|
18
|
+
extension 'halite'
|
19
|
+
|
20
|
+
# Force the rebuild every time for development.
|
21
|
+
cookbook 'poise', gem: 'poise'
|
22
|
+
cookbook 'poise-service', gem: 'poise-service'
|
23
|
+
cookbook 'application', gem: 'poise-application'
|
24
|
+
|
25
|
+
group :test do
|
26
|
+
cookbook 'application_test', path: 'test/cookbooks/application_test'
|
27
|
+
cookbook 'apt'
|
28
|
+
end
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# Poise-Application Changelog
|
2
|
+
|
3
|
+
## v5.0.0
|
4
|
+
|
5
|
+
* Massive rewrite on top of newer Chef patterns. See the 5.0 README for details.
|
6
|
+
|
7
|
+
## v4.1.6
|
8
|
+
|
9
|
+
* Support for Chef 12.
|
10
|
+
* Add `strict_ssh` option to enable host key checking.
|
11
|
+
* Add `keep_releases` option to control number of releases to keep.
|
12
|
+
* Allow passing a path to a file for `deploy_key`.
|
13
|
+
|
14
|
+
## v4.1.4
|
15
|
+
|
16
|
+
* [COOK-3343](https://tickets.opscode.com/browse/COOK-3343) - Can't parse release candidate version number.
|
17
|
+
|
18
|
+
## v4.1.2
|
19
|
+
|
20
|
+
* [COOK-3343](https://tickets.opscode.com/browse/COOK-3343) - Can't parse release candidate version number.
|
21
|
+
|
22
|
+
## v4.1.0
|
23
|
+
|
24
|
+
* [COOK-3343] - Can't parse release candidate version number.
|
25
|
+
|
26
|
+
## v4.0.0
|
27
|
+
|
28
|
+
* Removes compatability with Chef 10.
|
29
|
+
* [COOK-3564](https://tickets.opscode.com/browse/COOK-3564) - Replace calls to `Chef::Mixin::RecipeDefinitionDSLCore`.
|
30
|
+
|
31
|
+
## v3.0.0
|
32
|
+
|
33
|
+
* [COOK-3306]: Multiple Memory Leaks in Application Cookbook.
|
34
|
+
|
35
|
+
## v2.0.4
|
36
|
+
|
37
|
+
* [COOK-2812]: application cookbook doesn't allow to specify a block as `restart_command`.
|
38
|
+
|
39
|
+
## v2.0.2
|
40
|
+
|
41
|
+
* [COOK-2537]: Provide proper `respond_to` behavior when using `method_missing`.
|
42
|
+
* [COOK-2713]: application resource should Allow sub-resource attributes to propogate up.
|
43
|
+
|
44
|
+
### Improvement
|
45
|
+
* [COOK-2597]: Allow customization for `shallow_clone` when doing a git deploy.
|
46
|
+
|
47
|
+
## v2.0.0
|
48
|
+
|
49
|
+
This release is incompatible with previous releases (hence major version change). The recipes used in older versions are deprecated and completely removed. See README.md for further detail.
|
50
|
+
|
51
|
+
* [COOK-1673] - `deploy_revision` in the application cookbook gives an argument error.
|
52
|
+
* [COOK-1820] - Application cookbook: remove deprecated recipes.
|
53
|
+
|
54
|
+
## v1.0.4
|
55
|
+
|
56
|
+
* [COOK-1567] - Add git submodules to application cookbook.
|
57
|
+
|
58
|
+
## v1.0.2
|
59
|
+
|
60
|
+
* [COOK-1312] - string callbacks fail with method not found (really included this time).
|
61
|
+
* [COOK-1332] - add `release_path` and `shared_path` methods.
|
62
|
+
* [COOK-1333] - add example for running migrations.
|
63
|
+
* [COOK-1360] - fix minor typos in README.
|
64
|
+
* [COOK-1374] - use runit attributes in unicorn run script.
|
65
|
+
|
66
|
+
## v1.0.0
|
67
|
+
|
68
|
+
This release introduces the LWRP for application deployment, as well as other improvements. The recipes will be deprecated in August 2012 as indicated by their warning messages and in the README.md.
|
69
|
+
|
70
|
+
* [COOK-634] - Implement LWRP for application deployment.
|
71
|
+
* [COOK-1116] - use other SCMs than git.
|
72
|
+
* [COOK-1252] - add `:force_deploy` that maps to corresponding action of deploy resource.
|
73
|
+
* [COOK-1253] - fix rollback error.
|
74
|
+
* [COOK-1312] - string callbacks fail with method not found.
|
75
|
+
* [COOK-1313] - implicit file based hooks aren't invoked.
|
76
|
+
* [COOK-1318] - Create `to_ary` method to resolve issue in resources() lookup on "application[foo]" resources.
|
77
|
+
|
78
|
+
## v0.99.14
|
79
|
+
|
80
|
+
* [COOK-1065] - use pip in virtualenv during deploy.
|
81
|
+
|
82
|
+
## v0.99.12
|
83
|
+
|
84
|
+
* [COOK-606] application cookbook deployment recipes should use ipaddress instead of fqdn.
|
85
|
+
|
86
|
+
## v0.99.11
|
87
|
+
|
88
|
+
* make the `_default` `chef_environment` look like production rails env.
|
89
|
+
|
90
|
+
## v0.99.10
|
91
|
+
|
92
|
+
* Use Chef 0.10's `node.chef_environment` instead of `node['app_environment']`.
|
data/Gemfile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2009-2015, Opscode, Inc.
|
3
|
+
# Copyright 2015, Noah Kantrowitz
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
source 'https://rubygems.org/'
|
19
|
+
|
20
|
+
gemspec path: File.expand_path('..', __FILE__)
|
21
|
+
|
22
|
+
def dev_gem(name, path: File.join('..', name), github: nil)
|
23
|
+
path = File.expand_path(File.join('..', path), __FILE__)
|
24
|
+
if File.exist?(path)
|
25
|
+
gem name, path: path
|
26
|
+
elsif github
|
27
|
+
gem name, github: github
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
dev_gem 'halite'
|
32
|
+
dev_gem 'poise'
|
33
|
+
dev_gem 'poise-boiler'
|
34
|
+
dev_gem 'poise-service'
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,239 @@
|
|
1
|
+
# Application cookbook
|
2
|
+
|
3
|
+
[![Build Status](https://img.shields.io/travis/poise/application.svg)](https://travis-ci.org/poise/application)
|
4
|
+
[![Gem Version](https://img.shields.io/gem/v/poise-application.svg)](https://rubygems.org/gems/poise-application)
|
5
|
+
[![Cookbook Version](https://img.shields.io/cookbook/v/application.svg)](https://supermarket.chef.io/cookbooks/application)
|
6
|
+
[![Coverage](https://img.shields.io/codeclimate/coverage/github/poise/application.svg)](https://codeclimate.com/github/poise/application)
|
7
|
+
[![Gemnasium](https://img.shields.io/gemnasium/poise/application.svg)](https://gemnasium.com/poise/application)
|
8
|
+
[![License](https://img.shields.io/badge/license-Apache_2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
|
9
|
+
|
10
|
+
A [Chef](https://www.chef.io/) cookbook to deploy applications.
|
11
|
+
|
12
|
+
## Getting Started
|
13
|
+
|
14
|
+
The application cookbook provides a central framework to deploy applications
|
15
|
+
using Chef. Generally this will be web applications using things like Rails,
|
16
|
+
Django, or NodeJS, but the framework makes no specific assumptions. The core
|
17
|
+
`application` resource provides DSL support and helpers, but the heavy lifting
|
18
|
+
is all done in specific plugins detailed below. Each deployment starts with
|
19
|
+
an `application` resource:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
application '/path/to/deploy' do
|
23
|
+
owner 'root'
|
24
|
+
group 'root'
|
25
|
+
|
26
|
+
# ...
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
The `application` resource uses the Poise subresource system for plugins. This
|
31
|
+
means you configure the steps of the deployment like normal recipe code inside
|
32
|
+
the `application` resource, with a few special additions:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
application '/path/to/deploy' do
|
36
|
+
# Application resource properties.
|
37
|
+
owner 'root'
|
38
|
+
group 'root'
|
39
|
+
|
40
|
+
# Subresources, like normal recipe code.
|
41
|
+
package 'ruby'
|
42
|
+
git '/path/to/deploy' do
|
43
|
+
repository 'https://github.com/example/myapp.git'
|
44
|
+
end
|
45
|
+
application_rails '/path/to/deploy' do
|
46
|
+
database 'mysql://dbhost/myapp'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
51
|
+
When evaluating the recipe inside the `application` resource, it first checks
|
52
|
+
for `application_#{resource}`, as well as looking for an LWRP of the same name
|
53
|
+
in any cookbook starting with `application_`. This means that a resource named
|
54
|
+
`application_foo` can be used as `foo` inside the `application` resource:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
application '/path/to/deploy' do
|
58
|
+
owner 'root'
|
59
|
+
group 'root'
|
60
|
+
|
61
|
+
rails '/path/to/deploy' do
|
62
|
+
database 'mysql://dbhost/myapp'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
67
|
+
Additionally if a resource inside the `application` block doesn't have a name,
|
68
|
+
it uses the same name as the application resource itself:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
application '/path/to/deploy' do
|
72
|
+
owner 'root'
|
73
|
+
group 'root'
|
74
|
+
|
75
|
+
rails do
|
76
|
+
database 'mysql://dbhost/myapp'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
Other than those two special features, the recipe code inside the `application`
|
82
|
+
resource is processed just like any other recipe.
|
83
|
+
|
84
|
+
## Available Plugins
|
85
|
+
|
86
|
+
* [`application_git`](https://github.com/poise/application_git) – Deploy
|
87
|
+
application code from a git repository.
|
88
|
+
* [`application_ruby`](https://github.com/poise/application_ruby) – Manage Ruby
|
89
|
+
deployments, such as Rails or Sinatra applications.
|
90
|
+
* [`application_python`](https://github.com/poise/application_python) – Manage
|
91
|
+
Python deployments, such as Django or Flask applications.
|
92
|
+
* [`application_javascript`](https://github.com/poise/application_javascript) –
|
93
|
+
Manage server-side JavaScript deployments using Node.js or io.js.
|
94
|
+
* `application_java` – *Coming soon!*
|
95
|
+
* `application_go` – *Coming soon!*
|
96
|
+
* `application_erlang` – *Coming soon!*
|
97
|
+
|
98
|
+
## Requirements
|
99
|
+
|
100
|
+
Chef 12 or newer is required.
|
101
|
+
|
102
|
+
## Resources
|
103
|
+
|
104
|
+
### `application`
|
105
|
+
|
106
|
+
The `application` resource has top-level configuration properties for each
|
107
|
+
deployment and acts as a container for other deployment plugin resources.
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
application '/opt/test_sinatra' do
|
111
|
+
git 'https://github.com/example/my_sinatra_app.git'
|
112
|
+
bundle_install do
|
113
|
+
deployment true
|
114
|
+
end
|
115
|
+
unicorn do
|
116
|
+
port 9000
|
117
|
+
end
|
118
|
+
end
|
119
|
+
```
|
120
|
+
|
121
|
+
#### Actions
|
122
|
+
|
123
|
+
* `:deploy` – Deploy the application. *(default)*
|
124
|
+
* `:start` - Run `:start` on all subresources that support it.
|
125
|
+
* `:stop` - Run `:stop` on all subresources that support it.
|
126
|
+
* `:restart` - Run `:restart` on all subresources that support it.
|
127
|
+
* `:reload` - Run `:reload` on all subresources that support it.
|
128
|
+
|
129
|
+
#### Properties
|
130
|
+
|
131
|
+
* `path` – Path to deploy the application to. *(name attribute)*
|
132
|
+
* `environment` – Environment variables for all application deployment steps.
|
133
|
+
* `group` – System group to deploy the application as.
|
134
|
+
* `owner` – System user to deploy the application as.
|
135
|
+
* `action_on_update` – Action to run on the application resource when any
|
136
|
+
subresource is updated. *(default: restart)*
|
137
|
+
* `action_on_update_immediately` – Run the `action_on_update` notification with
|
138
|
+
`:immediately`. *(default: false)*
|
139
|
+
|
140
|
+
## Examples
|
141
|
+
|
142
|
+
Some test recipes are available as examples for common application frameworks:
|
143
|
+
|
144
|
+
* [Sinatra](https://github.com/poise/application_ruby/blob/master/test/cookbooks/application_ruby_test/recipes/sinatra.rb)
|
145
|
+
* [Rails](https://github.com/poise/application_ruby/blob/master/test/cookbooks/application_ruby_test/recipes/rails.rb)
|
146
|
+
* [Flask](https://github.com/poise/application_python/blob/master/test/cookbooks/application_python_test/recipes/flask.rb)
|
147
|
+
* [Django](https://github.com/poise/application_python/blob/master/test/cookbooks/application_python_test/recipes/django.rb)
|
148
|
+
* [Express](https://github.com/poise/application_javascript/blob/master/test/cookbooks/application_javascript_test/recipes/express.rb)
|
149
|
+
|
150
|
+
## Upgrading From 4.x
|
151
|
+
|
152
|
+
While the overall design of the revamped application resource is similar to the
|
153
|
+
4.x version, some changes will need to be made. The `name` property no longer
|
154
|
+
exists, with the name attribute being used as the path to the deployment.
|
155
|
+
The `packages` property has been removed as this is more easily handled via
|
156
|
+
normal recipe code.
|
157
|
+
|
158
|
+
The SCM-related properties like `repository` and `revision` are now handled by
|
159
|
+
normal plugins. If you were deploying from a private git repository you will
|
160
|
+
likely want to use the `application_git` cookbook, otherwise just use the
|
161
|
+
built-in `git` or `svn` resources as per normal.
|
162
|
+
|
163
|
+
The properties related to the `deploy` resource like `strategy` and `symlinks`
|
164
|
+
have been removed. The `deploy` resource is no longer used so these aren't
|
165
|
+
relevant. As a side effect of this, you'll likely want to point the upgraded
|
166
|
+
deployment at a new folder or manually clean the `current` and `shared` folders
|
167
|
+
from the existing folder. The pseudo-Capistrano layout used by the `deploy`
|
168
|
+
resource has few benefits in a config-managed world and introduced a lot of
|
169
|
+
complexity and moving pieces that are no longer required.
|
170
|
+
|
171
|
+
With the removal of the `deploy` resource, the callback properties and commands
|
172
|
+
are no longer used as well. Subresources no longer use the complex
|
173
|
+
actions-as-callbacks arrangement as existed before, instead following normal
|
174
|
+
Chef recipe flow. Individual subresources may need to be tweaked to work with
|
175
|
+
newer versions of the cookbooks they come from, though most have stayed similar
|
176
|
+
in overall approach.
|
177
|
+
|
178
|
+
## Database Migrations and Chef
|
179
|
+
|
180
|
+
Several of the web application deployment plugins include optional support to
|
181
|
+
run database migrations from Chef. For "toy" applications where the app and
|
182
|
+
database run together on a single machine, this is fine and is a nice time
|
183
|
+
saver. For anything more complex I highly recommend not running database
|
184
|
+
migrations from Chef. Some initial operations like creating the database and/or
|
185
|
+
database user are more reasonable as they tend to be done only once and by their
|
186
|
+
nature the application does not yet have users so some level of eventual
|
187
|
+
consistency is more acceptable. With migrations on a production application, I
|
188
|
+
encourage using Chef and the application cookbooks to handle deploying the code
|
189
|
+
and writing configuration files, but use something more specific to run the
|
190
|
+
actual migration task. [Fabric](http://www.fabfile.org/),
|
191
|
+
[Capistrano](http://capistranorb.com/), and [Rundeck](http://rundeck.org/) are
|
192
|
+
all good choices for this orchestration tooling.
|
193
|
+
|
194
|
+
Migrations can generally be applied idempotently but they have unique
|
195
|
+
constraints (pun definitely intended) that make them tricky in a Chef-like,
|
196
|
+
convergence-based system. First and foremost is that many table alterations
|
197
|
+
lock the table for updating for at least some period of time. That can mean that
|
198
|
+
while staging the new code or configuration data can happen within a window, the
|
199
|
+
migration itself needs to be run in careful lockstep with the rest of the
|
200
|
+
deployment process (eg. moving things in and out of load balancers). Beyond
|
201
|
+
that, while most web frameworks have internal idempotence checks for migrations,
|
202
|
+
running the process on two servers at the same time can have unexpected effects.
|
203
|
+
|
204
|
+
Overall migrations are best thought of as a procedural step rather than a
|
205
|
+
declaratively modeled piece of the system.
|
206
|
+
|
207
|
+
## Application Signals and Updates
|
208
|
+
|
209
|
+
The `application` resource exposes `start`, `stop`, `restart`, and `reload`
|
210
|
+
actions which will dispatch to any subresources attached to the application.
|
211
|
+
This allows for generic application-level restart or reload signals that will
|
212
|
+
work with any type of deployment.
|
213
|
+
|
214
|
+
Additionally the `action_on_update` property is used to set a default
|
215
|
+
notification so any subresource that updates will trigger an application
|
216
|
+
restart or reload. This can be disabled by setting `action_on_update false` if
|
217
|
+
you want to take manual control of service restarts.
|
218
|
+
|
219
|
+
## Sponsors
|
220
|
+
|
221
|
+
Development sponsored by [Chef Software](https://www.chef.io/), [Symonds & Son](http://symondsandson.com/), and [Orion](https://www.orionlabs.co/).
|
222
|
+
|
223
|
+
The Poise test server infrastructure is sponsored by [Rackspace](https://rackspace.com/).
|
224
|
+
|
225
|
+
## License
|
226
|
+
|
227
|
+
Copyright 2015, Noah Kantrowitz
|
228
|
+
|
229
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
230
|
+
you may not use this file except in compliance with the License.
|
231
|
+
You may obtain a copy of the License at
|
232
|
+
|
233
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
234
|
+
|
235
|
+
Unless required by applicable law or agreed to in writing, software
|
236
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
237
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
238
|
+
See the License for the specific language governing permissions and
|
239
|
+
limitations under the License.
|