capobvious 0.2.3 → 0.2.4
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/lib/capistrano/ext/capobvious.rb +63 -7
- data/lib/capobvious/version.rb +1 -1
- metadata +3 -3
|
@@ -18,6 +18,8 @@ Capistrano::Configuration.instance.load do
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
set :unicorn_init, "unicorn_#{application}"
|
|
21
|
+
set :unicorn_conf, "#{current_path}/config/unicorn.rb"
|
|
22
|
+
set :unicorn_pid, "#{shared_path}/pids/unicorn.pid"
|
|
21
23
|
|
|
22
24
|
psql = "psql -h localhost"
|
|
23
25
|
psql_postgres = "#{psql} -U postgres"
|
|
@@ -55,7 +57,7 @@ Capistrano::Configuration.instance.load do
|
|
|
55
57
|
set :timestamp, Time.new.to_i.to_s
|
|
56
58
|
set :db_archive_ext, "tar.bz2"
|
|
57
59
|
set :arch_extract, "tar -xvjf"
|
|
58
|
-
set :arch_create, "tar -
|
|
60
|
+
set :arch_create, "tar -cvjf"
|
|
59
61
|
|
|
60
62
|
set :db_file_name, "#{database}-#{timestamp}.sql"
|
|
61
63
|
set :sys_file_name, "#{application}-system-#{timestamp}.#{db_archive_ext}"
|
|
@@ -220,11 +222,11 @@ Capistrano::Configuration.instance.load do
|
|
|
220
222
|
task :sys do
|
|
221
223
|
backup.sys
|
|
222
224
|
system "rm -rfv public/system/"
|
|
223
|
-
system "#{arch_extract}
|
|
224
|
-
end
|
|
225
|
-
task :db do
|
|
226
|
-
db.pg_import
|
|
225
|
+
system "cd public && #{arch_extract} ../#{local_folder_path}/#{sys_file_name}"
|
|
227
226
|
end
|
|
227
|
+
# task :db do
|
|
228
|
+
# db.pg_import
|
|
229
|
+
# end
|
|
228
230
|
end
|
|
229
231
|
|
|
230
232
|
#def prompt_with_default(var, default)
|
|
@@ -462,6 +464,62 @@ Capistrano::Configuration.instance.load do
|
|
|
462
464
|
end
|
|
463
465
|
|
|
464
466
|
|
|
467
|
+
def which(name)
|
|
468
|
+
run "which #{name}"
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
namespace :runit do
|
|
473
|
+
desc "init"
|
|
474
|
+
task :init, :roles => :web do
|
|
475
|
+
join_ruby = rvm_ruby_string[/\d.\d.\d/].delete('.')
|
|
476
|
+
local_runit_path = "#{shared_path}/runit_temp"
|
|
477
|
+
runit = "/etc/sv/#{application}"
|
|
478
|
+
runit_path = "/etc/service/#{application}"
|
|
479
|
+
wrapper = "#{join_ruby}_unicorn"
|
|
480
|
+
logger.important('Creating unicorn wrapper', 'runit')
|
|
481
|
+
run "rvm wrapper #{rvm_ruby_string} #{join_ruby} unicorn"
|
|
482
|
+
|
|
483
|
+
run = <<EOF
|
|
484
|
+
#!/bin/sh
|
|
485
|
+
exec 2>&1
|
|
486
|
+
export USER=#{user}
|
|
487
|
+
export HOME=/home/$USER
|
|
488
|
+
export RAILS_ENV=#{rails_env}
|
|
489
|
+
UNICORN="/home/#{user}/.rvm/bin/#{wrapper}"
|
|
490
|
+
UNICORN_CONF=#{unicorn_conf}
|
|
491
|
+
cd #{current_path}
|
|
492
|
+
exec chpst -u $USER:$USER $UNICORN -c $UNICORN_CONF
|
|
493
|
+
EOF
|
|
494
|
+
log_run = <<EOF
|
|
495
|
+
#!/bin/bash
|
|
496
|
+
LOG_FOLDER=/var/log/#{application}
|
|
497
|
+
mkdir -p $LOG_FOLDER
|
|
498
|
+
exec svlogd -tt $LOG_FOLDER
|
|
499
|
+
EOF
|
|
500
|
+
|
|
501
|
+
logger.important('Creating local runit path', 'runit')
|
|
502
|
+
run "mkdir -p #{local_runit_path}/log"
|
|
503
|
+
logger.important('Creating run script', 'runit')
|
|
504
|
+
put run, "#{local_runit_path}/run"
|
|
505
|
+
run "chmod +x #{local_runit_path}/run"
|
|
506
|
+
logger.important('Creating log script', 'runit')
|
|
507
|
+
put log_run, "#{local_runit_path}/log/run"
|
|
508
|
+
run "chmod +x #{local_runit_path}/log/run"
|
|
509
|
+
|
|
510
|
+
run "#{sudo} mv #{local_runit_path} #{runit} && #{sudo} ln -s #{runit} #{runit_path}"
|
|
511
|
+
sudo chown -R root:root /etc/sv/three-elements/
|
|
512
|
+
|
|
513
|
+
#logger.important('Creating symlink', 'runit')
|
|
514
|
+
#symlink = "#{sudo} ln -s #{local_runit_path} #{runit_path}"
|
|
515
|
+
#run symlink
|
|
516
|
+
|
|
517
|
+
#puts "$ cat #{runit_path}/run"
|
|
518
|
+
#puts run
|
|
519
|
+
end
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
|
|
465
523
|
|
|
466
524
|
# Check if remote file exists
|
|
467
525
|
#
|
|
@@ -475,8 +533,6 @@ Capistrano::Configuration.instance.load do
|
|
|
475
533
|
capture("ps -p $(cat #{pid_file}) ; true").strip.split("\n").size == 2
|
|
476
534
|
end
|
|
477
535
|
|
|
478
|
-
set :unicorn_conf, "#{current_path}/config/unicorn.rb"
|
|
479
|
-
set :unicorn_pid, "#{shared_path}/pids/unicorn.pid"
|
|
480
536
|
namespace :unicorn do
|
|
481
537
|
desc "start unicorn"
|
|
482
538
|
task :start do
|
data/lib/capobvious/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capobvious
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-10-03 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: capistrano
|
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
79
79
|
version: '0'
|
|
80
80
|
requirements: []
|
|
81
81
|
rubyforge_project: capobvious
|
|
82
|
-
rubygems_version: 1.8.
|
|
82
|
+
rubygems_version: 1.8.24
|
|
83
83
|
signing_key:
|
|
84
84
|
specification_version: 3
|
|
85
85
|
summary: Cap recipes
|