-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCapfile-static.sample
52 lines (39 loc) · 1.26 KB
/
Capfile-static.sample
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
47
48
49
50
51
52
require 'capistrano-zen/nginx'
# enable prompt for password
default_run_options[:pty] = true
# try_sudo will not use sudo by default
set :use_sudo, false
# access github.com using as the local user
ssh_options[:forward_agent] = true
set :application, "application name"
set :domain, "domain.com"
# maxwell - 42.121.82.106, aliyun,hangzhou
server 'server_name', :web, :app, :db, :primary => true
set :user, 'deploy'
set :deploy_to, "/home/#{user}/sites/#{application}-production"
namespace :deploy do
desc "Deploys your project. This calls both `update' and `nginx.restart'. "
task :default, roles: :app do
update
nginx.restart
end
desc "Setup the directory for the application."
task :setup, roles: :app do
dirs = [deploy_to]
run "mkdir -p #{dirs.join(' ')}"
run "chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true)
end
desc "Update the dest code for this application."
task :update, roles: :app do
# your own deploy logic
# sample for a middleman site
# system('bundle exec middleman build --clean')
# roles[:app].servers.each do |server|
# system("rsync -cuavz build/* #{user}@#{server}:#{deploy_to}")
# end
end
end
after "deploy:install",
"nginx:install"
after "deploy:setup",
"nginx:setup:static"