Skip to content

Commit

Permalink
Update Capfile for deployment to depesz.com.
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Jan 9, 2012
1 parent 2deba73 commit 607d34b
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions Capfile
Expand Up @@ -4,6 +4,10 @@
# cap deploy:setup # cap deploy:setup
# cap deploy:cold -s branch=$tag # cap deploy:cold -s branch=$tag
# cap deploy -s branch=$tag # cap deploy -s branch=$tag
#
# -s options:
# * user - Deployment user; default: "pgxn"
# * pgxn_user - User to run the app; default: "pgxn_site"


load 'deploy' load 'deploy'


Expand All @@ -17,12 +21,16 @@ set :deploy_via, :remote_cache
set :use_sudo, false set :use_sudo, false
set :branch, "master" set :branch, "master"
set :deploy_to, "~/pgxn-site" set :deploy_to, "~/pgxn-site"
set :run_from, "/var/www/#{domain}" set :run_from, "/var/virtuals/pgxn/#{application}.#{domain}"
set :api_root, "/var/virtuals/pgxn/api.#{domain}/www"
set :user, "pgxn"
set :pgxn_user, "pgxn_site"
set :host, "depesz.com"


# Prevent creation of Rails-style shared directories. # Define the shared directories we need.
set :shared_children, %() set :shared_children, %w(log pids)


role :app, 'xanthan.postgresql.org' role :app, host


namespace :deploy do namespace :deploy do
desc 'Confirm attempts to deploy master' desc 'Confirm attempts to deploy master'
Expand All @@ -42,7 +50,8 @@ namespace :deploy do
perl Build.PL || exit $?; perl Build.PL || exit $?;
./Build installdeps || exit $?; ./Build installdeps || exit $?;
./Build || exit $?; ./Build || exit $?;
ln -s #{shared_path}/www #{latest_release}/www; ln -fs #{shared_path}/log || exit $?;
ln -fs #{shared_path}/pids || exit $?;
CMD CMD
end end


Expand All @@ -52,27 +61,35 @@ namespace :deploy do
end end


task :symlink_production do task :symlink_production do
run "sudo ln -fs #{ latest_release } #{ run_from }" run "ln -fs #{ latest_release } #{ run_from }"
end end


task :migrate do task :migrate do
# Do nothing. # Do nothing.
end end


task :start do task :start do
run 'sudo /etc/init.d/pgxn-site start' # run 'sudo /etc/init.d/pgxn-site start'
run "cd #{ run_from } && blib/script/pgxn_site_server -s Starman -E prod --workers 5 --preload-app --max-requests 100 --listen 127.0.0.1:7498 --daemonize --pid pids/pgxn_site.pid --error-log log/pgxn_site.log --errors-to pgxn-admins@googlegroups.com --errors-from pgxn@pgexperts.com --feedback-to pgxn@pgexperts.com --api-url http://api.pgxn.org/ --private-api-url file:/var/virtuals/pgxn/api.#{ domain }/www/ --reverse-proxy", :hosts => "#{ pgxn_user }@#{ host }"
end end


task :restart do task :restart do
run 'sudo /etc/init.d/pgxn-site restart' # run 'sudo /etc/init.d/pgxn-site restart'
stop
start
end end


task :stop do task :stop do
run 'sudo /etc/init.d/pgxn-site stop' # run 'sudo /etc/init.d/pgxn-site stop'
run <<-CMD, :hosts => "#{ pgxn_user }@#{ host }"
if [ -f "#{ run_from }/pids/pgxn_site.pid" ]; then
kill `cat "#{ run_from }/pids/pgxn_site.pid"`;
fi
CMD
end end


end end


before 'deploy:update', 'deploy:check_branch' before 'deploy:update', 'deploy:check_branch'
after 'deploy:update', 'deploy:start_script' #after 'deploy:update', 'deploy:start_script'
after 'deploy:symlink', 'deploy:symlink_production' after 'deploy:symlink', 'deploy:symlink_production'

0 comments on commit 607d34b

Please sign in to comment.