Posted 2 months ago. Visible to the public. Repeats.

How to let passenger restart after deployment with capistrano

Phusion Passenger changed the way how it gets restarted several times. Through the project's history, these all were valid:

  • touch tmp/restart.txt
  • sudo passenger-config restart-app /path/to/app
  • passenger-config restart-app /path/to/app

You should not need to know which one to use. Instead, the capistrano-passenger gem will choose the appropriate restart mechanism automatically based on your installed the passenger version.

Installation

  1. Add to your Gemfile:

    Copy
    gem 'capistrano-passenger'
  2. Add to your Capfile:

    Copy
    require 'capistrano/passenger'
  3. Remove any homegrown deploy:restart or passenger:restart tasks. The gem will provide both, and hook itself after deploy:publishing automatically.

See the project's readme document for more information.

Important notice

It is possible you get an "error" message like this:

Copy
*** ERROR: You are not authorized to query the status for this Phusion Passenger instance. Please try again with 'sudo'.

This happens because your application never ran with the current passenger instance (probably due to no requests to it) and the passenger-config command runs without superuser permissions. This won't stop or break your deploy as the capistrano-passenger gem will execute the passenger-config restart-app with the option --ignore-app-not-running and due to that the command will exit with return code 0. With the next request to your application passenger will start your application based on the code you just deployed.

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Owner of this card:

Avatar
Kim Jahn
Last edit:
about 1 month ago
by Judith Roth
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Kim Jahn to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more