I have several rails applications on my server. Each application uses its own rvm gemset. I'm using Thin as web server for each application, this servers installs as a gem separately for each application. Each server runs on different port. Main server nginx acts as a proxy server.
I need the following functional to be available through some scripts:
- Run all thin servers.
- Start, stop or restart any server.
- Check every minute (by cron) if application is running correctly (HTTP status 200). Auto restart application if check is failed.
- Each application must not be able to access data of another application. They should be launched in chroot or by different users.
- Auto generate nginx configuration.
Adding new application to the system should be easy.
What can you suggest to achieve this?
Thin can be replaced with any other server if necessary. Main nginx server is also using for running several PHP sites, so I don't want to replace it.
I was thinking about recompiling nginx with passenger module and installing it as main server. If I do this, will it be possible to run each application using its own ruby installation and gemset?