0
@@ -276,6 +276,10 @@ run migrations on your deployment server, please login to your deployment
0
server (e.g. with 'ssh') and type `rake db:migrate RAILS_ENV=production` in
0
a shell console, just like one would normally run migrations.
0
+=== Capistrano integration ===
0
+See <<capistrano,Capistrano recipe>>.
0
== Deploying a Rack-based Ruby application ==
0
@@ -1307,6 +1311,63 @@ Please visit the website for details.
0
Note that this feature does not apply to Rack applications.
0
+=== Capistrano recipe ===
0
+Phusion Passenger can be combined with link:http://capify.org/[Capistrano].
0
+The following Capistrano recipe demonstrates Phusion Passenger support.
0
+It assumes that you're using Git as version control system.
0
+--------------------------------------------------
0
+set :application, "myapp"
0
+set :domain, "example.com"
0
+set :repository, "ssh://#{domain}/path-to-your-git-repo/#{application}.git"
0
+set :deploy_to, "/path-to-your-web-app-directory/#{application}"
0
+role :db, domain, :primary => true
0
+ desc "Restart Application"
0
+ task :restart, :roles => :app do
0
+ run "touch #{current_path}/tmp/restart.txt"
0
+--------------------------------------------------
0
+==========================================================================
0
+You may notice that for each deploy, a new spawner server is
0
+created (it'll show up in `passenger-memory-stats`). Indeed, Capistrano will deploy
0
+to a path ending with '/current' (ie : '/var/www/yourapp/current'), so that you don't
0
+have to care about revisions in your virtual host configuration. This '/current' directory
0
+is a symlink to the current revision deployed ('/path_to_app/releases/date_of_the_release').
0
+Therefore, when deploying a new version, the symlink will change, and Phusion Passenger
0
+will think it's a new application, thereby creating a new spawner server:
0
+--------------------------------------------------
0
+1001 30291 [...] Passenger ApplicationSpawner: /var/www/my_app/releases/20080509104413
0
+1001 31371 [...] Passenger ApplicationSpawner: /var/www/my_app/releases/20080509104632
0
+--------------------------------------------------
0
+Don't worry about this. The (old) spawner server will terminate itself after its default
0
+timeout (10 minutes), so you will not run out of memory.
0
+If you really want to release the spawner server's memory immediately, then you add a command
0
+to your Capistrano script to terminate the Passenger spawn server after each deploy. That
0
+--------------------------------------------------
0
+kill $( passenger-memory-stats | grep 'Passenger spawn server' | awk '{ print $1 }' )
0
+--------------------------------------------------
0
+Killing the spawn server is completely safe, because Phusion Passenger will restart the
0
+spawn server if it has been terminated.
0
+==========================================================================
0
=== Moving Phusion Passenger to a different directory ===
0
It is possible to relocate the Phusion Passenger files to a different directory. It
Comments
No one has commented yet.