xgamerx-cap-recipes 0.0.4 → 0.0.5
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/cap_recipes/tasks/apache.rb +8 -9
- data/lib/cap_recipes/tasks/passenger.rb +30 -24
- data/lib/cap_recipes/version.rb +1 -1
- metadata +1 -1
@@ -1,39 +1,38 @@
|
|
1
1
|
Capistrano::Configuration.instance(true).load do
|
2
|
-
|
2
|
+
|
3
3
|
set :apache_init_path, "/etc/init.d/apache2"
|
4
|
-
|
4
|
+
|
5
5
|
# ===============================================================
|
6
6
|
# SERVER MANAGEMENT
|
7
7
|
# ===============================================================
|
8
|
-
|
8
|
+
|
9
9
|
namespace :apache do
|
10
10
|
desc "Stops the apache web server"
|
11
11
|
task :stop, :role => :app do
|
12
12
|
puts "Stopping the apache server"
|
13
13
|
sudo "#{apache_init_path} stop"
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
desc "Starts the apache web server"
|
17
17
|
task :start, :role => :app do
|
18
18
|
puts "Starting the apache server"
|
19
19
|
sudo "#{apache_init_path} start"
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
desc "Restarts the apache web server"
|
23
23
|
task :restart, :role => :app do
|
24
24
|
puts "Restarting the apache server"
|
25
25
|
sudo "#{apache_init_path} restart"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
# ===============================================================
|
29
29
|
# INSTALLATION
|
30
30
|
# ===============================================================
|
31
|
-
|
31
|
+
|
32
32
|
desc 'Installs apache 2 and development headers to compile passenger'
|
33
33
|
task :install, :roles => :web do
|
34
34
|
puts 'Installing apache 2'
|
35
35
|
sudo 'apt-get install apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapr1 libapr1-dev libaprutil1 libmagic1 libpcre3 libpq5 openssl apache2-prefork-dev -y'
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
39
|
-
end
|
38
|
+
end
|
@@ -1,86 +1,92 @@
|
|
1
1
|
Capistrano::Configuration.instance(true).load do
|
2
|
-
|
2
|
+
|
3
3
|
# ===============================================================
|
4
4
|
# DEPLOYMENT SCRIPTS
|
5
|
-
# ===============================================================
|
6
|
-
|
5
|
+
# ===============================================================
|
6
|
+
|
7
7
|
namespace :deploy do
|
8
|
-
|
8
|
+
|
9
9
|
# ===============================================================
|
10
10
|
# SERVER MANAGEMENT
|
11
11
|
# ===============================================================
|
12
|
-
|
12
|
+
|
13
13
|
desc "Stops the phusion passenger server"
|
14
14
|
task :stop, :role => :app do
|
15
15
|
puts "Stopping rails web server"
|
16
16
|
apache.stop
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
desc "Starts the phusion passenger server"
|
20
20
|
task :start, :role => :app do
|
21
21
|
puts "Starting rails web server"
|
22
22
|
apache.start
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
desc "Restarts the phusion passenger server"
|
26
26
|
task :restart, :role => :app do
|
27
27
|
puts "Restarting the application"
|
28
28
|
run "touch #{current_path}/tmp/restart.txt"
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
desc "Update code on server, apply migrations, and restart passenger server"
|
32
32
|
task :with_migrations, :role => :app do
|
33
33
|
deploy.update
|
34
34
|
deploy.migrate
|
35
35
|
deploy.restart
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
# ===============================================================
|
39
39
|
# UTILITY TASKS
|
40
40
|
# ===============================================================
|
41
|
-
|
41
|
+
|
42
42
|
desc "Copies the shared/config/database yaml to release/config/"
|
43
43
|
task :copy_config, :role => :app do
|
44
44
|
puts "Copying database configuration to release path"
|
45
45
|
sudo "cp #{shared_path}/config/database.yml #{release_path}/config/"
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
|
+
desc "Repair permissions to allow user to perform all actions"
|
49
|
+
task :repair_permissions, :role => :app do
|
50
|
+
puts "Applying correct permissions to allow for proper command execution"
|
51
|
+
sudo "chmod -R 744 #{current_path}"
|
52
|
+
end
|
53
|
+
|
48
54
|
desc "Displays the production log from the server locally"
|
49
55
|
task :tail, :role => :app do
|
50
|
-
stream "tail -f #{shared_path}/log/production.log"
|
56
|
+
stream "tail -f #{shared_path}/log/production.log"
|
51
57
|
end
|
52
|
-
|
58
|
+
|
53
59
|
# ===============================================================
|
54
60
|
# INSTALLATION
|
55
61
|
# ===============================================================
|
56
|
-
|
62
|
+
|
57
63
|
task :install, :role => :app do
|
58
64
|
puts 'Installing passenger gems'
|
59
65
|
sudo 'gem install fastthread passenger'
|
60
66
|
end
|
61
|
-
end
|
62
|
-
|
67
|
+
end
|
68
|
+
|
63
69
|
# ===============================================================
|
64
70
|
# MAINTENANCE TASKS
|
65
|
-
# ===============================================================
|
71
|
+
# ===============================================================
|
66
72
|
namespace :sweep do
|
67
73
|
desc "Clear file-based fragment and action caching"
|
68
74
|
task :log, :role => :app do
|
69
75
|
puts "Sweeping all the log files"
|
70
|
-
run "cd #{current_path} && sudo rake log:clear RAILS_ENV=production"
|
76
|
+
run "cd #{current_path} && sudo rake log:clear RAILS_ENV=production"
|
71
77
|
end
|
72
|
-
|
78
|
+
|
73
79
|
desc "Clear file-based fragment and action caching"
|
74
80
|
task :cache, :role => :app do
|
75
81
|
puts "Sweeping the fragment and action cache stores"
|
76
|
-
run "cd #{current_path} && rake tmp:cache:clear RAILS_ENV=production"
|
82
|
+
run "cd #{current_path} && rake tmp:cache:clear RAILS_ENV=production"
|
77
83
|
end
|
78
84
|
end
|
79
|
-
|
85
|
+
|
80
86
|
# ===============================================================
|
81
87
|
# TASK CALLBACKS
|
82
|
-
# ===============================================================
|
83
|
-
|
88
|
+
# ===============================================================
|
89
|
+
after "deploy:update_code", "deploy:repair_permissions" # fix the permissions to work properly
|
84
90
|
after "deploy:update_code", "deploy:copy_config" # copy database.yml file to release path
|
85
91
|
after "deploy:update_code", "sweep:cache" # clear cache after updating code
|
86
|
-
end
|
92
|
+
end
|
data/lib/cap_recipes/version.rb
CHANGED