-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCapfile
55 lines (45 loc) · 1.21 KB
/
Capfile
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
53
54
55
load 'deploy'
set :stages, %w(demo staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
set :user, 'utah'
set :application, 'mendocino'
# domain is set in config/deploy/{stage}.rb
# file paths
set :repository, "[email protected]:utahstreetlabs/#{application}.git"
set(:deploy_to) { "/home/#{user}/#{application}" }
# one server plays all roles
role :app do
fetch(:domain)
end
set :deploy_via, :remote_cache
set :scm, 'git'
set :scm_verbose, true
set(:branch) do
case stage
when "production" then "production"
else "staging"
end
end
set :use_sudo, false
after "deploy:symlink", "deploy:build"
after "deploy", "deploy:cleanup"
namespace :deploy do
task :build do
run <<-EOC
cd #{release_path} && \
bin/lein uberjar && \
ln -s #{release_path}/target/mendocino-*-standalone.jar #{release_path}/target/mendocino-standalone.jar
EOC
end
task :start, :roles => :app, :except => { :no_release => true } do
run "#{sudo} start #{application}"
end
task :stop, :roles => :app, :except => { :no_release => true } do
run "#{sudo} stop #{application}; true"
end
task :restart, :roles => :app, :except => { :no_release => true } do
stop
start
end
end