auser-poolparty 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/bin/cloud-verify +2 -0
- data/bin/install-poolparty +216 -0
- data/lib/poolparty/{aska/aska.rb → aska.rb} +0 -0
- data/lib/poolparty/core/string.rb +11 -0
- data/lib/poolparty/core/symbol.rb +10 -0
- data/lib/poolparty/dependency_resolver/chef_resolver.rb +16 -34
- data/lib/poolparty/dependency_resolver/dependency_resolver_cloud_extensions.rb +4 -4
- data/lib/poolparty/dependency_resolver/puppet_resolver.rb +15 -27
- data/lib/poolparty/lite.rb +1 -1
- data/lib/poolparty/modules/searchable_paths.rb +91 -0
- data/lib/poolparty/net/init.rb +0 -1
- data/lib/poolparty/net/remote_bases.rb +0 -1
- data/lib/poolparty/net/remoter_base.rb +5 -0
- data/lib/poolparty/net/remoter_bases/ec2/ec2.rb +3 -1
- data/lib/poolparty/plugins/apache2/apache.rb +340 -0
- data/lib/poolparty/plugins/rails_deploy.rb +76 -0
- data/lib/poolparty/poolparty/default.rb +1 -0
- data/lib/poolparty/poolparty/plugin.rb +4 -1
- data/lib/poolparty/poolparty/poolparty_base_class.rb +2 -4
- data/lib/poolparty/poolparty/resource.rb +4 -0
- data/lib/poolparty/poolparty/service.rb +8 -0
- data/lib/poolparty/resources/file.rb +3 -3
- data/lib/poolparty/templates/apache2/apache2.conf +14 -0
- data/lib/poolparty/templates/apache2/base.conf.erb +168 -0
- data/lib/poolparty/templates/apache2/browser_fixes.conf.erb +26 -0
- data/lib/poolparty/templates/apache2/debian.conf.erb +675 -0
- data/lib/poolparty/templates/apache2/default-site.conf.erb +41 -0
- data/lib/poolparty/templates/apache2/directory_indexes.conf.erb +101 -0
- data/lib/poolparty/templates/apache2/logging-syslog.conf.erb +42 -0
- data/lib/poolparty/templates/apache2/mime-extras.conf.erb +211 -0
- data/lib/poolparty/templates/apache2/mime-minimal.conf.erb +15 -0
- data/lib/poolparty/templates/apache2/mpm-worker.conf.erb +20 -0
- data/lib/poolparty/templates/apache2/mpm-worker.erb +20 -0
- data/lib/poolparty/templates/apache2/passenger.conf.erb +20 -0
- data/lib/poolparty/templates/apache2/php.ini.erb +1253 -0
- data/lib/poolparty/templates/apache2/server-status.erb +19 -0
- data/lib/poolparty/verification/verifiers/http_match.rb +43 -0
- data/lib/poolparty/verification/verifiers/http_status.rb +59 -0
- data/lib/poolparty/verification/verifiers/ping.rb +13 -1
- data/lib/poolparty.rb +1 -1
- data/lib/poolpartycl.rb +51 -0
- data/spec/poolparty/dependency_resolver/dependency_resolver_cloud_extensions_spec.rb +5 -11
- data/spec/poolparty/modules/searchable_paths_spec.rb +76 -0
- data/spec/poolparty/plugins/git_spec.rb +4 -3
- data/spec/poolparty/poolparty/cloud_spec.rb +3 -19
- data/spec/poolparty/resources/file_spec.rb +1 -0
- data/spec/poolparty/resources/service_spec.rb +1 -1
- data/test/poolparty/dependency_resolver/puppet_resolver_test.rb +5 -11
- data/test/poolparty/poolparty/poolparty_base_class_test.rb +1 -1
- metadata +27 -7
- data/lib/poolparty/plugins/apache2.rb +0 -53
- data/lib/poolparty/plugins/dynomite.rb +0 -14
- data/lib/poolparty/plugins/tokyo_tyrant.rb +0 -23
@@ -0,0 +1,340 @@
|
|
1
|
+
module PoolParty
|
2
|
+
class Base
|
3
|
+
|
4
|
+
=begin rdoc
|
5
|
+
|
6
|
+
Install Apache2 and make various helpers accessible.
|
7
|
+
|
8
|
+
NOTE: this will not install a virtual host by default, *including* a default
|
9
|
+
host. This means apache will not start up unless you specify at least the
|
10
|
+
default host.
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
plugin :apache do
|
15
|
+
def loaded(opts={}, &block)
|
16
|
+
has_service("apache2", :requires => get_package("apache2"))
|
17
|
+
end
|
18
|
+
|
19
|
+
def enable
|
20
|
+
enable_default
|
21
|
+
end
|
22
|
+
|
23
|
+
def before_load(o={}, &block)
|
24
|
+
install
|
25
|
+
end
|
26
|
+
|
27
|
+
def install
|
28
|
+
installed_as_worker
|
29
|
+
end
|
30
|
+
|
31
|
+
def installed_as_worker
|
32
|
+
unless @installed_as_worker
|
33
|
+
has_package("apache2")
|
34
|
+
has_package("apache2-mpm-worker")
|
35
|
+
|
36
|
+
base_install
|
37
|
+
@installed_as_worker = true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def base_install
|
42
|
+
unless @base_install
|
43
|
+
has_exec({:name => "restart-apache2", :command => "/etc/init.d/apache2 restart", :action => :nothing})
|
44
|
+
has_exec({:name => "reload-apache2", :command => "/etc/init.d/apache2 reload", :action => :nothing})
|
45
|
+
has_exec({:name => "force-reload-apache2", :command => "/etc/init.d/apache2 force-reload", :action => :nothing})
|
46
|
+
|
47
|
+
configs
|
48
|
+
@base_install = true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# def install_passenger# {{{
|
53
|
+
# base_install
|
54
|
+
# enable_passenger
|
55
|
+
# end# }}}
|
56
|
+
|
57
|
+
# def enable_passenger# {{{
|
58
|
+
# unless @enable_passenger
|
59
|
+
# installed_as_worker
|
60
|
+
# has_package(:name => "build-essential")
|
61
|
+
# has_package(:name => "apache2-prefork-dev")
|
62
|
+
# has_gempackage(:name => "fastthread")
|
63
|
+
|
64
|
+
# has_exec(:name => "install_passenger_script",
|
65
|
+
# :command => "/usr/bin/ruby #{Base.remote_storage_path}/install_passenger.rb",
|
66
|
+
# :if_not => "test -f /etc/apache2/conf.d/passenger.conf && test -s /etc/apache2/conf.d/passenger.conf",
|
67
|
+
# :calls => get_service("apache2")
|
68
|
+
# )
|
69
|
+
|
70
|
+
# has_file(:name => "#{Base.remote_storage_path}/install_passenger.rb", :calls => get_exec("install_passenger_script")) do
|
71
|
+
# template File.dirname(__FILE__)/".."/"templates"/"apache2"/"install_passenger.rb"
|
72
|
+
# template "install_passenger.rb" # todo
|
73
|
+
# end
|
74
|
+
|
75
|
+
# has_gempackage(:name => "passenger", :calls => get_exec("install_passenger_script"))
|
76
|
+
|
77
|
+
# @enable_passenger = true
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
# }}}
|
81
|
+
|
82
|
+
# def enable_ssl# {{{
|
83
|
+
# unless @enable_ssl
|
84
|
+
# has_package("apache2.2-common")
|
85
|
+
# has_package("openssl")
|
86
|
+
# has_variable(:name => "ssl_enabled", :value => "true")
|
87
|
+
|
88
|
+
# has_exec(:command => "a2enmod ssl") do
|
89
|
+
# requires [ get_package("openssl") ]
|
90
|
+
# if_not "/usr/bin/test -L /etc/apache2/mods-enabled/ssl.load"
|
91
|
+
# calls get_exec("restart-apache2")
|
92
|
+
# end
|
93
|
+
# @enable_ssl = true
|
94
|
+
# end
|
95
|
+
# end# }}}
|
96
|
+
|
97
|
+
def configs
|
98
|
+
unless @configs
|
99
|
+
has_directory("/etc/apache2")
|
100
|
+
has_directory("/etc/apache2/conf.d")
|
101
|
+
has_directory("/etc/apache2/site-includes")
|
102
|
+
|
103
|
+
has_file(:name => "/etc/apache2/apache2.conf") do
|
104
|
+
mode 644
|
105
|
+
requires get_directory("/etc/apache2/conf.d")
|
106
|
+
template "apache2"/"apache2.conf"
|
107
|
+
end
|
108
|
+
does_not_have_file(:name => "/etc/apache2/ports.conf")
|
109
|
+
|
110
|
+
has_exec(:command => "/usr/sbin/a2dissite default") do
|
111
|
+
only_if "/usr/bin/test -L /etc/apache2/sites-enabled/000-default"
|
112
|
+
calls get_exec("reload-apache2")
|
113
|
+
end
|
114
|
+
|
115
|
+
# Base config
|
116
|
+
config("base", "apache2"/"base.conf.erb")
|
117
|
+
config("mime", "apache2"/"mime-minimal.conf.erb")
|
118
|
+
config("browser_fixes", "apache2"/"browser_fixes.conf.erb")
|
119
|
+
|
120
|
+
present_apache_module("mime", "rewrite")
|
121
|
+
# end
|
122
|
+
@configs = true
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def enable_default
|
127
|
+
listen 80 # assumes no haproxy
|
128
|
+
site "default-site", :template => :apache2/"default-site.conf.erb"
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
def config(name, temp)
|
133
|
+
has_file(:name => "/etc/apache2/conf.d/#{name}.conf") do
|
134
|
+
template temp
|
135
|
+
calls get_exec("reload-apache2")
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def listen(port="8080")
|
140
|
+
has_variable(:name => "port", :value => port)
|
141
|
+
end
|
142
|
+
|
143
|
+
def site(name, opts={})
|
144
|
+
case opts[:ensure] || "present"
|
145
|
+
when "present", "installed"
|
146
|
+
install_site(name, opts)
|
147
|
+
when "absent"
|
148
|
+
has_exec(:command => "/usr/sbin/a2dissite #{name}", :calls => get_exec("reload-apache2")) do
|
149
|
+
requires get_package("apache2")
|
150
|
+
only_if "/bin/sh -c \"[ -L /etc/apache2/sites-enabled/#{name} ] && [ /etc/apache2/sites-enabled/#{name} -ef /etc/apache2/sites-available/#{name}]\""
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def install_site(name, opts={})
|
156
|
+
opts.merge!(:name => "/etc/apache2/sites-available/#{name}")
|
157
|
+
has_directory(:name => "/etc/apache2/sites-available")
|
158
|
+
has_file(opts)
|
159
|
+
has_exec(:name => "/usr/sbin/a2ensite #{name}", :calls => get_exec("reload-apache2"), :requires => get_file("/etc/apache2/sites-available/#{name}")) do
|
160
|
+
requires get_package("apache2")
|
161
|
+
if_not "/bin/sh -c '[ -L /etc/apache2/sites-enabled/#{name} ] && [ /etc/apache2/sites-enabled/#{name} -ef /etc/apache2/sites-available/#{name} ]'"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def site_include(name, content, ensureer="present")
|
166
|
+
has_file(:name => "/etc/apache2/site-includes/#{name}.inc", :ensures => ensureer, :content => content, :requires => get_file("/etc/apache2/site-includes"))
|
167
|
+
end
|
168
|
+
|
169
|
+
def present_apache_module(*names)
|
170
|
+
names.each do |name|
|
171
|
+
has_exec(:name => "mod-#{name}", :command => "/usr/sbin/a2enmod #{name}") do
|
172
|
+
requires get_package("apache2")
|
173
|
+
if_not "/bin/sh -c \'[ -L /etc/apache2/mods-enabled/#{name}.load ] && [ /etc/apache2/mods-enabled/#{name}.load -ef /etc/apache2/mods-available/#{name}.load ]\'"
|
174
|
+
calls get_exec("force-reload-apache2")
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def absent_apache_module(*names)
|
180
|
+
names.each do |name|
|
181
|
+
has_exec({:name => "no-mod-#{name}"}, :command => "/usr/sbin/a2dismod #{name}") do
|
182
|
+
requires get_package("apache2")
|
183
|
+
if_not "/bin/sh -c \'[ -L /etc/apache2/mods-enabled/#{name}.load ] && [ /etc/apache2/mods-enabled/#{name}.load -ef /etc/apache2/mods-available/#{name}.load ]\'"
|
184
|
+
calls get_exec("force-reload-apache2")
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
virtual_resource(:virtualhost) do
|
192
|
+
def listen(port="8080")
|
193
|
+
has_variable(:name => "port", :value => port)
|
194
|
+
port port
|
195
|
+
end
|
196
|
+
|
197
|
+
def virtual_host_entry(file)
|
198
|
+
@virtual_host_entry = true
|
199
|
+
if ::File.file?(file)
|
200
|
+
has_file(options.merge({:name => "/etc/apache2/sites-available/#{name}",
|
201
|
+
:template => file,
|
202
|
+
:requires => get_package("apache2")}))
|
203
|
+
else
|
204
|
+
has_file(options.merge({:content => file,
|
205
|
+
:name => "/etc/apache2/sites-available/#{name}",
|
206
|
+
:requires => get_package("apache2")}))
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def loaded(opts={}, parent=self)
|
211
|
+
has_directory(:name => "/var/www")
|
212
|
+
has_directory(:name => "/var/www/#{name}")
|
213
|
+
has_directory(:name => "/var/www/#{name}/logs", :owner => "www-data")
|
214
|
+
|
215
|
+
has_variable(:name => "sitename", :value => "#{name}")
|
216
|
+
|
217
|
+
unless @virtual_host_entry
|
218
|
+
virtual_host_entry <<-eof
|
219
|
+
<VirtualHost *:#{port}>
|
220
|
+
ServerName #{name}
|
221
|
+
DocumentRoot /var/www/#{name}
|
222
|
+
</VirtualHost>
|
223
|
+
eof
|
224
|
+
end
|
225
|
+
|
226
|
+
has_exec(:name => "insert-site-#{name}",
|
227
|
+
:command => "/usr/sbin/a2ensite #{name}",
|
228
|
+
:calls => get_exec("reload-apache2"),
|
229
|
+
:requires => get_file("/etc/apache2/sites-available/#{name}")) do
|
230
|
+
requires get_package("apache2")
|
231
|
+
if_not "/bin/sh -c '[ -L /etc/apache2/sites-enabled/#{parent.name} ] && [ /etc/apache2/sites-enabled/#{parent.name} -ef /etc/apache2/sites-available/#{parent.name} ]'"
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
|
237
|
+
# virtual_resource(:passengersite) do # {{{
|
238
|
+
# def loaded(opts={}, parent=self)
|
239
|
+
# enable_passenger
|
240
|
+
# passenger_entry <<-EOE
|
241
|
+
# Listen #{port ? port : "8080"}
|
242
|
+
# <VirtualHost *>
|
243
|
+
# ServerName #{name}
|
244
|
+
# DocumentRoot #{docroot || "/var/www/#{name}"}/public
|
245
|
+
# RailsEnv production
|
246
|
+
# ErrorLog #{docroot || "/var/www/#{name}"}/log/error_log
|
247
|
+
# CustomLog #{docroot || "/var/www/#{name}"}/log/access_log common
|
248
|
+
# </VirtualHost>
|
249
|
+
# EOE
|
250
|
+
|
251
|
+
# has_directory(:name => "/var/www")
|
252
|
+
# has_directory(:name => "/var/www/#{name}")
|
253
|
+
# has_directory(:name => "/var/www/#{name}/log", :requires => get_directory("/var/www/#{name}/"))
|
254
|
+
|
255
|
+
# has_variable(:name => "sitename", :value => "#{name}")
|
256
|
+
|
257
|
+
# has_exec(:command => "/usr/sbin/a2ensite #{name}", :calls => 'Exec["reload-apache2"]', :requires => get_file("/etc/apache2/sites-available/#{name}")) do
|
258
|
+
# if_not "/bin/sh -c \"[ -L /etc/apache2/sites-enabled/#{name} ] && [ /etc/apache2/sites-enabled/#{name} -ef /etc/apache2/sites-available/#{name} ]\""
|
259
|
+
# end
|
260
|
+
# end
|
261
|
+
# def passenger_entry(file)
|
262
|
+
# if ::File.file?(file)
|
263
|
+
# has_file({:name => "/etc/apache2/sites-available/#{name}", :ensures => 'present', :alias => "#{name}", :template => file, :requires => get_package("apache2")})
|
264
|
+
# else
|
265
|
+
# has_file({:content => file, :name => "/etc/apache2/sites-available/#{name}", :ensures => 'present', :alias => "#{name}", :content => file, :requires => get_package("apache2")})
|
266
|
+
# end
|
267
|
+
# end
|
268
|
+
# end
|
269
|
+
|
270
|
+
# virtual_resource(:passengersite_with_ssl) do
|
271
|
+
# def loaded(opts={}, parent=self)
|
272
|
+
# enable_passenger
|
273
|
+
|
274
|
+
# has_variable(:name => "virtualhost_name", :value => name)
|
275
|
+
# has_variable(:name => "port", :value => port.nil? ? "8080" : port)
|
276
|
+
|
277
|
+
# has_directory(:name => "/var/www")
|
278
|
+
# has_directory(:name => "/var/www/#{name}")
|
279
|
+
# has_directory(:name => "/var/www/#{name}/log", :requires => get_directory("/var/www/#{name}/"))
|
280
|
+
|
281
|
+
# has_variable(:name => "passenger_name", :value => name)
|
282
|
+
|
283
|
+
# has_file(options.merge({:name => "/etc/apache2/sites-available/#{name}", :ensures => 'present', :alias => "#{name}", :requires => get_package("apache2")})) do
|
284
|
+
# template File.dirname(__FILE__), "/../templates/webserver", "passenger.conf.erb"
|
285
|
+
# end
|
286
|
+
|
287
|
+
# has_exec(:command => "/usr/sbin/a2ensite #{name}", :calls => 'Exec["reload-apache2"]', :requires => get_file("/etc/apache2/sites-available/#{name}")) do
|
288
|
+
# if_not "/bin/sh -c \"[ -L /etc/apache2/sites-enabled/#{@parent.name} ] && [ /etc/apache2/sites-enabled/#{@parent.name} -ef /etc/apache2/sites-available/#{@parent.name} ]\""
|
289
|
+
# end
|
290
|
+
# end
|
291
|
+
|
292
|
+
# tell apache ssl which certificate/private key files to use for this virtual site
|
293
|
+
# def certificate(cert_path, key_path)
|
294
|
+
# cert_name = File.basename(cert_path)
|
295
|
+
# key_name = File.basename(key_path)
|
296
|
+
# has_variable(:name => "ssl_cert_file", :value => "/var/www/#{name}/cert/#{cert_name}")
|
297
|
+
# has_variable(:name => "ssl_private_key_file", :value => "/var/www/#{name}/cert/#{key_name}")
|
298
|
+
|
299
|
+
# has_directory(:name => "/var/www")
|
300
|
+
# has_directory(:name => "/var/www/#{name}")
|
301
|
+
# has_directory(:name => "/var/www/#{name}/cert", :requires => get_directory("/var/www/#{name}/"))
|
302
|
+
|
303
|
+
# has_file(:name => "/var/www/#{name}/cert/#{cert_name}") do
|
304
|
+
# content open(cert_path).read
|
305
|
+
# end
|
306
|
+
# has_file(:name => "/var/www/#{name}/cert/#{key_name}") do
|
307
|
+
# content open(key_path).read
|
308
|
+
# end
|
309
|
+
# end
|
310
|
+
# end
|
311
|
+
# }}}
|
312
|
+
|
313
|
+
# Usage:
|
314
|
+
#
|
315
|
+
# enable_php5 do
|
316
|
+
# extras :cli, :pspell, :mysql
|
317
|
+
# end
|
318
|
+
virtual_resource(:enable_php5) do
|
319
|
+
def loaded(opts={}, parent=self)
|
320
|
+
has_package(:name => "php5")
|
321
|
+
has_package(:name => "libapache2-mod-php5")
|
322
|
+
present_apache_module("php5")
|
323
|
+
has_file({:name => "/etc/php5/apache2/php.ini",
|
324
|
+
:template => "apache2/php.ini.erb",
|
325
|
+
:mode => 755,
|
326
|
+
:requires => get_package("libapache2-mod-php5"),
|
327
|
+
:calls => get_exec("reload-apache2")})
|
328
|
+
end
|
329
|
+
|
330
|
+
def extras(*names)
|
331
|
+
names.each do |name|
|
332
|
+
has_package(:name => "php5-#{name}", :requires => get_package("php5"))
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
end
|
337
|
+
|
338
|
+
end
|
339
|
+
|
340
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
Deploy a rails application using chef_deploy
|
3
|
+
|
4
|
+
Usage:
|
5
|
+
has_rails_deploy "app_name" do
|
6
|
+
dir "/var/www"
|
7
|
+
repo "git://github.com/auser/paparazzi.git"
|
8
|
+
user "www-data"
|
9
|
+
database_yml /path/to/database.yml # or a string
|
10
|
+
end
|
11
|
+
|
12
|
+
Sets up the filesystem structure (similar to capistrano deploy) and uses ezra's
|
13
|
+
chef-deploy to deploy the application
|
14
|
+
=end
|
15
|
+
module PoolParty
|
16
|
+
class Rails
|
17
|
+
|
18
|
+
plugin :rails_deploy do
|
19
|
+
|
20
|
+
default_options(
|
21
|
+
:dir => "/var/www",
|
22
|
+
:owner => "www-data"
|
23
|
+
)
|
24
|
+
|
25
|
+
def loaded(o={}, &block)
|
26
|
+
raise "You must include the directory to deploy the rails app" unless dir?
|
27
|
+
raise "You must include the repo to deploy the rails app" unless repo?
|
28
|
+
|
29
|
+
has_package "git-core"
|
30
|
+
has_directory dir
|
31
|
+
has_directory release_directory
|
32
|
+
has_directory "#{shared_directory}", :owner => owner
|
33
|
+
|
34
|
+
%w(config pids log).each do |d|
|
35
|
+
has_directory "#{shared_directory}/#{d}", :owner => owner
|
36
|
+
end
|
37
|
+
|
38
|
+
has_file "#{shared_directory}/config/database.yml", :owner => owner do
|
39
|
+
content ::File.file?(database_yml) ? open(database_yml).read : database_yml
|
40
|
+
end
|
41
|
+
|
42
|
+
# Should these be here?
|
43
|
+
has_chef_recipe "apache2"
|
44
|
+
has_chef_recipe "apache2::mod_rails"
|
45
|
+
|
46
|
+
dopts = options.choose {|k,v| [:repo, :user].include?(k)}
|
47
|
+
has_chef_deploy dopts.merge(:name => "#{release_directory}")
|
48
|
+
|
49
|
+
if shared?
|
50
|
+
shared.each do |sh|
|
51
|
+
|
52
|
+
has_directory "#{shared_directory}/#{::File.dirname(sh)}", :owner => owner
|
53
|
+
|
54
|
+
has_exec "Create rails-deploy-#{name}-#{sh}",
|
55
|
+
:command => "cp #{current_directory}/#{sh} #{shared_directory}/#{sh} && chown -R #{owner} #{shared_directory}/#{sh}",
|
56
|
+
:if_not => "test -f #{shared_directory}/#{sh}"
|
57
|
+
|
58
|
+
has_symlink :name => "#{current_directory}/#{sh}", :to => "#{shared_directory}/#{sh}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
private
|
64
|
+
def current_directory
|
65
|
+
"#{release_directory}/current"
|
66
|
+
end
|
67
|
+
def shared_directory
|
68
|
+
"#{release_directory}/shared"
|
69
|
+
end
|
70
|
+
def release_directory
|
71
|
+
"#{dir}/#{name}"
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -29,6 +29,7 @@ module PoolParty
|
|
29
29
|
:default_specfile_name => "clouds.rb",
|
30
30
|
:properties_hash_filename => "clouds.json",
|
31
31
|
:vendor_path => "#{::File.dirname(__FILE__)}/../../../vendor",
|
32
|
+
:poolparty_src_path => "#{::File.dirname(__FILE__)}/../../..",
|
32
33
|
:port => "80",
|
33
34
|
:forwarding_port => "8080",
|
34
35
|
:monitor_port => 8081,
|
@@ -54,13 +54,11 @@ module PoolParty
|
|
54
54
|
subclass = "#{serv.class.to_s.top_level_class.underscore.downcase}#{extra_name}"
|
55
55
|
lowercase_class_name = subclass.to_s.underscore.downcase || subclass.downcase
|
56
56
|
|
57
|
-
(services[lowercase_class_name.to_sym] ||= []) << serv if serv && !serv.empty?
|
57
|
+
# (services[lowercase_class_name.to_sym] ||= []) << serv if serv && !serv.empty?
|
58
|
+
ordered_resources << serv
|
58
59
|
# services.merge!({lowercase_class_name.to_sym => serv})
|
59
60
|
end
|
60
61
|
# Container for the services
|
61
|
-
def services
|
62
|
-
@services ||= OrderedHash.new
|
63
|
-
end
|
64
62
|
|
65
63
|
def resources
|
66
64
|
@resources ||= OrderedHash.new
|
@@ -8,6 +8,7 @@
|
|
8
8
|
=end
|
9
9
|
module PoolParty
|
10
10
|
module Resources
|
11
|
+
|
11
12
|
|
12
13
|
def custom_file(path, str)
|
13
14
|
write_to_file_in_storage_directory(path, str)
|
@@ -26,6 +27,9 @@ module PoolParty
|
|
26
27
|
# DSL Overriders
|
27
28
|
include PoolParty::ResourcingDsl
|
28
29
|
|
30
|
+
# ability to have searchable paths on resources
|
31
|
+
include SearchablePaths
|
32
|
+
|
29
33
|
# When we subclass Resource, we want to add a few methods to the Resources class
|
30
34
|
# This will anable us to call out to these resources in our DSLified manner
|
31
35
|
# When we call a method from the subclass, say it's the File class
|
@@ -2,10 +2,18 @@ module PoolParty
|
|
2
2
|
|
3
3
|
class Service < PoolPartyBaseClass
|
4
4
|
|
5
|
+
include PoolParty::DependencyResolverCloudExtensions
|
6
|
+
|
5
7
|
def initialize(o={}, &block)
|
6
8
|
super(o, &block)
|
7
9
|
end
|
8
10
|
|
11
|
+
def to_properties_hash
|
12
|
+
{ :pp_type => "plugin", :options => options,
|
13
|
+
:name => self.class.to_s.top_level_class,
|
14
|
+
:resources => ordered_resources.map {|a| a.to_properties_hash }}
|
15
|
+
end
|
16
|
+
|
9
17
|
def cloud
|
10
18
|
2.upto(context_stack.size) do |i|
|
11
19
|
return ::PoolParty.context_stack[-i] if ::PoolParty.context_stack[-i].is_a?(PoolParty::Cloud::Cloud)
|
@@ -30,6 +30,7 @@ To write a file to the template directory, use:
|
|
30
30
|
has_file(:name => '/etc/motd', :content => 'Hey and welcome to your node today!')
|
31
31
|
=end
|
32
32
|
class File < Resource
|
33
|
+
has_searchable_paths(:dir => "templates")
|
33
34
|
|
34
35
|
def loaded(o={}, &block)
|
35
36
|
parent.has_directory ::File.dirname(name) if parent
|
@@ -47,8 +48,7 @@ To write a file to the template directory, use:
|
|
47
48
|
run_render = dsl_options.include?(:render_as) ? dsl_options.delete(:render_as) : false
|
48
49
|
|
49
50
|
if dsl_options.include?(:template)
|
50
|
-
filename =
|
51
|
-
dsl_options.delete(:template)
|
51
|
+
filename = find_file(dsl_options.delete(:template))
|
52
52
|
file = ::File.basename( filename )
|
53
53
|
raise TemplateNotFound.new("no template given") unless file
|
54
54
|
|
@@ -66,7 +66,7 @@ To write a file to the template directory, use:
|
|
66
66
|
def method_missing m, *a, &block
|
67
67
|
super rescue ::File.send(m, *a, &block)
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
end
|
71
71
|
|
72
72
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# apache2.conf -- version for puppet-controlled installations
|
2
|
+
#
|
3
|
+
# this config file merely includes other files; all the truly important stuff
|
4
|
+
# is configured in one of these directories.
|
5
|
+
|
6
|
+
# Include module configuration:
|
7
|
+
Include /etc/apache2/mods-enabled/*.load
|
8
|
+
Include /etc/apache2/mods-enabled/*.conf
|
9
|
+
|
10
|
+
# Include generic snippets of statements
|
11
|
+
Include /etc/apache2/conf.d/*.conf
|
12
|
+
|
13
|
+
# Include the virtual host configurations:
|
14
|
+
Include /etc/apache2/sites-enabled/
|