If you run multiple versions of a Rails application on the same server it’s easy to get them mixed up. I have a client that has 2 versions of the same application on the same server. One version for clients in the Netherlands and one for Belgium. Because they are almost, but not totally, identical I’m doing as much as I can to make them easy to identify. And today I found a simple trick that I’d like to share.

When there are performance or availability problems with these applications I usually start by checking their queue sizes with passenger-status. And by default passenger identifies the apps by the directories they are in. On this server that’s not helpful at all. So I gave them names.




How does it work?

You add this line to each Nginx vhost. Or only the vhosts that you want to name. I’ve added this line right below the line that says passenger environment is production.

passenger_app_group_name your_apps_name;

After that you have to restart or reload Nginx to apply this. I always check my config for errors with nginx configtest, and if the config is okay I restart the server. On one line that would be:

service nginx configtest && service nginx restart

The && will make sure that the restart command won’t be executed if there is an error in your new config.