zena 0.16.8 → 0.16.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/config/deploy.rb +7 -2
- data/config/gems.yml +1 -1
- data/db/schema.rb +0 -14
- data/lib/zena/deploy.rb +183 -140
- data/lib/zena/deploy/awstats.conf.rhtml +4 -4
- data/lib/zena/deploy/httpd.rhtml +9 -5
- data/lib/zena/deploy/stats.vhost.rhtml +7 -7
- data/lib/zena/deploy/template.rb +6 -2
- data/lib/zena/deploy/vhost.rhtml +2 -2
- data/lib/zena/deploy/vhost_www.rhtml +4 -4
- data/lib/zena/foxy_parser.rb +6 -5
- data/lib/zena/info.rb +1 -1
- data/zena.gemspec +5 -5
- metadata +4 -4
data/History.txt
CHANGED
data/config/deploy.rb
CHANGED
@@ -9,8 +9,9 @@ set :repository, "http://svn.zenadmin.org/zena/trunk"
|
|
9
9
|
if self[:server_ip]
|
10
10
|
#================= ADVANCED SETTINGS =============#
|
11
11
|
|
12
|
-
set :deploy_to, "/
|
13
|
-
set :sites_root, "/
|
12
|
+
set :deploy_to, "/home/#{db_name}/app"
|
13
|
+
set :sites_root, "/home/#{db_name}/sites"
|
14
|
+
|
14
15
|
set :vhost_root, "/etc/apache2/sites-available"
|
15
16
|
set :deflate, true
|
16
17
|
set :debug_deflate, false
|
@@ -40,6 +41,10 @@ if self[:server_ip]
|
|
40
41
|
require deploy_path
|
41
42
|
else
|
42
43
|
# Zena app, using zena as gem
|
44
|
+
env = File.read(File.join(File.dirname(__FILE__), 'environment.rb'))
|
45
|
+
if env =~ /config.gem.*zena.*version.*'(.*?)'/
|
46
|
+
gem 'zena', "= #{$1}"
|
47
|
+
end
|
43
48
|
require 'zena/deploy'
|
44
49
|
end
|
45
50
|
|
data/config/gems.yml
CHANGED
data/db/schema.rb
CHANGED
@@ -80,19 +80,6 @@ ActiveRecord::Schema.define(:version => 20100115134729) do
|
|
80
80
|
t.decimal "value_b", :precision => 24, :scale => 8
|
81
81
|
end
|
82
82
|
|
83
|
-
create_table "delayed_jobs", :force => true do |t|
|
84
|
-
t.integer "priority", :default => 0
|
85
|
-
t.integer "attempts", :default => 0
|
86
|
-
t.text "handler"
|
87
|
-
t.text "last_error"
|
88
|
-
t.datetime "run_at"
|
89
|
-
t.datetime "locked_at"
|
90
|
-
t.datetime "failed_at"
|
91
|
-
t.string "locked_by"
|
92
|
-
t.datetime "created_at"
|
93
|
-
t.datetime "updated_at"
|
94
|
-
end
|
95
|
-
|
96
83
|
create_table "discussions", :force => true do |t|
|
97
84
|
t.datetime "created_at"
|
98
85
|
t.datetime "updated_at"
|
@@ -189,7 +176,6 @@ ActiveRecord::Schema.define(:version => 20100115134729) do
|
|
189
176
|
t.integer "custom_a"
|
190
177
|
t.integer "custom_b"
|
191
178
|
t.text "vhash"
|
192
|
-
t.boolean "delta", :default => true, :null => false
|
193
179
|
end
|
194
180
|
|
195
181
|
create_table "relations", :force => true do |t|
|
data/lib/zena/deploy.rb
CHANGED
@@ -30,14 +30,20 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
30
30
|
|
31
31
|
set :templates, File.join(File.dirname(__FILE__), 'deploy')
|
32
32
|
self[:app_type] ||= :mongrel
|
33
|
-
|
34
|
-
self[:
|
33
|
+
|
34
|
+
self[:deploy_to] ||= "/home/#{db_name}/app"
|
35
|
+
self[:sites_root] ||= "/home/#{db_name}/sites"
|
36
|
+
self[:dump_root] ||= "/home/#{db_name}/dump"
|
37
|
+
|
38
|
+
self[:app_root] ||= "#{deploy_to}/current"
|
39
|
+
|
35
40
|
self[:balancer] ||= db_name
|
41
|
+
self[:db_user] ||= db_name
|
36
42
|
self[:runner] ||= 'root'
|
37
43
|
self[:on_stop] = []
|
38
44
|
self[:on_start] = []
|
39
45
|
|
40
|
-
set :in_current, "cd #{
|
46
|
+
set :in_current, "cd #{app_root} &&"
|
41
47
|
|
42
48
|
class RenderClass
|
43
49
|
def initialize(path)
|
@@ -67,12 +73,29 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
67
73
|
self[:on_start] << block
|
68
74
|
end
|
69
75
|
|
76
|
+
def ancestry(path)
|
77
|
+
# Build directory ancestry ['/a', '/a/b', '/a/b/c']
|
78
|
+
paths = path.split('/')[1..-1].inject(['']) do |res, cur|
|
79
|
+
res << (res.last + "/#{cur}")
|
80
|
+
res
|
81
|
+
end[1..-1]
|
82
|
+
end
|
83
|
+
|
70
84
|
#========================== SOURCE CODE =========================#
|
71
85
|
|
72
86
|
|
73
87
|
desc "set permissions to www-data"
|
74
88
|
task :set_permissions, :roles => :app do
|
75
|
-
|
89
|
+
directories = [
|
90
|
+
'current/public',
|
91
|
+
'current/tmp',
|
92
|
+
'current/log',
|
93
|
+
'shared/log',
|
94
|
+
].map {|dir| "#{deploy_to}/#{dir}"}
|
95
|
+
|
96
|
+
# make sure production.log is created before so that it gets the correct permissions
|
97
|
+
run "touch #{deploy_to}/shared/log/production.log"
|
98
|
+
run "chown -R www-data:www-data #{directories.join(' ')}"
|
76
99
|
end
|
77
100
|
|
78
101
|
"Update the currently released version of the software directly via an SCM update operation"
|
@@ -93,7 +116,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
93
116
|
desc "after code update"
|
94
117
|
task :after_update, :roles => :app do
|
95
118
|
app_update_symlinks
|
96
|
-
|
119
|
+
db::update_config
|
97
120
|
apache2_setup
|
98
121
|
migrate
|
99
122
|
clear_zafu
|
@@ -102,7 +125,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
102
125
|
|
103
126
|
desc "update symlink to 'sites' directory"
|
104
127
|
task :app_update_symlinks, :roles => :app do
|
105
|
-
run "test ! -e #{deploy_to}/current/sites || rm #{deploy_to}/current/sites"
|
128
|
+
run "test ! -e #{deploy_to}/current/sites || rm -rf #{deploy_to}/current/sites || true"
|
106
129
|
run "ln -sf #{sites_root} #{deploy_to}/current/sites"
|
107
130
|
set_permissions
|
108
131
|
end
|
@@ -114,10 +137,11 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
114
137
|
|
115
138
|
desc "initial app setup"
|
116
139
|
task :app_setup, :roles => :app do
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
140
|
+
paths = ancestry(deploy_to) + ancestry(sites_root) + ancestry("#{deploy_to}/shared/log") + ancestry(dump_root)
|
141
|
+
|
142
|
+
paths.uniq.sort.each do |dir|
|
143
|
+
run "test -e #{dir} || mkdir #{dir}"
|
144
|
+
end
|
121
145
|
end
|
122
146
|
|
123
147
|
#========================== MANAGE HOST =========================#
|
@@ -133,7 +157,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
133
157
|
desc "update code in the current version"
|
134
158
|
task :up, :roles => :app do
|
135
159
|
run "cd #{deploy_to}/current && #{self[:scm] == 'git' ? "git pull origin #{self[:branch] || 'master'}" : 'svn up'} && (echo #{strategy.configuration[:real_revision]} > #{deploy_to}/current/REVISION)"
|
136
|
-
|
160
|
+
db::update_config
|
137
161
|
clear_zafu
|
138
162
|
clear_cache
|
139
163
|
migrate
|
@@ -173,9 +197,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
173
197
|
run "test -e /etc/apache2/sites-enabled/#{self[:host]} || a2ensite #{self[:host]}" if debian_host
|
174
198
|
|
175
199
|
unless self[:host] =~ /^www/
|
176
|
-
vhost_www = render("#{templates}/vhost_www.rhtml",
|
177
|
-
:host => self[:host]
|
178
|
-
)
|
200
|
+
vhost_www = render("#{templates}/vhost_www.rhtml", :config => self)
|
179
201
|
put(vhost_www, "#{vhost_root}/www.#{self[:host]}")
|
180
202
|
run "test -e /etc/apache2/sites-enabled/www.#{self[:host]} || a2ensite www.#{self[:host]}" if debian_host
|
181
203
|
end
|
@@ -193,13 +215,13 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
193
215
|
puts "host or password not set (use -s host=... -s pass=...)"
|
194
216
|
else
|
195
217
|
# create awstats config file
|
196
|
-
awstats_conf = render("#{templates}/awstats.conf.rhtml", :
|
218
|
+
awstats_conf = render("#{templates}/awstats.conf.rhtml", :config => self)
|
197
219
|
put(awstats_conf, "/etc/awstats/awstats.#{self[:host]}.conf")
|
198
220
|
run "chown www-data:www-data /etc/awstats/awstats.#{self[:host]}.conf"
|
199
221
|
run "chmod 640 /etc/awstats/awstats.#{self[:host]}.conf"
|
200
222
|
|
201
223
|
# create stats vhost
|
202
|
-
stats_vhost = render("#{templates}/stats.vhost.rhtml", :
|
224
|
+
stats_vhost = render("#{templates}/stats.vhost.rhtml", :config => self)
|
203
225
|
put(stats_vhost, "#{vhost_root}/stats.#{self[:host]}")
|
204
226
|
run "test -e /etc/apache2/sites-enabled/stats.#{self[:host]} || a2ensite stats.#{self[:host]}"
|
205
227
|
|
@@ -211,7 +233,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
211
233
|
run "cat /etc/cron.d/awstats | grep \"#{self[:host]}\" || echo \"0,10,20,30,40,50 * * * * www-data [ -x /usr/lib/cgi-bin/awstats.pl -a -f /etc/awstats/awstats.#{self[:host]}.conf -a -r #{sites_root}/#{self[:host]}/log/apache2.access.log ] && /usr/lib/cgi-bin/awstats.pl -config=#{self[:host]} -update >/dev/null\n\" >> /etc/cron.d/awstats"
|
212
234
|
|
213
235
|
# create .htpasswd file
|
214
|
-
run "test ! -e #{sites_root}/#{self[:host]}/log/.awstatspw || rm #{sites_root}/#{self[:host]}/log/.awstatspw"
|
236
|
+
run "test ! -e #{sites_root}/#{self[:host]}/log/.awstatspw || rm #{sites_root}/#{self[:host]}/log/.awstatspw || true"
|
215
237
|
run "htpasswd -c -b #{sites_root}/#{self[:host]}/log/.awstatspw 'admin' '#{self[:pass]}'"
|
216
238
|
run "chmod 600 #{sites_root}/#{self[:host]}/log/.awstatspw"
|
217
239
|
run "chown www-data:www-data #{sites_root}/#{self[:host]}/log/.awstatspw"
|
@@ -269,7 +291,9 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
269
291
|
|
270
292
|
desc "Apache2 initial setup"
|
271
293
|
task :apache2_setup, :roles => :web do
|
272
|
-
self[:
|
294
|
+
if self[:mongrel_port]
|
295
|
+
self[:ports] = (mongrel_port.to_i...(mongrel_port.to_i + mongrel_count.to_i)).to_a
|
296
|
+
end
|
273
297
|
httpd_conf = render("#{templates}/httpd.rhtml", :config => self)
|
274
298
|
log_rotate = render("#{templates}/logrotate_app.rhtml", :config => self)
|
275
299
|
if debian_host
|
@@ -293,26 +317,25 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
293
317
|
|
294
318
|
desc "install zena gem on remote server"
|
295
319
|
task :gem_update, :roles => :app do
|
296
|
-
run "gem sources -a http://gems.github.com"
|
297
320
|
run "gem install zena"
|
298
321
|
end
|
299
322
|
|
300
323
|
#========================== MYSQL ===============================#
|
301
324
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
325
|
+
namespace :db do
|
326
|
+
desc "set database.yml file according to settings"
|
327
|
+
task :update_config, :roles => :app do
|
328
|
+
db_app_config = render("#{templates}/database.rhtml",
|
329
|
+
:db_name => db_name,
|
330
|
+
:db_user => db_user,
|
331
|
+
:db_password => db_password
|
332
|
+
)
|
333
|
+
put(db_app_config, "#{deploy_to}/current/config/database.yml")
|
334
|
+
end
|
311
335
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
run "mysql -u root -p -e \"DROP DATABASE #{db_name};\"" do |channel, stream, data|
|
336
|
+
desc "create database"
|
337
|
+
task :create, :roles => :db do
|
338
|
+
run "mysql -u root -p -e \"CREATE DATABASE #{db_name} DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; GRANT ALL ON #{db_name}.* TO '#{db_user}'@'localhost' IDENTIFIED BY '#{db_password}';\"" do |channel, stream, data|
|
316
339
|
if data =~ /^Enter password:\s*/m
|
317
340
|
logger.info "#{channel[:host]} asked for password"
|
318
341
|
channel.send_data "#{password}\n"
|
@@ -321,121 +344,156 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
321
344
|
end
|
322
345
|
end
|
323
346
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
347
|
+
desc "drop database"
|
348
|
+
task :drop, :roles => :db do
|
349
|
+
run "mysql -u root -p -e \"DROP DATABASE #{db_name};\"" do |channel, stream, data|
|
350
|
+
if data =~ /^Enter password:\s*/m
|
351
|
+
logger.info "#{channel[:host]} asked for password"
|
352
|
+
channel.send_data "#{password}\n"
|
353
|
+
end
|
354
|
+
puts data
|
328
355
|
end
|
329
|
-
puts data
|
330
356
|
end
|
331
|
-
end
|
332
357
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
db_create
|
358
|
+
desc "initial database setup"
|
359
|
+
task :setup, :roles => :db do
|
360
|
+
create
|
337
361
|
end
|
338
|
-
end
|
339
|
-
|
340
362
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
363
|
+
desc "Database dump"
|
364
|
+
task :dump, :roles => :db do
|
365
|
+
run "mysqldump #{db_name} -u root -p | /bin/gzip > #{dump_root}/`date +%Y-%m-%d_%H:%M`.sql.gz" do |channel, stream, data|
|
366
|
+
if data =~ /^Enter password:\s*/m
|
367
|
+
logger.info "#{channel[:host]} asked for password"
|
368
|
+
channel.send_data "#{password}\n"
|
369
|
+
end
|
370
|
+
puts data
|
371
|
+
end
|
372
|
+
end
|
373
|
+
end # db
|
374
|
+
|
375
|
+
# Would need to be fixed before being used
|
376
|
+
#
|
377
|
+
# desc "Get backup file back"
|
378
|
+
# task :get_backup, :roles => :app do
|
379
|
+
# get "#{deploy_to}/current/#{db_name}_data.tgz", "./#{db_name}_#{Time.now.strftime '%Y-%m-%d-%H'}.tgz"
|
380
|
+
# end
|
381
|
+
#
|
382
|
+
# # FIXME: backup not loading data for every site...
|
383
|
+
# desc "Backup all data and bring it backup here"
|
384
|
+
# task :backup, :roles => :app do
|
385
|
+
# db_dump
|
386
|
+
# # key track of the current svn revision for app
|
387
|
+
#
|
388
|
+
# run "#{in_current} svn info > #{deploy_to}/current/zena_version.txt"
|
389
|
+
# run "#{in_current} rake zena:full_backup RAILS_ENV='production'"
|
390
|
+
# run "#{in_current} tar czf #{db_name}_data.tgz #{db_name}.sql.tgz sites_data.tgz zena_version.txt"
|
391
|
+
# get_backup
|
392
|
+
# end
|
393
|
+
case self[:app_type]
|
394
|
+
when :mongrel
|
395
|
+
#========================== MONGREL ===============================#
|
396
|
+
namespace :app do
|
397
|
+
|
398
|
+
desc "configure mongrel"
|
399
|
+
task :configure, :roles => :app do
|
400
|
+
run "#{in_current} mongrel_rails cluster::configure -e production -p #{mongrel_port} -N #{mongrel_count} -c #{deploy_to}/current -P log/mongrel.pid -l log/mongrel.log -a 127.0.0.1 --user www-data --group www-data"
|
401
|
+
run "#{in_current} echo 'config_script: config/mongrel_upload_progress.conf' >> config/mongrel_cluster.yml"
|
402
|
+
end
|
345
403
|
|
346
|
-
|
404
|
+
desc "Stop the drb upload_progress server"
|
405
|
+
task :upload_progress_stop , :roles => :app do
|
406
|
+
run "#{in_current} ruby lib/upload_progress_server.rb stop"
|
407
|
+
end
|
347
408
|
|
348
|
-
|
409
|
+
desc "Start the drb upload_progress server"
|
410
|
+
task :upload_progress_start , :roles => :app do
|
411
|
+
run "#{in_current} lib/upload_progress_server.rb start"
|
412
|
+
end
|
349
413
|
|
350
|
-
|
414
|
+
desc "Restart the upload_progress server"
|
415
|
+
task :upload_progress_restart, :roles => :app do
|
416
|
+
upload_progress_stop
|
417
|
+
upload_progress_start
|
418
|
+
end
|
351
419
|
|
352
|
-
|
420
|
+
desc "Restart mongrels"
|
421
|
+
task :restart, :roles => :app do
|
422
|
+
stop
|
423
|
+
start
|
424
|
+
end
|
353
425
|
|
354
|
-
|
355
|
-
|
356
|
-
|
426
|
+
desc "Start mongrels"
|
427
|
+
task :start, :roles => :app do
|
428
|
+
configure
|
429
|
+
upload_progress_start
|
430
|
+
run "#{in_current} mongrel_rails cluster::start"
|
431
|
+
end
|
357
432
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
433
|
+
desc "Stop mongrels"
|
434
|
+
task :stop, :roles => :app do
|
435
|
+
configure
|
436
|
+
upload_progress_stop
|
437
|
+
run "#{in_current} mongrel_rails cluster::stop"
|
438
|
+
end
|
439
|
+
end # mongrel
|
440
|
+
when :passenger
|
441
|
+
namespace :upload_progress do
|
442
|
+
desc "Build and install upload progress extension for Apache2"
|
443
|
+
task :setup, :roles => :app do
|
444
|
+
tmp_dir = "/tmp/mod_upload_progress.tmp"
|
445
|
+
c_file = File.read("#{Zena::ROOT}/vendor/apache2_upload_progress/mod_upload_progress.c")
|
446
|
+
run "test -e #{tmp_dir} || mkdir #{tmp_dir}"
|
447
|
+
put c_file, "#{tmp_dir}/mod_upload_progress.c"
|
448
|
+
run "cd #{tmp_dir} && apxs2 -c -i mod_upload_progress.c && rm -rf #{tmp_dir}"
|
364
449
|
end
|
365
|
-
puts data
|
366
450
|
end
|
367
|
-
run "#{in_current} tar czf #{db_name}.sql.tgz #{db_name}.sql"
|
368
|
-
run "#{in_current} rm #{db_name}.sql"
|
369
|
-
end
|
370
451
|
|
371
|
-
|
372
|
-
task :get_backup, :roles => :app do
|
373
|
-
get "#{deploy_to}/current/#{db_name}_data.tgz", "./#{db_name}_#{Time.now.strftime '%Y-%m-%d-%H'}.tgz"
|
374
|
-
end
|
452
|
+
before "zena:setup", "upload_progress:setup"
|
375
453
|
|
376
|
-
|
377
|
-
desc "Backup all data and bring it backup here"
|
378
|
-
task :backup, :roles => :app do
|
379
|
-
db_dump
|
380
|
-
# key track of the current svn revision for app
|
454
|
+
namespace :app do
|
381
455
|
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
Bricks.load_misc('deploy')
|
456
|
+
desc "Restart Passenger app"
|
457
|
+
task :restart, :roles => :app do
|
458
|
+
stop
|
459
|
+
start
|
460
|
+
end
|
389
461
|
|
462
|
+
desc "Start Passenger app"
|
463
|
+
task :start, :roles => :app do
|
464
|
+
run "#{in_current} touch tmp/restart.txt"
|
465
|
+
end
|
390
466
|
|
391
|
-
|
392
|
-
|
467
|
+
desc "Stop Passenger app (only halt upload DRB)"
|
468
|
+
task :stop, :roles => :app do
|
469
|
+
# Cannot stop
|
470
|
+
end
|
393
471
|
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
end
|
472
|
+
desc "Kill Passenger spawner"
|
473
|
+
task :kill, :roles => :app do
|
474
|
+
run "kill $( passenger-memory-stats | grep 'Passenger spawn server' | awk '{ print $1 }' )"
|
475
|
+
end
|
476
|
+
end # passenger
|
477
|
+
end
|
399
478
|
|
400
|
-
|
401
|
-
task :upload_progress_stop , :roles => :app do
|
402
|
-
run "#{in_current} ruby lib/upload_progress_server.rb stop"
|
403
|
-
end
|
479
|
+
#========================== DEPLOY ===============================#
|
404
480
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
481
|
+
namespace :zena do
|
482
|
+
desc "Prepare server for deployment"
|
483
|
+
task :setup, :roles => :app do
|
484
|
+
transaction do
|
485
|
+
app_setup
|
409
486
|
|
410
|
-
|
411
|
-
task :upload_progress_restart, :roles => :app do
|
412
|
-
upload_progress_stop
|
413
|
-
upload_progress_start
|
414
|
-
end
|
487
|
+
db::setup
|
415
488
|
|
416
|
-
|
417
|
-
|
418
|
-
stop
|
419
|
-
start
|
420
|
-
end
|
421
|
-
|
422
|
-
desc "Start mongrels"
|
423
|
-
task :start, :roles => :app do
|
424
|
-
configure
|
425
|
-
upload_progress_start
|
426
|
-
run "#{in_current} mongrel_rails cluster::start"
|
427
|
-
end
|
428
|
-
|
429
|
-
desc "Stop mongrels"
|
430
|
-
task :stop, :roles => :app do
|
431
|
-
configure
|
432
|
-
upload_progress_stop
|
433
|
-
run "#{in_current} mongrel_rails cluster::stop"
|
489
|
+
apache2_setup
|
490
|
+
end
|
434
491
|
end
|
435
492
|
end
|
436
493
|
|
437
|
-
|
494
|
+
before 'deploy:setup', 'zena:setup'
|
438
495
|
|
496
|
+
namespace :deploy do
|
439
497
|
desc "Restart application"
|
440
498
|
task :restart, :roles => :app do
|
441
499
|
|
@@ -446,12 +504,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
446
504
|
self[:on_start].each do |block|
|
447
505
|
block.call
|
448
506
|
end
|
449
|
-
|
450
|
-
|
451
|
-
mongrel.restart
|
452
|
-
else
|
453
|
-
puts "'#{self[:app_type]}' not supported."
|
454
|
-
end
|
507
|
+
|
508
|
+
app.restart
|
455
509
|
end
|
456
510
|
|
457
511
|
desc "Start application"
|
@@ -461,12 +515,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
461
515
|
block.call
|
462
516
|
end
|
463
517
|
|
464
|
-
|
465
|
-
when :mongrel
|
466
|
-
mongrel.start
|
467
|
-
else
|
468
|
-
puts "'#{self[:app_type]}' not supported."
|
469
|
-
end
|
518
|
+
app.start
|
470
519
|
end
|
471
520
|
|
472
521
|
desc "Stop application"
|
@@ -476,14 +525,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
476
525
|
block.call
|
477
526
|
end
|
478
527
|
|
479
|
-
|
480
|
-
when :mongrel
|
481
|
-
mongrel.stop
|
482
|
-
else
|
483
|
-
puts "'#{self[:app_type]}' not supported."
|
484
|
-
end
|
528
|
+
app.stop
|
485
529
|
end
|
486
530
|
|
487
|
-
end
|
488
|
-
|
531
|
+
end # mongrel/deploy
|
489
532
|
end
|
@@ -48,7 +48,7 @@
|
|
48
48
|
# If there is several log files from load balancing servers :
|
49
49
|
# Example: "/pathtotools/logresolvemerge.pl *.log |"
|
50
50
|
#
|
51
|
-
LogFile="
|
51
|
+
LogFile="<%= config[:sites_root] %>/<%= config[:host] %>/log/apache2.access.log"
|
52
52
|
|
53
53
|
|
54
54
|
# Enter the log file type you want to analyze.
|
@@ -150,7 +150,7 @@ LogSeparator=" "
|
|
150
150
|
# Example: "ftp.domain.com"
|
151
151
|
# Example: "domain.com"
|
152
152
|
#
|
153
|
-
SiteDomain="<%= host %>"
|
153
|
+
SiteDomain="<%= config[:host] %>"
|
154
154
|
|
155
155
|
|
156
156
|
# Enter here all other possible domain names, addresses or virtual host
|
@@ -165,7 +165,7 @@ SiteDomain="<%= host %>"
|
|
165
165
|
# Note: You can also use @/mypath/myfile if list of aliases are in a file.
|
166
166
|
# Example: "www.myserver.com localhost 127.0.0.1 REGEX[mydomain\.(net|org)$]"
|
167
167
|
#
|
168
|
-
HostAliases="localhost 127.0.0.1 <%= host %> stats.<%= host %>"
|
168
|
+
HostAliases="localhost 127.0.0.1 <%= config[:host] %> stats.<%= config[:host] %>"
|
169
169
|
|
170
170
|
|
171
171
|
# If you want to have hosts reported by name instead of ip address, AWStats
|
@@ -200,7 +200,7 @@ DNSLookup=2
|
|
200
200
|
# Example: "C:/awstats_data_dir"
|
201
201
|
# Default: "." (means same directory as awstats.pl)
|
202
202
|
#
|
203
|
-
DirData="
|
203
|
+
DirData="<%= config[:sites_root] %>/<%= config[:host] %>/log/awstats"
|
204
204
|
|
205
205
|
|
206
206
|
# Relative or absolute web URL of your awstats cgi-bin directory.
|
data/lib/zena/deploy/httpd.rhtml
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
|
4
4
|
NameVirtualHost *
|
5
5
|
<% if config[:app_type] == :passenger %>
|
6
|
-
LoadModule upload_progress_module
|
6
|
+
LoadModule upload_progress_module /usr/lib/apache2/modules/mod_upload_progress.so
|
7
|
+
PassengerDefaultUser www-data
|
7
8
|
<% elsif config[:app_type] == :mongrel %>
|
8
9
|
<Proxy *>
|
9
10
|
Order allow,deny
|
@@ -15,8 +16,11 @@ LoadModule upload_progress_module <%= config[:app_root] %>/vendor/apache2_upload
|
|
15
16
|
<% end %>
|
16
17
|
|
17
18
|
<ifmodule mode_expires.c>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
ExpiresActive on
|
20
|
+
ExpiresDefault A0
|
21
|
+
ExpiresByType image/jpeg "access plus 1 year"
|
22
|
+
ExpiresByType image/gif "access plus 1 year"
|
23
|
+
ExpiresByType image/png "access plus 1 year"
|
24
|
+
ExpiresByType text/css "access plus 1 year"
|
25
|
+
ExpiresByType application/x-javascript "access plus 1 year"
|
22
26
|
</ifmodule>
|
@@ -1,19 +1,19 @@
|
|
1
|
-
# zena awstats vhost for <%= host %>
|
1
|
+
# zena awstats vhost for <%= config[:host] %>
|
2
2
|
# automatically generated file
|
3
3
|
|
4
4
|
<VirtualHost *>
|
5
|
-
ServerName stats.<%= host %>
|
5
|
+
ServerName stats.<%= config[:host] %>
|
6
6
|
|
7
7
|
DocumentRoot /usr/share/doc/awstats/examples
|
8
|
-
ErrorLog
|
9
|
-
CustomLog
|
8
|
+
ErrorLog <%= config[:sites_root] %>/<%= config[:host] %>/log/apache2.error.log
|
9
|
+
CustomLog <%= config[:sites_root] %>/<%= config[:host] %>/log/apache2.access.log combined
|
10
10
|
|
11
11
|
<location />
|
12
|
-
SetEnv AWSTATS_FORCE_CONFIG <%= host %>
|
12
|
+
SetEnv AWSTATS_FORCE_CONFIG <%= config[:host] %>
|
13
13
|
|
14
14
|
AuthType Basic
|
15
|
-
AuthName "<%= host %> stats"
|
16
|
-
AuthUserFile
|
15
|
+
AuthName "<%= config[:host] %> stats"
|
16
|
+
AuthUserFile <%= config[:sites_root] %>/<%= config[:host] %>/log/.awstatspw
|
17
17
|
Require valid-user
|
18
18
|
</location>
|
19
19
|
|
data/lib/zena/deploy/template.rb
CHANGED
@@ -15,8 +15,12 @@ rakefile("zena_tasks.rake") do
|
|
15
15
|
<<-TASK
|
16
16
|
# sync zena tasks to gem version
|
17
17
|
env = File.read(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment.rb'))
|
18
|
-
if env =~
|
19
|
-
|
18
|
+
if env =~ /^\\s*(#|).*config.gem.*zena.*version.*'(.*?)'/
|
19
|
+
if $1 == '#'
|
20
|
+
# commented out
|
21
|
+
else
|
22
|
+
gem 'zena', "= \#{$2}"
|
23
|
+
end
|
20
24
|
end
|
21
25
|
require 'zena'
|
22
26
|
require 'tasks/zena'
|
data/lib/zena/deploy/vhost.rhtml
CHANGED
@@ -63,10 +63,10 @@
|
|
63
63
|
RewriteRule ^([^.]+)$ $1.html [QSA]
|
64
64
|
|
65
65
|
# Redirect all non-static requests to cluster
|
66
|
-
|
66
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
67
67
|
RewriteRule ^/(.*)$ balancer://<%= config[:balancer] %>%{REQUEST_URI} [P,QSA,L]
|
68
68
|
<% elsif config[:app_type] == :passenger %>
|
69
|
-
PassengerAppRoot
|
69
|
+
PassengerAppRoot <%= config[:app_root] %>
|
70
70
|
|
71
71
|
<Location />
|
72
72
|
# enable tracking uploads in /
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# zena apache2 vhost for <%= host %>
|
1
|
+
# zena apache2 vhost for <%= config[:host] %>
|
2
2
|
# automatically generated file
|
3
3
|
|
4
4
|
<VirtualHost *>
|
5
|
-
ServerName www.<%= host %>
|
5
|
+
ServerName www.<%= config[:host] %>
|
6
6
|
|
7
7
|
RewriteEngine On
|
8
|
-
RewriteCond %{HTTP_HOST} ^www\.<%= host %>$ [NC]
|
9
|
-
RewriteRule ^(.*)$ http://<%= host %>$1 [R=301,L]
|
8
|
+
RewriteCond %{HTTP_HOST} ^www\.<%= config[:host] %>$ [NC]
|
9
|
+
RewriteRule ^(.*)$ http://<%= config[:host] %>$1 [R=301,L]
|
10
10
|
</VirtualHost>
|
data/lib/zena/foxy_parser.rb
CHANGED
@@ -130,11 +130,13 @@ module Zena
|
|
130
130
|
@elements = {}
|
131
131
|
@options = opts
|
132
132
|
end
|
133
|
+
|
134
|
+
def sites
|
135
|
+
@sites ||= Dir["#{Zena::ROOT}/test/sites/*", "#{RAILS_ROOT}/bricks/**/sites/*"].map {|s| File.directory?(s) ? File.basename(s) : nil}.compact.uniq
|
136
|
+
end
|
133
137
|
|
134
138
|
def run
|
135
|
-
|
136
|
-
Dir.foreach("#{Zena::ROOT}/test/sites") do |site|
|
137
|
-
next if site =~ /^\./
|
139
|
+
sites.each do |site|
|
138
140
|
@site = site
|
139
141
|
parse_fixtures
|
140
142
|
after_parse
|
@@ -784,8 +786,7 @@ module Zena
|
|
784
786
|
end
|
785
787
|
|
786
788
|
def run
|
787
|
-
|
788
|
-
next if site =~ /^\./ || !File.directory?(File.join("#{Zena::ROOT}/test/sites",site))
|
789
|
+
sites.each do |site|
|
789
790
|
out ""
|
790
791
|
out "#{site}:"
|
791
792
|
out_pair('site_id', Zena::FoxyParser::multi_site_id(site))
|
data/lib/zena/info.rb
CHANGED
@@ -9,7 +9,7 @@ ZENA_CALENDAR_LANGS = ["en", "fr", "de"] # FIXME: build this dynamically from ex
|
|
9
9
|
ENABLE_XSENDFILE = false
|
10
10
|
|
11
11
|
module Zena
|
12
|
-
VERSION = '0.16.
|
12
|
+
VERSION = '0.16.9'
|
13
13
|
REVISION = 1336
|
14
14
|
ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
15
15
|
end
|
data/zena.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{zena}
|
8
|
-
s.version = "0.16.
|
8
|
+
s.version = "0.16.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Gaspard Bucher"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-21}
|
13
13
|
s.default_executable = %q{zena}
|
14
14
|
s.description = %q{zena is a Ruby on Rails CMS (content managment system) with a focus on usability, ease of customization and web 2.0 goodness (application like behaviour).}
|
15
15
|
s.email = %q{gaspard@teti.ch}
|
@@ -2020,7 +2020,7 @@ Gem::Specification.new do |s|
|
|
2020
2020
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
2021
2021
|
s.add_runtime_dependency(%q<ruby-recaptcha>, ["= 1.0.0"])
|
2022
2022
|
s.add_runtime_dependency(%q<tzinfo>, [">= 0.3.12"])
|
2023
|
-
s.add_runtime_dependency(%q<rubyless>, ["
|
2023
|
+
s.add_runtime_dependency(%q<rubyless>, ["= 0.3.5"])
|
2024
2024
|
s.add_runtime_dependency(%q<rails>, ["= 2.3.4"])
|
2025
2025
|
s.add_runtime_dependency(%q<uuidtools>, ["= 2.0.0"])
|
2026
2026
|
s.add_runtime_dependency(%q<authlogic>, ["= 2.1.3"])
|
@@ -2039,7 +2039,7 @@ Gem::Specification.new do |s|
|
|
2039
2039
|
else
|
2040
2040
|
s.add_dependency(%q<ruby-recaptcha>, ["= 1.0.0"])
|
2041
2041
|
s.add_dependency(%q<tzinfo>, [">= 0.3.12"])
|
2042
|
-
s.add_dependency(%q<rubyless>, ["
|
2042
|
+
s.add_dependency(%q<rubyless>, ["= 0.3.5"])
|
2043
2043
|
s.add_dependency(%q<rails>, ["= 2.3.4"])
|
2044
2044
|
s.add_dependency(%q<uuidtools>, ["= 2.0.0"])
|
2045
2045
|
s.add_dependency(%q<authlogic>, ["= 2.1.3"])
|
@@ -2059,7 +2059,7 @@ Gem::Specification.new do |s|
|
|
2059
2059
|
else
|
2060
2060
|
s.add_dependency(%q<ruby-recaptcha>, ["= 1.0.0"])
|
2061
2061
|
s.add_dependency(%q<tzinfo>, [">= 0.3.12"])
|
2062
|
-
s.add_dependency(%q<rubyless>, ["
|
2062
|
+
s.add_dependency(%q<rubyless>, ["= 0.3.5"])
|
2063
2063
|
s.add_dependency(%q<rails>, ["= 2.3.4"])
|
2064
2064
|
s.add_dependency(%q<uuidtools>, ["= 2.0.0"])
|
2065
2065
|
s.add_dependency(%q<authlogic>, ["= 2.1.3"])
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 16
|
8
|
-
-
|
9
|
-
version: 0.16.
|
8
|
+
- 9
|
9
|
+
version: 0.16.9
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Gaspard Bucher
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-09-21 00:00:00 +02:00
|
18
18
|
default_executable: zena
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
prerelease: false
|
51
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - "="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
segments:
|
56
56
|
- 0
|