public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Add Capistrano integration information to Users guide. Thanks Philippe 
Lafoucriere.
Hongli Lai (Phusion) (author)
Sun Jun 08 03:28:57 -0700 2008
commit  7cc6a56a4814d3ad4b4420c6b484032953174a46
tree    8f78029e45c6bd3d4cab32642e158faf4837e9bb
parent  a47e54f1df260827f561c646d6b4e39cdbaea3c8
...
276
277
278
 
 
 
 
279
280
281
...
1307
1308
1309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1310
1311
1312
...
276
277
278
279
280
281
282
283
284
285
...
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
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
 
0
+=== Capistrano integration ===
0
+
0
+See <<capistrano,Capistrano recipe>>.
0
+
0
 
0
 == Deploying a Rack-based Ruby application ==
0
 
0
@@ -1307,6 +1311,63 @@ Please visit the website for details.
0
 
0
 Note that this feature does not apply to Rack applications.
0
 
0
+[[capistrano]]
0
+=== Capistrano recipe ===
0
+
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
+--------------------------------------------------
0
+set :application, "myapp"
0
+set :domain, "example.com"
0
+set :repository, "ssh://#{domain}/path-to-your-git-repo/#{application}.git"
0
+set :use_sudo, false
0
+set :deploy_to, "/path-to-your-web-app-directory/#{application}"
0
+set :scm, "git"
0
+
0
+role :app, domain
0
+role :web, domain
0
+role :db, domain, :primary => true
0
+
0
+namespace :deploy do
0
+ desc "Restart Application"
0
+ task :restart, :roles => :app do
0
+ run "touch #{current_path}/tmp/restart.txt"
0
+ end
0
+end
0
+--------------------------------------------------
0
+
0
+[NOTE]
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
+--------------------------------------------------
0
+1001 30291 [...] Passenger ApplicationSpawner: /var/www/my_app/releases/20080509104413
0
+1001 31371 [...] Passenger ApplicationSpawner: /var/www/my_app/releases/20080509104632
0
+--------------------------------------------------
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
+
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
+command is as follows:
0
+
0
+--------------------------------------------------
0
+kill $( passenger-memory-stats | grep 'Passenger spawn server' | awk '{ print $1 }' )
0
+--------------------------------------------------
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
+
0
 === Moving Phusion Passenger to a different directory ===
0
 
0
 It is possible to relocate the Phusion Passenger files to a different directory. It

Comments

    No one has commented yet.