Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update Capfile for deployment to depesz.com.

  • Loading branch information...
commit 607d34bb6d9473d94380023ee1c0b0f23b978ab0 1 parent 2deba73
@theory theory authored
Showing with 27 additions and 10 deletions.
  1. +27 −10 Capfile
View
37 Capfile
@@ -4,6 +4,10 @@
# cap deploy:setup
# cap deploy:cold -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'
@@ -17,12 +21,16 @@ set :deploy_via, :remote_cache
set :use_sudo, false
set :branch, "master"
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.
-set :shared_children, %()
+# Define the shared directories we need.
+set :shared_children, %w(log pids)
-role :app, 'xanthan.postgresql.org'
+role :app, host
namespace :deploy do
desc 'Confirm attempts to deploy master'
@@ -42,7 +50,8 @@ namespace :deploy do
perl Build.PL || exit $?;
./Build installdeps || exit $?;
./Build || exit $?;
- ln -s #{shared_path}/www #{latest_release}/www;
+ ln -fs #{shared_path}/log || exit $?;
+ ln -fs #{shared_path}/pids || exit $?;
CMD
end
@@ -52,7 +61,7 @@ namespace :deploy do
end
task :symlink_production do
- run "sudo ln -fs #{ latest_release } #{ run_from }"
+ run "ln -fs #{ latest_release } #{ run_from }"
end
task :migrate do
@@ -60,19 +69,27 @@ namespace :deploy do
end
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
task :restart do
- run 'sudo /etc/init.d/pgxn-site restart'
+# run 'sudo /etc/init.d/pgxn-site restart'
+ stop
+ start
end
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
before 'deploy:update', 'deploy:check_branch'
-after 'deploy:update', 'deploy:start_script'
+#after 'deploy:update', 'deploy:start_script'
after 'deploy:symlink', 'deploy:symlink_production'
Please sign in to comment.
Something went wrong with that request. Please try again.