itrigga-cap_deploy 0.0.2 → 0.0.3
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 +1 -1
- data/lib/itrigga/cap_deploy/cap_tasks.rb +105 -91
- data/lib/itrigga/cap_deploy/hooks.rb +13 -7
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -1,101 +1,115 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
2
|
+
Capistrano::Configuration.instance(:must_exist) :
|
3
|
+
Capistrano.configuration(:must_exist)
|
4
|
+
|
5
|
+
configuration.load do
|
6
|
+
def with_role(role, &block)
|
7
|
+
original, ENV['HOSTS'] = ENV['HOSTS'], find_servers(:roles =>role).map{|d| d.host}.join(",")
|
8
|
+
begin
|
9
|
+
yield
|
10
|
+
ensure
|
11
|
+
ENV['HOSTS'] = original
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
task :symlink_init_d_script do
|
16
|
+
puts "ensuring init_d script is symlinked"
|
17
|
+
run "test -L /etc/init.d/#{application_stub} || #{sudo} ln -s #{script_path}/init_d /etc/init.d/#{application_stub}"
|
18
|
+
end
|
19
|
+
|
20
|
+
task :symlink_log_dirs do
|
21
|
+
puts "ensuring #{std_log_dir} exists"
|
22
|
+
mkdir_unless_exists( std_log_dir )
|
23
|
+
puts "setting ownership on #{std_log_dir} & files to #{user}"
|
24
|
+
run "#{sudo} chown -R #{user} #{std_log_dir}"
|
25
|
+
|
26
|
+
shared_log_dir = "#{shared_dir}/log"
|
27
|
+
puts "ensuring #{shared_log_dir} exists"
|
28
|
+
mkdir_unless_exists( shared_log_dir )
|
29
|
+
|
30
|
+
puts "ensuring log dir #{shared_log_dir} is symlinked to #{std_log_dir}"
|
31
|
+
symlink_dir( std_log_dir, shared_log_dir )
|
32
|
+
puts "setting ownership on #{shared_log_dir} & files to #{user}"
|
33
|
+
run "#{sudo} chown -R #{user} #{shared_log_dir}"
|
34
|
+
|
35
|
+
puts "ensuring log dir #{web_dir}/log is symlinked to #{std_log_dir}"
|
36
|
+
symlink_dir( std_log_dir, "#{web_dir}/log" )
|
37
|
+
|
38
|
+
puts "setting ownership on log dir & files to #{user}"
|
39
|
+
run "#{sudo} chown -R #{user} #{web_dir}/log"
|
40
|
+
|
41
|
+
puts "removing default #{current_path}/log symlink"
|
42
|
+
run "#{sudo} rm #{current_path}/log"
|
43
|
+
end
|
44
|
+
|
45
|
+
task :symlink_pid_dirs do
|
46
|
+
std_pid_dir = "#{web_dir}/tmp/pids"
|
47
|
+
shared_pid_dir = "#{shared_dir}/pids"
|
35
48
|
|
36
|
-
|
37
|
-
|
49
|
+
puts "ensuring #{shared_pid_dir} exists"
|
50
|
+
mkdir_unless_exists( shared_pid_dir )
|
38
51
|
|
39
|
-
|
40
|
-
|
52
|
+
puts "ensuring #{std_pid_dir} exists"
|
53
|
+
mkdir_unless_exists( std_pid_dir )
|
41
54
|
|
42
|
-
|
43
|
-
|
55
|
+
puts "ensuring pid dir #{std_pid_dir} is symlinked to #{shared_pid_dir}"
|
56
|
+
symlink_dir( shared_pid_dir, std_pid_dir )
|
44
57
|
|
45
|
-
|
46
|
-
|
58
|
+
puts "setting ownership on #{web_dir}/tmp & files to #{user}"
|
59
|
+
run "#{sudo} chown -R #{user} #{web_dir}/tmp"
|
47
60
|
|
48
|
-
|
49
|
-
|
50
|
-
end
|
61
|
+
puts "setting ownership on #{shared_pid_dir} & files to #{user}"
|
62
|
+
run "#{sudo} chown -R #{user} #{shared_pid_dir}"
|
63
|
+
end
|
51
64
|
|
52
|
-
task :symlink_site_cache_dir do
|
53
|
-
|
54
|
-
|
65
|
+
task :symlink_site_cache_dir do
|
66
|
+
puts "Removing existing symlink from /tmp/cache/sites"
|
67
|
+
run "(test -d #{web_dir}/tmp/cache && #{sudo} rm -rf #{web_dir}/tmp/cache) || echo 'no existing /tmp/cache dir'"
|
55
68
|
|
56
|
-
|
57
|
-
|
69
|
+
puts "Creating /shared/cache/sites dir if needed"
|
70
|
+
run "mkdir -p #{shared_dir}/cache/sites && #{sudo} chown -R #{user} #{shared_dir}/cache"
|
58
71
|
|
59
|
-
|
60
|
-
|
72
|
+
puts "Symlinking /shared/cache into /tmp/"
|
73
|
+
symlink_dir("#{shared_dir}/cache","#{web_dir}/tmp/cache")
|
61
74
|
|
62
|
-
end
|
63
|
-
|
64
|
-
task :regenerate_monit do
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
task :resymlink_monit do
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
task :reload_monit do
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
task :regenerate_logrotate do
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
task :resymlink_logrotate do
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
task :chown_entire_project_dir do
|
99
|
-
|
100
|
-
|
75
|
+
end
|
76
|
+
|
77
|
+
task :regenerate_monit do
|
78
|
+
puts "regenerating monit config file"
|
79
|
+
run "(test -d #{web_dir}/config/monit && #{sudo} rm -rf #{web_dir}/config/monit/*) || mkdir -p #{web_dir}/config/monit"
|
80
|
+
run "cd #{web_dir} && ruby script/generate monit"
|
81
|
+
puts "setting permissions & ownership on monit config files"
|
82
|
+
run "#{sudo} chmod 0700 #{web_dir}/config/monit/* && #{sudo} chown root #{web_dir}/config/monit/*"
|
83
|
+
end
|
84
|
+
|
85
|
+
task :resymlink_monit do
|
86
|
+
std_monit_file = "/etc/monit/conf.d/#{application_stub}"
|
87
|
+
puts "re-symlinking monit config"
|
88
|
+
run "(test -L #{std_monit_file} && #{sudo} rm #{std_monit_file}) || echo 'no existing link'"
|
89
|
+
run "#{sudo} ln -s #{web_dir}/config/monit/monit.`readlink /etc/trigga_config_file | xargs basename`.config #{std_monit_file} "
|
90
|
+
end
|
91
|
+
|
92
|
+
task :reload_monit do
|
93
|
+
run "#{sudo} monit reload"
|
94
|
+
end
|
95
|
+
|
96
|
+
task :regenerate_logrotate do
|
97
|
+
puts "regenerating logrotate config file"
|
98
|
+
run "#{sudo} rm #{web_dir}/config/log_rotate/* && cd #{web_dir} && ruby script/generate logrotate"
|
99
|
+
puts "setting permissions & ownership on logrotate config files"
|
100
|
+
run "#{sudo} chmod 0700 #{web_dir}/config/log_rotate/* && #{sudo} chown root #{web_dir}/config/log_rotate/*"
|
101
|
+
end
|
102
|
+
|
103
|
+
task :resymlink_logrotate do
|
104
|
+
logrotate_config_file = "#{web_dir}/config/log_rotate/log_rotate.#{File.basename(trigga_config_file)}.config"
|
105
|
+
std_logrotate_file = "/etc/logrotate.d/#{application_stub}"
|
106
|
+
puts "re-symlinking logrotate config"
|
107
|
+
run "(test -L #{std_logrotate_file} && #{sudo} rm #{std_logrotate_file}) || echo nothing to remove"
|
108
|
+
run "#{sudo} ln -s #{web_dir}/config/log_rotate/log_rotate.`readlink /etc/trigga_config_file | xargs basename`.config #{std_logrotate_file} "
|
109
|
+
end
|
110
|
+
|
111
|
+
task :chown_entire_project_dir do
|
112
|
+
puts "chowning entire #{application_stub} dir to #{user}"
|
113
|
+
run "#{sudo} chown -R #{user} #{deploy_to}"
|
114
|
+
end
|
101
115
|
end
|
@@ -1,7 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
after "deploy:
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
2
|
+
Capistrano::Configuration.instance(:must_exist) :
|
3
|
+
Capistrano.configuration(:must_exist)
|
4
|
+
|
5
|
+
configuration.load do
|
6
|
+
after "deploy:setup", :chown_entire_project_dir
|
7
|
+
after "deploy:symlink", :symlink_init_d_script
|
8
|
+
after "deploy:symlink", :symlink_log_dirs
|
9
|
+
after "deploy:symlink", :symlink_pid_dirs
|
10
|
+
after "deploy:symlink", :symlink_site_cache_dir
|
11
|
+
# only keep the last 5 releases (otherwise diskspace balloons)
|
12
|
+
after "deploy:update", "deploy:cleanup"
|
13
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itrigga-cap_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Al Davidson
|