from-scratch 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +2 -1
  3. data/Berksfile.lock +20 -1
  4. data/cookbooks/bluepill/CHANGELOG.md +93 -0
  5. data/cookbooks/bluepill/README.md +91 -0
  6. data/cookbooks/bluepill/attributes/default.rb +44 -0
  7. data/cookbooks/bluepill/metadata.json +1 -0
  8. data/cookbooks/bluepill/providers/service.rb +172 -0
  9. data/cookbooks/bluepill/recipes/default.rb +48 -0
  10. data/cookbooks/bluepill/recipes/rsyslog.rb +28 -0
  11. data/cookbooks/bluepill/resources/service.rb +27 -0
  12. data/cookbooks/bluepill/templates/default/bluepill_init.fedora.erb +34 -0
  13. data/cookbooks/bluepill/templates/default/bluepill_init.freebsd.erb +32 -0
  14. data/cookbooks/bluepill/templates/default/bluepill_init.lsb.erb +37 -0
  15. data/cookbooks/bluepill/templates/default/bluepill_init.rhel.erb +34 -0
  16. data/cookbooks/bluepill/templates/default/bluepill_rsyslog.conf.erb +1 -0
  17. data/cookbooks/nginx/CHANGELOG.md +435 -0
  18. data/cookbooks/nginx/README.md +521 -0
  19. data/cookbooks/nginx/attributes/auth_request.rb +23 -0
  20. data/cookbooks/nginx/attributes/default.rb +131 -0
  21. data/cookbooks/nginx/attributes/devel.rb +24 -0
  22. data/cookbooks/nginx/attributes/echo.rb +24 -0
  23. data/cookbooks/nginx/attributes/geoip.rb +31 -0
  24. data/cookbooks/nginx/attributes/headers_more.rb +24 -0
  25. data/cookbooks/nginx/attributes/lua.rb +28 -0
  26. data/cookbooks/nginx/attributes/naxsi.rb +24 -0
  27. data/cookbooks/nginx/attributes/openssl_source.rb +23 -0
  28. data/cookbooks/nginx/attributes/pagespeed.rb +9 -0
  29. data/cookbooks/nginx/attributes/passenger.rb +58 -0
  30. data/cookbooks/nginx/attributes/rate_limiting.rb +23 -0
  31. data/cookbooks/nginx/attributes/repo.rb +35 -0
  32. data/cookbooks/nginx/attributes/set_misc.rb +8 -0
  33. data/cookbooks/nginx/attributes/socketproxy.rb +13 -0
  34. data/cookbooks/nginx/attributes/source.rb +42 -0
  35. data/cookbooks/nginx/attributes/status.rb +22 -0
  36. data/cookbooks/nginx/attributes/syslog.rb +24 -0
  37. data/cookbooks/nginx/attributes/upload_progress.rb +26 -0
  38. data/cookbooks/nginx/definitions/nginx_site.rb +50 -0
  39. data/cookbooks/nginx/files/default/mime.types +78 -0
  40. data/cookbooks/nginx/files/default/naxsi_core.rules +82 -0
  41. data/cookbooks/nginx/libraries/matchers.rb +20 -0
  42. data/cookbooks/nginx/metadata.json +351 -0
  43. data/cookbooks/nginx/recipes/authorized_ips.rb +32 -0
  44. data/cookbooks/nginx/recipes/commons.rb +24 -0
  45. data/cookbooks/nginx/recipes/commons_conf.rb +42 -0
  46. data/cookbooks/nginx/recipes/commons_dir.rb +57 -0
  47. data/cookbooks/nginx/recipes/commons_script.rb +29 -0
  48. data/cookbooks/nginx/recipes/default.rb +31 -0
  49. data/cookbooks/nginx/recipes/headers_more_module.rb +50 -0
  50. data/cookbooks/nginx/recipes/http_auth_request_module.rb +52 -0
  51. data/cookbooks/nginx/recipes/http_echo_module.rb +46 -0
  52. data/cookbooks/nginx/recipes/http_geoip_module.rb +113 -0
  53. data/cookbooks/nginx/recipes/http_gzip_static_module.rb +30 -0
  54. data/cookbooks/nginx/recipes/http_mp4_module.rb +2 -0
  55. data/cookbooks/nginx/recipes/http_perl_module.rb +23 -0
  56. data/cookbooks/nginx/recipes/http_realip_module.rb +38 -0
  57. data/cookbooks/nginx/recipes/http_spdy_module.rb +23 -0
  58. data/cookbooks/nginx/recipes/http_ssl_module.rb +23 -0
  59. data/cookbooks/nginx/recipes/http_stub_status_module.rb +36 -0
  60. data/cookbooks/nginx/recipes/ipv6.rb +23 -0
  61. data/cookbooks/nginx/recipes/lua.rb +47 -0
  62. data/cookbooks/nginx/recipes/naxsi_module.rb +52 -0
  63. data/cookbooks/nginx/recipes/ngx_devel_module.rb +44 -0
  64. data/cookbooks/nginx/recipes/ngx_lua_module.rb +47 -0
  65. data/cookbooks/nginx/recipes/ohai_plugin.rb +35 -0
  66. data/cookbooks/nginx/recipes/openssl_source.rb +45 -0
  67. data/cookbooks/nginx/recipes/package.rb +52 -0
  68. data/cookbooks/nginx/recipes/pagespeed_module.rb +62 -0
  69. data/cookbooks/nginx/recipes/passenger.rb +56 -0
  70. data/cookbooks/nginx/recipes/repo.rb +41 -0
  71. data/cookbooks/nginx/recipes/repo_passenger.rb +39 -0
  72. data/cookbooks/nginx/recipes/set_misc.rb +30 -0
  73. data/cookbooks/nginx/recipes/socketproxy.rb +26 -0
  74. data/cookbooks/nginx/recipes/source.rb +205 -0
  75. data/cookbooks/nginx/recipes/syslog_module.rb +69 -0
  76. data/cookbooks/nginx/recipes/upload_progress_module.rb +53 -0
  77. data/cookbooks/nginx/templates/debian/nginx.init.erb +97 -0
  78. data/cookbooks/nginx/templates/default/default-site.erb +11 -0
  79. data/cookbooks/nginx/templates/default/modules/authorized_ip.erb +6 -0
  80. data/cookbooks/nginx/templates/default/modules/http_geoip.conf.erb +4 -0
  81. data/cookbooks/nginx/templates/default/modules/http_gzip_static.conf.erb +1 -0
  82. data/cookbooks/nginx/templates/default/modules/http_realip.conf.erb +7 -0
  83. data/cookbooks/nginx/templates/default/modules/nginx_status.erb +14 -0
  84. data/cookbooks/nginx/templates/default/modules/passenger.conf.erb +13 -0
  85. data/cookbooks/nginx/templates/default/modules/socketproxy.conf.erb +89 -0
  86. data/cookbooks/nginx/templates/default/modules/upload_progress.erb +4 -0
  87. data/cookbooks/nginx/templates/default/nginx-upstart.conf.erb +39 -0
  88. data/cookbooks/nginx/templates/default/nginx.conf.erb +103 -0
  89. data/cookbooks/nginx/templates/default/nginx.init.erb +111 -0
  90. data/cookbooks/nginx/templates/default/nginx.pill.erb +15 -0
  91. data/cookbooks/nginx/templates/default/nginx.sysconfig.erb +1 -0
  92. data/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
  93. data/cookbooks/nginx/templates/default/nxensite.erb +38 -0
  94. data/cookbooks/nginx/templates/default/plugins/nginx.rb.erb +66 -0
  95. data/cookbooks/nginx/templates/default/sv-nginx-log-run.erb +2 -0
  96. data/cookbooks/nginx/templates/default/sv-nginx-run.erb +4 -0
  97. data/cookbooks/nginx/templates/gentoo/nginx.init.erb +87 -0
  98. data/cookbooks/nginx/templates/suse/nginx.init.erb +115 -0
  99. data/cookbooks/nginx/templates/ubuntu/nginx.init.erb +97 -0
  100. data/cookbooks/ohai/CHANGELOG.md +69 -0
  101. data/cookbooks/ohai/README.md +89 -0
  102. data/cookbooks/ohai/attributes/default.rb +31 -0
  103. data/cookbooks/ohai/files/default/plugins/README +1 -0
  104. data/cookbooks/ohai/libraries/matchers.rb +14 -0
  105. data/cookbooks/ohai/metadata.json +1 -0
  106. data/cookbooks/ohai/providers/hint.rb +38 -0
  107. data/cookbooks/ohai/recipes/default.rb +52 -0
  108. data/cookbooks/ohai/resources/hint.rb +5 -0
  109. data/cookbooks/packagecloud/CHANGELOG.md +12 -0
  110. data/cookbooks/packagecloud/README.md +80 -0
  111. data/cookbooks/packagecloud/attributes/default.rb +8 -0
  112. data/cookbooks/packagecloud/libraries/helper.rb +43 -0
  113. data/cookbooks/packagecloud/libraries/matcher.rb +7 -0
  114. data/cookbooks/packagecloud/metadata.json +1 -0
  115. data/cookbooks/packagecloud/providers/repo.rb +212 -0
  116. data/cookbooks/packagecloud/resources/repo.rb +10 -0
  117. data/cookbooks/packagecloud/templates/.kitchen/logs/kitchen.log +29 -0
  118. data/cookbooks/packagecloud/templates/default/apt.erb +2 -0
  119. data/cookbooks/packagecloud/templates/default/yum.erb +15 -0
  120. data/cookbooks/rsyslog/CHANGELOG.md +193 -0
  121. data/cookbooks/rsyslog/README.md +276 -0
  122. data/cookbooks/rsyslog/attributes/default.rb +131 -0
  123. data/cookbooks/rsyslog/libraries/helpers.rb +25 -0
  124. data/cookbooks/rsyslog/metadata.json +1 -0
  125. data/cookbooks/rsyslog/providers/file_input.rb +44 -0
  126. data/cookbooks/rsyslog/recipes/client.rb +87 -0
  127. data/cookbooks/rsyslog/recipes/default.rb +89 -0
  128. data/cookbooks/rsyslog/recipes/server.rb +44 -0
  129. data/cookbooks/rsyslog/resources/file_input.rb +28 -0
  130. data/cookbooks/rsyslog/templates/default/35-server-per-host.conf.erb +62 -0
  131. data/cookbooks/rsyslog/templates/default/49-relp.conf.erb +10 -0
  132. data/cookbooks/rsyslog/templates/default/49-remote.conf.erb +30 -0
  133. data/cookbooks/rsyslog/templates/default/50-default.conf.erb +6 -0
  134. data/cookbooks/rsyslog/templates/default/file-input.conf.erb +15 -0
  135. data/cookbooks/rsyslog/templates/default/omnios-manifest.xml.erb +30 -0
  136. data/cookbooks/rsyslog/templates/default/rsyslog.conf.erb +117 -0
  137. data/cookbooks/rsyslog/templates/smartos/50-default.conf.erb +18 -0
  138. data/cookbooks/runit/.kitchen.cloud.yml +103 -0
  139. data/cookbooks/runit/.kitchen.yml +38 -0
  140. data/cookbooks/runit/.rspec +3 -0
  141. data/cookbooks/runit/.rubocop.yml +45 -0
  142. data/cookbooks/runit/Berksfile.disabled +11 -0
  143. data/cookbooks/runit/CHANGELOG.md +226 -0
  144. data/cookbooks/runit/CONTRIBUTING.md +266 -0
  145. data/cookbooks/runit/Cheffile +11 -0
  146. data/cookbooks/runit/Gemfile +17 -0
  147. data/cookbooks/runit/LICENSE +201 -0
  148. data/cookbooks/runit/README.md +435 -0
  149. data/cookbooks/runit/Rakefile +23 -0
  150. data/cookbooks/runit/TESTING.md +26 -0
  151. data/cookbooks/runit/attributes/default.rb +62 -0
  152. data/cookbooks/runit/files/default/runit.seed +1 -0
  153. data/cookbooks/runit/files/default/runsvdir +0 -0
  154. data/cookbooks/runit/files/ubuntu-6.10/runsvdir +6 -0
  155. data/cookbooks/runit/files/ubuntu-7.04/runsvdir +7 -0
  156. data/cookbooks/runit/files/ubuntu-7.10/runsvdir +7 -0
  157. data/cookbooks/runit/files/ubuntu-8.04/runsvdir +7 -0
  158. data/cookbooks/runit/libraries/default.rb +0 -0
  159. data/cookbooks/runit/libraries/helpers.rb +190 -0
  160. data/cookbooks/runit/libraries/matchers.rb +69 -0
  161. data/cookbooks/runit/libraries/provider_runit_service.rb +326 -0
  162. data/cookbooks/runit/libraries/resource_runit_service.rb +267 -0
  163. data/cookbooks/runit/metadata.json +50 -0
  164. data/cookbooks/runit/recipes/default.rb +91 -0
  165. data/cookbooks/runit/templates/debian/init.d.erb +66 -0
  166. data/cookbooks/runit/templates/default/log-config.erb +24 -0
  167. data/cookbooks/runit/templates/gentoo/runit-start.sh.erb +32 -0
  168. data/cookbooks/scratchify/Berksfile +2 -1
  169. data/cookbooks/scratchify/Berksfile.lock +20 -1
  170. data/cookbooks/scratchify/lib/from-scratch.rb +1 -4
  171. data/cookbooks/scratchify/lib/from-scratch/version.rb +1 -1
  172. data/cookbooks/scratchify/metadata.json +5 -2
  173. data/cookbooks/scratchify/recipes/default.rb +15 -1
  174. data/cookbooks/scratchify/recipes/nginx_site.rb +4 -0
  175. data/cookbooks/scratchify/recipes/pre_rvm.rb +5 -0
  176. data/cookbooks/scratchify/templates/nginx.erb +31 -0
  177. data/cookbooks/scratchify/templates/node.json.erb +21 -6
  178. data/cookbooks/yum-epel/CHANGELOG.md +84 -0
  179. data/cookbooks/yum-epel/README.md +172 -0
  180. data/cookbooks/yum-epel/attributes/default.rb +1 -0
  181. data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +28 -0
  182. data/cookbooks/yum-epel/attributes/epel-source.rb +28 -0
  183. data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +28 -0
  184. data/cookbooks/yum-epel/attributes/epel-testing-source.rb +28 -0
  185. data/cookbooks/yum-epel/attributes/epel-testing.rb +28 -0
  186. data/cookbooks/yum-epel/attributes/epel.rb +28 -0
  187. data/cookbooks/yum-epel/metadata.json +1 -0
  188. data/cookbooks/yum-epel/recipes/default.rb +61 -0
  189. data/cookbooks/yum/CHANGELOG.md +294 -0
  190. data/cookbooks/yum/README.md +285 -0
  191. data/cookbooks/yum/attributes/main.rb +100 -0
  192. data/cookbooks/yum/libraries/matchers.rb +27 -0
  193. data/cookbooks/yum/metadata.json +1 -0
  194. data/cookbooks/yum/providers/globalconfig.rb +41 -0
  195. data/cookbooks/yum/providers/repository.rb +106 -0
  196. data/cookbooks/yum/recipes/default.rb +26 -0
  197. data/cookbooks/yum/resources/globalconfig.rb +109 -0
  198. data/cookbooks/yum/resources/repository.rb +69 -0
  199. data/cookbooks/yum/templates/default/main.erb +276 -0
  200. data/cookbooks/yum/templates/default/repo.erb +125 -0
  201. data/lib/from-scratch.rb +1 -0
  202. data/lib/from-scratch/version.rb +1 -1
  203. data/metadata.rb +5 -1
  204. data/recipes/default.rb +15 -1
  205. data/recipes/nginx_site.rb +4 -0
  206. data/recipes/pre_rvm.rb +5 -0
  207. data/templates/nginx.erb +31 -0
  208. data/templates/node.json.erb +21 -6
  209. metadata +194 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 513b2b040732fc278e3ea45ed344f19b4c74eefd
4
- data.tar.gz: 44e86e612bf4f422092abb44a5609971856c6b3c
3
+ metadata.gz: 6d6ee5b034076aee4eaf155c63a12727cbc86f33
4
+ data.tar.gz: 9c98434c6081adc9ef50245f3d0c9a1b258003b8
5
5
  SHA512:
6
- metadata.gz: ed49b8496b3cc2a2c06ff5d6410586c6ed1e93252b5da489718c30d5f1c31308aeae8272205e81cf0ab782aa7635473a5797cd31343d7dd835fb5a17a77804bf
7
- data.tar.gz: 2ae4cabfcfdcc0b3c087ccdecf9ccb1b0f2f05aeca0c0b33f54ab4b1e9d83e6e963bac4ad299f57176bdf1d99f67f69bdb54220dbec70872002793981ec04265
6
+ metadata.gz: c38f45b739ca3ddbd28bc0ba6fcb5ff8229cdf9cb5da9bc3f3222387c954cbc392947f02328e66844f6ade04b0367517e8738308ebdc723e57a321e38430714a
7
+ data.tar.gz: 4035f100e5f8766a17e088a0b43509bb73f8b456641f87d8a7adc658704f4e1f58ed656cc00f209da1eebe16de8fadeee8781034027b24f545436f78e7232d2d
data/Berksfile CHANGED
@@ -6,8 +6,9 @@ source "https://supermarket.chef.io"
6
6
  metadata
7
7
 
8
8
  cookbook 'user'
9
- cookbook 'rvm', github: 'fnichol/chef-rvm'
9
+ cookbook 'rvm', github: 'martinisoft/chef-rvm'
10
10
  cookbook 'postgresql', github: 'sandrew/postgresql', branch: 'develop'
11
+ cookbook 'nginx'
11
12
 
12
13
  # cookbook 'dpkg_packages', git: "https://gitlab.acid.cl/acidlabs/chef-dpkg-packages.git"
13
14
  # cookbook 'nginx', git: "https://gitlab.acid.cl/acidlabs/chef-nginx.git"
@@ -1,10 +1,11 @@
1
1
  DEPENDENCIES
2
+ nginx
2
3
  postgresql
3
4
  git: git://github.com/sandrew/postgresql.git
4
5
  revision: a1f3ce3e2e22515bc175011a3e3faa0af98dd8db
5
6
  branch: develop
6
7
  rvm
7
- git: git://github.com/fnichol/chef-rvm.git
8
+ git: git://github.com/martinisoft/chef-rvm.git
8
9
  revision: 08ec265f277e112a5a2e4b201bd32ddfe1bb968c
9
10
  scratchify
10
11
  path: .
@@ -13,21 +14,39 @@ DEPENDENCIES
13
14
 
14
15
  GRAPH
15
16
  apt (2.9.2)
17
+ bluepill (2.4.0)
18
+ rsyslog (>= 0.0.0)
16
19
  build-essential (2.2.4)
17
20
  chef-sugar (3.1.1)
18
21
  chef_gem (0.1.0)
19
22
  java (1.35.0)
23
+ nginx (2.7.6)
24
+ apt (~> 2.2)
25
+ bluepill (~> 2.3)
26
+ build-essential (~> 2.0)
27
+ ohai (~> 2.0)
28
+ runit (~> 1.2)
29
+ yum-epel (~> 0.3)
30
+ ohai (2.0.3)
20
31
  openssl (4.4.0)
21
32
  chef-sugar (>= 3.1.1)
33
+ packagecloud (0.1.0)
22
34
  postgresql (3.4.21)
23
35
  apt (>= 1.9.0)
24
36
  build-essential (>= 0.0.0)
25
37
  openssl (~> 4.0)
38
+ rsyslog (2.2.0)
39
+ runit (1.7.4)
40
+ packagecloud (>= 0.0.0)
26
41
  rvm (0.10.1)
27
42
  chef_gem (>= 0.0.0)
28
43
  java (>= 0.0.0)
29
44
  scratchify (0.1.0)
45
+ nginx (>= 0.0.0)
30
46
  postgresql (>= 0.0.0)
31
47
  rvm (>= 0.0.0)
32
48
  user (>= 0.0.0)
33
49
  user (0.4.2)
50
+ yum (3.8.1)
51
+ yum-epel (0.6.4)
52
+ yum (~> 3.2)
@@ -0,0 +1,93 @@
1
+ bluepill Cookbook CHANGELOG
2
+ ===========================
3
+ This file is used to list changes made in each version of the bluepill cookbook.
4
+
5
+
6
+ v2.4.0 (09-17-2014)
7
+ ------
8
+ - Updated the LSB Required-Start and Required-Stop comments of the LSB init script template to be valid
9
+ - Added name to the bluepill_test cookbook metadata for Chef 12
10
+ - If a defaults file on RHEL or Debian based systems exist for the service source that within the init scripts. Example if /etc/default/bar exists on debian for the bar service then source that
11
+ - Added .kitchen.yml file with vagrant based testing for local testing and moved the cloud based kitchen to .kitchen.cloud.yml
12
+ - Add Travis CI config
13
+ - Added rubocop config
14
+ - Updated Berksfile to 3.X format and removed yum cookbook that wasn't used
15
+ - Updated contributing.md and added testing.md documentation
16
+ - Updated development and testing dependencies in the Gemfile
17
+ - Added maintainers.md and .toml and added Rake task for generating the MD file
18
+ - Opscode -> Chef Software everywhere
19
+ - Added Travis and cookbook version badges to the readme
20
+ - Add rake file to easy testing
21
+ - Resolved all Rubocop warnings
22
+ - Added a chefignore file and added additional files to the gitignore
23
+ - Added source_url and issues_url metadata for Supermarket
24
+
25
+ v2.3.2
26
+ ------
27
+ - Never actually released
28
+
29
+ v2.3.1
30
+ ------
31
+ ### New Feature
32
+ - **[COOK-3705](https://tickets.chef.io/browse/COOK-3705)** - Add init.d script with LSB style
33
+
34
+
35
+ v2.3.0
36
+ ------
37
+ ### Improvement
38
+ - **[COOK-3503](https://tickets.chef.io/browse/COOK-3503)** - Add why-run support
39
+
40
+ v2.2.2
41
+ ------
42
+ - [COOK-2507] - stringify language attributes
43
+
44
+ v2.2.0
45
+ ------
46
+ - [COOK-547] - Add `load` action to provider to reload services when template changes.
47
+
48
+ v2.1.0
49
+ ------
50
+ - [COOK-1295] - The bluepill cookbook does not create the default log file
51
+ - [COOK-1840] - Enable bluepill to log to rsyslog
52
+
53
+ v2.0.0
54
+ ------
55
+ This version uses platform_family attribute (in the provider), making the cookbook incompatible with older versions of Chef/Ohai, hence the major version bump.
56
+
57
+ - [COOK-1644] - Bluepill cookbook fails on Redhat due to missing default or redhat template directory.
58
+ - [COOK-1920] - init script should have a template file named after platform_family instead of using file specificity
59
+
60
+ v1.1.2
61
+ ------
62
+ - [COOK-1730] - Add ability to specify which version of bluepill to install
63
+
64
+ v1.1.0
65
+ ------
66
+ - [COOK-1592] - use mixlib-shellout instead of execute, add test-kitchen
67
+
68
+ v1.0.6
69
+ ------
70
+ - [COOK-1304] - support amazon linux
71
+ - [COOK-1427] - resolve foodcritic warnings
72
+
73
+ v1.0.4
74
+ ------
75
+ - [COOK-1106] - fix chkconfig loader for CentOS 5
76
+ - [COOK-1107] - use integer for GID instead of string
77
+
78
+ v1.0.2
79
+ ------
80
+ - [COOK-1043] - Bluepill cookbook fails on OS X because it tries to use root group
81
+
82
+ v1.0.0
83
+ ------
84
+ - [COOK-943] - add init script for freebsd
85
+
86
+ v0.3.0
87
+ ------
88
+ - [COOK-867] - enable bluepill service on RHEL family
89
+ - [COOK-550] - add freebsd support
90
+
91
+ v0.2.2
92
+ ------
93
+ - Fixes COOK-524, COOK-632
@@ -0,0 +1,91 @@
1
+ bluepill Cookbook
2
+ =================
3
+
4
+ [![Build Status](https://travis-ci.org/chef-cookbooks/bluepill.svg?branch=master)](https://travis-ci.org/chef-cookbooks/bluepill)
5
+ [![Cookbook Version](https://img.shields.io/cookbook/v/bluepill.svg)](https://supermarket.chef.io/cookbooks/bluepill)
6
+
7
+ Installs bluepill Ruby Gem and configures it to manage services. Also includes a LWRP.
8
+
9
+
10
+ Requirements
11
+ ------------
12
+ Bluepill is a pure Ruby service management tool/library, so this cookbook should work on any system. The attributes do set up paths based on FHS locations, see below.
13
+
14
+
15
+ Attributes
16
+ ----------
17
+ Default locations for bluepill are in "FHS compliant" locations.
18
+
19
+ * `node["bluepill"]["bin"]` - Path to bluepill program, default is 'bluepill' in the RubyGems binary directory.
20
+ * `node["bluepill"]["logfile"]` - Location of the bluepill log file, default "/var/log/bluepill.log".
21
+ * `node["bluepill"]["conf_dir"]` - Location of service config files (pills), default "/etc/bluepill".
22
+ * `node["bluepill"]["pid_dir"]` - Location of pidfiles, default "/var/run/bluepill"
23
+ * `node["bluepill"]["state_dir"]` - Location of state directory, default "/var/lib/bluepill"
24
+ * `node["bluepill"]["init_dir"]` - Location of init script directory, default selected by platform.
25
+ * `node["bluepill"]["version"]` - Version of bluepill to install, default is latest.
26
+ * `node["bluepill"]["use_rsyslog"]` - Enable configuration and use of rsyslog for bluepill.
27
+
28
+
29
+ Resources/Providers
30
+ -------------------
31
+ This cookbook contains an LWRP, `bluepill_service`. This can be used with the normal Chef service resource, by using the `provider` parameter, or by specifying the `bluepill_service` shortcut. These two resources are equivalent.
32
+
33
+ ```ruby
34
+ service 'my_app' do
35
+ provider bluepill_service
36
+ action [:enable, :load, :start]
37
+ end
38
+
39
+ bluepill_service 'my_app' do
40
+ action [:enable, :load, :start]
41
+ end
42
+ ```
43
+
44
+ The load action should probably always be specified, to ensure that if bluepill isn't running already it gets started. The
45
+
46
+ The recipe using the service must contain a template resource for the pill and it must be named `my_app.pill.erb`, where `my_app` is the service name passed to the bluepill service resource.
47
+
48
+
49
+ Usage
50
+ -----
51
+ Be sure to include the bluepill recipe in the run list to ensure that the gem and bluepill-related directories are created. This will also make the cookbook available on the system and other cookbooks won't need to explicitly depend on it in the metadata.
52
+
53
+ If the default directory locations in the attributes/default.rb aren't what you want, change them by setting them either in the attributes file itself, or create attributes in a role applied to any systems that will use bluepill.
54
+
55
+ Example pill template resource and .erb file:
56
+
57
+ ```ruby
58
+ template '/etc/bluepill/my_app.pill' do
59
+ source 'my_app.pill.erb'
60
+ end
61
+
62
+ Bluepill.application('my_app') do |app|
63
+ app.process('my_app') do |process|
64
+ process.pid_file = '/var/run/my_app.pid'
65
+ process.start_command = '/usr/bin/my_app'
66
+ end
67
+ end
68
+ ```
69
+
70
+ See bluepill's documentation for more information on creating pill templates.
71
+
72
+
73
+ License & Authors
74
+ -----------------
75
+
76
+ **Author:** Cookbook Engineering Team (<cookbooks@chef.io>)
77
+
78
+ **Copyright:** 2010-2015, Chef Software, Inc.
79
+ ```
80
+ Licensed under the Apache License, Version 2.0 (the "License");
81
+ you may not use this file except in compliance with the License.
82
+ You may obtain a copy of the License at
83
+
84
+ http://www.apache.org/licenses/LICENSE-2.0
85
+
86
+ Unless required by applicable law or agreed to in writing, software
87
+ distributed under the License is distributed on an "AS IS" BASIS,
88
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89
+ See the License for the specific language governing permissions and
90
+ limitations under the License.
91
+ ```
@@ -0,0 +1,44 @@
1
+ # Cookbook Name:: bluepill
2
+ # Attributes:: default
3
+ #
4
+ # Copyright 2010-2015, Chef Software, Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ default['bluepill']['bin'] = "#{node['languages']['ruby']['bin_dir']}/bluepill"
19
+ default['bluepill']['logfile'] = '/var/log/bluepill.log'
20
+ default['bluepill']['pid_dir'] = '/var/run/bluepill'
21
+ default['bluepill']['state_dir'] = '/var/lib/bluepill'
22
+ default['bluepill']['group'] = 0
23
+ default['bluepill']['use_rsyslog'] = false
24
+
25
+ case platform
26
+ when 'arch'
27
+ default['bluepill']['init_dir'] = '/etc/rc.d'
28
+ default['bluepill']['conf_dir'] = '/etc/bluepill'
29
+ default['bluepill']['defaults_dir'] = '/etc/default'
30
+ when 'freebsd'
31
+ default['bluepill']['init_dir'] = '/usr/local/etc/rc.d'
32
+ default['bluepill']['conf_dir'] = '/usr/local/etc/bluepill'
33
+ default['bluepill']['defaults_dir'] = '/etc/defaults'
34
+ else
35
+ default['bluepill']['init_dir'] = '/etc/init.d'
36
+ default['bluepill']['conf_dir'] = '/etc/bluepill'
37
+ end
38
+
39
+ case platform
40
+ when 'fedora', 'rhel'
41
+ default['bluepill']['defaults_dir'] = '/etc/sysconfig'
42
+ when 'debian', 'ubuntu'
43
+ default['bluepill']['defaults_dir'] = '/etc/default'
44
+ end
@@ -0,0 +1 @@
1
+ {"name":"bluepill","version":"2.4.0","description":"Installs bluepill gem and configures to manage services, includes bluepill_service LWRP","long_description":"bluepill Cookbook\n=================\n\n[![Build Status](https://travis-ci.org/chef-cookbooks/bluepill.svg?branch=master)](https://travis-ci.org/chef-cookbooks/bluepill)\n[![Cookbook Version](https://img.shields.io/cookbook/v/bluepill.svg)](https://supermarket.chef.io/cookbooks/bluepill)\n\nInstalls bluepill Ruby Gem and configures it to manage services. Also includes a LWRP.\n\n\nRequirements\n------------\nBluepill is a pure Ruby service management tool/library, so this cookbook should work on any system. The attributes do set up paths based on FHS locations, see below.\n\n\nAttributes\n----------\nDefault locations for bluepill are in \"FHS compliant\" locations.\n\n* `node[\"bluepill\"][\"bin\"]` - Path to bluepill program, default is 'bluepill' in the RubyGems binary directory.\n* `node[\"bluepill\"][\"logfile\"]` - Location of the bluepill log file, default \"/var/log/bluepill.log\".\n* `node[\"bluepill\"][\"conf_dir\"]` - Location of service config files (pills), default \"/etc/bluepill\".\n* `node[\"bluepill\"][\"pid_dir\"]` - Location of pidfiles, default \"/var/run/bluepill\"\n* `node[\"bluepill\"][\"state_dir\"]` - Location of state directory, default \"/var/lib/bluepill\"\n* `node[\"bluepill\"][\"init_dir\"]` - Location of init script directory, default selected by platform.\n* `node[\"bluepill\"][\"version\"]` - Version of bluepill to install, default is latest.\n* `node[\"bluepill\"][\"use_rsyslog\"]` - Enable configuration and use of rsyslog for bluepill.\n\n\nResources/Providers\n-------------------\nThis cookbook contains an LWRP, `bluepill_service`. This can be used with the normal Chef service resource, by using the `provider` parameter, or by specifying the `bluepill_service` shortcut. These two resources are equivalent.\n\n```ruby\nservice 'my_app' do\n provider bluepill_service\n action [:enable, :load, :start]\nend\n\nbluepill_service 'my_app' do\n action [:enable, :load, :start]\nend\n```\n\nThe load action should probably always be specified, to ensure that if bluepill isn't running already it gets started. The\n\nThe recipe using the service must contain a template resource for the pill and it must be named `my_app.pill.erb`, where `my_app` is the service name passed to the bluepill service resource.\n\n\nUsage\n-----\nBe sure to include the bluepill recipe in the run list to ensure that the gem and bluepill-related directories are created. This will also make the cookbook available on the system and other cookbooks won't need to explicitly depend on it in the metadata.\n\nIf the default directory locations in the attributes/default.rb aren't what you want, change them by setting them either in the attributes file itself, or create attributes in a role applied to any systems that will use bluepill.\n\nExample pill template resource and .erb file:\n\n```ruby\ntemplate '/etc/bluepill/my_app.pill' do\n source 'my_app.pill.erb'\nend\n\nBluepill.application('my_app') do |app|\n app.process('my_app') do |process|\n process.pid_file = '/var/run/my_app.pid'\n process.start_command = '/usr/bin/my_app'\n end\nend\n```\n\nSee bluepill's documentation for more information on creating pill templates.\n\n\nLicense & Authors\n-----------------\n\n**Author:** Cookbook Engineering Team (<cookbooks@chef.io>)\n\n**Copyright:** 2010-2015, Chef Software, Inc.\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache 2.0","platforms":{},"dependencies":{"rsyslog":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{"bluepill::default":"Installs bluepill rubygem and sets up management directories"},"source_url":"https://github.com/chef-cookbooks/bluepill","issues_url":"https://github.com/chef-cookbooks/bluepill/issues"}
@@ -0,0 +1,172 @@
1
+ #
2
+ # Cookbook Name:: bluepill
3
+ # Provider:: service
4
+ #
5
+ # Copyright 2010-2015, Chef Software, Inc.
6
+ # Copyright 2012, Heavy Water Operations, LLC
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ require 'chef/mixin/shell_out'
22
+ require 'chef/mixin/language'
23
+
24
+ include Chef::Mixin::ShellOut
25
+
26
+ def whyrun_supported?
27
+ true
28
+ end
29
+
30
+ action :enable do
31
+ config_file = ::File.join(node['bluepill']['conf_dir'],
32
+ "#{new_resource.service_name}.pill")
33
+ unless @current_resource.enabled
34
+ converge_by("enable #{@new_resource}") do
35
+ link "#{node['bluepill']['init_dir']}/#{new_resource.service_name}" do
36
+ to node['bluepill']['bin']
37
+ only_if { ::File.exist?(config_file) }
38
+ end
39
+ template_suffix = case node['platform_family']
40
+ when 'rhel', 'fedora', 'freebsd' then node['platform_family']
41
+ when 'debian' then 'lsb'
42
+ end
43
+
44
+ template "#{node['bluepill']['init_dir']}/bluepill-#{new_resource.service_name}" do
45
+ source "bluepill_init.#{template_suffix}.erb"
46
+ cookbook 'bluepill'
47
+ owner 'root'
48
+ group node['bluepill']['group']
49
+ mode '0755'
50
+ variables(
51
+ service_name: new_resource.service_name,
52
+ config_file: config_file
53
+ )
54
+ end if template_suffix
55
+
56
+ service "bluepill-#{new_resource.service_name}" do
57
+ action [:enable]
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ action :load do
64
+ unless @current_resource.running
65
+ converge_by("load #{@new_resource}") do
66
+ shell_out!(load_command)
67
+ end
68
+ end
69
+ end
70
+
71
+ action :reload do
72
+ converge_by("reload #{@new_resource}") do
73
+ shell_out!(stop_command) if @current_resource.running
74
+ shell_out!(load_command)
75
+ end
76
+ end
77
+
78
+ action :start do
79
+ unless @current_resource.running
80
+ converge_by("start #{@new_resource}") do
81
+ shell_out!(start_command)
82
+ end
83
+ end
84
+ end
85
+
86
+ action :disable do
87
+ if @current_resource.enabled
88
+ converge_by("disable #{@new_resource}") do
89
+ file "#{node['bluepill']['conf_dir']}/#{new_resource.service_name}.pill" do
90
+ action :delete
91
+ end
92
+ link "#{node['bluepill']['init_dir']}/#{new_resource.service_name}" do
93
+ action :delete
94
+ end
95
+ end
96
+ end
97
+ end
98
+
99
+ action :stop do
100
+ if @current_resource.running
101
+ converge_by("stop #{@new_resource}") do
102
+ shell_out!(stop_command)
103
+ end
104
+ end
105
+ end
106
+
107
+ action :restart do
108
+ if @current_resource.running
109
+ converge_by("restart #{@new_resource}") do
110
+ Chef::Log.debug "Restarting #{new_resource.service_name}"
111
+ shell_out!(restart_command)
112
+ Chef::Log.debug "Restarted #{new_resource.service_name}"
113
+ end
114
+ end
115
+ end
116
+
117
+ def load_current_resource
118
+ @current_resource = Chef::Resource::BluepillService.new(new_resource.name)
119
+ @current_resource.service_name(new_resource.service_name)
120
+
121
+ Chef::Log.debug("Checking status of service #{new_resource.service_name}")
122
+
123
+ determine_current_status!
124
+
125
+ @current_resource
126
+ end
127
+
128
+ protected
129
+
130
+ def status_command
131
+ "#{node['bluepill']['bin']} #{new_resource.service_name} status"
132
+ end
133
+
134
+ def load_command
135
+ "#{node['bluepill']['bin']} load #{node['bluepill']['conf_dir']}/#{new_resource.service_name}.pill"
136
+ end
137
+
138
+ def start_command
139
+ "#{node['bluepill']['bin']} #{new_resource.service_name} start"
140
+ end
141
+
142
+ def stop_command
143
+ "#{node['bluepill']['bin']} #{new_resource.service_name} stop"
144
+ end
145
+
146
+ def restart_command
147
+ "#{node['bluepill']['bin']} #{new_resource.service_name} restart"
148
+ end
149
+
150
+ def determine_current_status!
151
+ service_running?
152
+ service_enabled?
153
+ end
154
+
155
+ def service_running?
156
+ if shell_out(status_command).exitstatus == 0
157
+ @current_resource.running true
158
+ Chef::Log.debug("#{new_resource} is running")
159
+ end
160
+ rescue Mixlib::ShellOut::ShellCommandFailed, SystemCallError
161
+ @current_resource.running false
162
+ nil
163
+ end
164
+
165
+ def service_enabled?
166
+ if ::File.exist?("#{node['bluepill']['conf_dir']}/#{new_resource.service_name}.pill") &&
167
+ ::File.symlink?("#{node['bluepill']['init_dir']}/#{new_resource.service_name}")
168
+ @current_resource.enabled true
169
+ else
170
+ @current_resource.enabled false
171
+ end
172
+ end