-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.rb
46 lines (34 loc) · 1.33 KB
/
deploy.rb
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
35
36
37
38
39
40
41
42
43
44
45
46
require 'bundler/capistrano'
load 'deploy/assets'
role :web, "YOUR.HOST.NAME" # Your HTTP server, Apache/etc
role :app, "YOUR.HOST.NAME" # This may be the same as your `Web` server
role :db, "YOUR.HOST.NAME", :primary => true # This is where Rails migrations will run
set :application, "tubechat"
set :repository, "https://github.com/speedyrails/tubesock-chat.git"
set(:deploy_to) { "/var/www/apps/#{application}" }
set :user, "deploy"
set :deploy_via, :remote_cache
set :scm, "git"
set :keep_releases, 5
after "deploy", "deploy:cleanup"
after "deploy:migrations", "deploy:cleanup"
after "deploy:update_code", "deploy:symlink_configs"
namespace :deploy do
desc "Tasks to execute after code update"
task :symlink_configs, :roles => [:app] do
# run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml"
run "if [ -d #{release_path}/tmp ]; then rm -rf #{release_path}/tmp; fi; ln -nfs #{deploy_to}/#{shared_dir}/tmp #{release_path}/tmp"
end
desc "Start puma server"
task :start, :roles => [:app] do
run "/etc/init.d/puma start #{application}"
end
desc "Stop puma server"
task :stop, :roles => [:app] do
run "/etc/init.d/puma stop #{application}"
end
desc "Restart puma server"
task :restart, :roles => [:app] do
run "/etc/init.d/puma restart #{application}"
end
end