Join GitHub today
How to run your packaged Rails app with Passenger #19
When you package a Rails application on Packager.io, by default you'll end up with init scripts to run your application with the web server you defined in your
However, if you're already using Passenger for your deployments, you might want to keep it that way, in which case you can still benefit from the ease of installation provided by packages, but serve your application using Passenger.
In the rest of this article, we're assuming that nginx and Passenger are already installed on your server, and that your application name is
Add a new file to your repository
Passenger will need to know which
For instance, you could create a new file in
Then give it the right permissions, commit to your repository and push:
Wait a few seconds until your new package is generated, then install it on your server with the usual instructions.
Update your nginx server configuration
We can now simply update the nginx configuration so that the
That's it! Passenger should now load and serve your application when you access
Bonus points: automatically migrate and restart your application after an update
Passenger provides a mechanism to restart your application by touching a specific file at
Now create a new file at
Finally, add and commit these files to your repository and push to generate a new package:
Now, every time you install a new version of your package, migrations will be run and Passenger will restart your application.