Cross Reference: deploy.rb
xref
: /
ontohub
/
config
/
deploy.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
deploy.rb revision 6b0d500127a7a81b43af4241d97c23bdce341456
0
N/A
require
'
bundler
/
capistrano
'
0
N/A
0
N/A
# RVM
0
N/A
$:.
unshift
(
File.expand
_path
(
'./lib'
,
ENV
[
'rvm_path'
])
)
0
N/A
require
'
rvm
/
capistrano
'
0
N/A
set
:
rvm_ruby_string
,
'1.9.3@ontohub'
0
N/A
0
N/A
hostname
=
'
ontohub.orgizm.net
'
0
N/A
0
N/A
set
:
application
,
'ontohub'
0
N/A
set
:
scm
, :
git
0
N/A
set
:
repository
,
"git@github.com:digineo/#{application}.git"
0
N/A
set
:
deploy_to
,
"/
srv
/
http
/#{hostname}"
0
N/A
0
N/A
set
:
user
,
application
0
N/A
set
:
use_sudo
,
false
0
N/A
set
:
deploy_via
, :
remote_cache
0
N/A
0
N/A
role
:
app
,
hostname
0
N/A
role
:
web
,
hostname
0
N/A
role
:
db
,
hostname
, :
primary
=>
true
0
N/A
0
N/A
namespace
:
deploy
do
0
N/A
desc
"Restart Application"
0
N/A
task
:
restart
, :
roles
=> :
app
, :
except
=>
{ :
no_release
=>
true
}
do
0
N/A
run
"touch #{current_path}/
tmp
/
restart.txt
"
0
N/A
end
0
N/A
end
0
N/A
0
N/A
namespace
:
resque
do
0
N/A
def
rake_command
(
cmd
)
0
N/A
run
"cd #{current_path} && bundle exec rake #{cmd}"
, :
env
=>
{ :
RAILS_ENV
=>
rails_env
}
0
N/A
end
0
N/A
0
N/A
desc
"Stop resque"
0
N/A
task
:
stop
do
0
N/A
rake_command
'resque:stop'
0
N/A
end
0
N/A
end
0
N/A
0
N/A
#
https://makandracards.com/makandra/1431-resque-+-god-+-capistrano
0
N/A
namespace
:
god
do
0
N/A
def
god_is_running
0
N/A
!
capture
(
"#{god_command} status >/
dev
/
null
2>/
dev
/
null
|| echo 'not running'"
)
.
start_with
?
(
'not running'
)
0
N/A
end
0
N/A
0
N/A
def
god_command
0
N/A
"cd #{current_path}; bundle exec god"
0
N/A
end
0
N/A
0
N/A
desc
"Start god"
0
N/A
task
:
start
do
0
N/A
run
"#{god_command} -c
config
/
god
/
app.rb
"
, :
env
=>
environment
=
{ :
RAILS_ENV
=>
rails_env
}
0
N/A
end
0
N/A
0
N/A
desc
"Stop god"
0
N/A
task
:
stop
do
0
N/A
if
god_is_running
0
N/A
run
"#{god_command} terminate"
0
N/A
end
0
N/A
end
0
N/A
0
N/A
desc
"Test if god is running"
0
N/A
task
:
status
do
0
N/A
puts
god_is_running
?
"God is running"
:
"God is NOT running"
0
N/A
end
0
N/A
end
0
N/A
0
N/A
before
"deploy:update"
,
"god:stop"
0
N/A
before
"deploy:update"
,
"resque:stop"
0
N/A
after
"deploy:update"
,
"god:start"
after
:
deploy
,
"deploy:cleanup"