Joyent

Translations of this page:

Deploying a Rails application with Mongrel

The preferred method of deploying a Rails application on Joyent Shared Accelerators is with Mongrel. This article assumes that you have a Rails application (whether it's your own, or downloaded elsewhere) already installed and configured. If you haven't, please see the following article:

Getting a Mongrel port

Mongrel runs on a port and we need to track these in order to prevent customers from stepping on each other's toes. You'll need to request a port number from us, by filing a support ticket. Make sure to note the port number you were assigned for reference.

Mongrel requires a port for each rails application. You will run one Mongrel per rails instance.

The Shared Accelerators do not support using the mod_proxy_balancer Apache module to connect to a Mongrel cluster (using the mongrel_cluster Rails GEM). When (and if) this becomes available in Virtualmin, it will be described here, though it probably makes sense for Plus and Premier hosting plans only for memory usage reasons.

Setting up a boot-up action for Mongrel

To ensure that your Rails application (and your site) will work at all times, the Mongrel process must keep running constantly. It also needs to launch automatically when a server boots, so that you do not have to watch for our maintenances and emergencies and can assume that your site will work right away. The Virtualmin boot-up actions feature will take care of your Mongrel and make sure it starts and keeps running:

  1. Sign in to Virtualmin (see Account logins and important URLs).
  2. Select a domain from the drop-down in the left-hand navigation (your main domain should be already selected when you first login to Virtualmin). The domain you select here will be the one that you'll be adding your application to.
  3. Click Services and then Bootup Actions in the left-hand navigation. You should now see a the Virtualmin Bootup Actions page.
  4. Click Add Mongrel. You should now see the Create Bootup Action page.
  5. For Action name, enter a suitable short name for your application, e.g. 'blog' (letters, digits, ‘-’ or ‘_’ are allowed, but not spaces).
  6. For Description, enter a suitable description.
  7. For Started?, leave the default value as Yes, so that the process is started right away and gets started each time the server boots.
  8. For Rails root directory, enter the full path to your Rails application (e.g., /users/home/yourusername/web). You can also browse for and select the root directory for your application by clicking (note that the Rails root is the directory that holds all the directories of your Rails application, including public).
  9. For Port number, enter the port number you obtained at the very beginning.
  10. Finally, click Create. Your Rails application will be started listening on the local 127.0.0.1 IP address on port XXXX.

And that's it, your Rails application has now been deployed, and you should follow with setting up a proxy to make the application public.

For security reasons, your Rails application will not be publicly visible until you have setup a proxy since the boot action template is configured to listen on localhost (127.0.0.1).

Proxying your port

To proxy the port number so that your application is accessible from your domain, see the following article:

 
shared/kb/rails-with-mongrel.txt · Last modified: 2008/03/18 18:43 by christopher
 
Recent changes RSS feed Creative Commons License Driven by DokuWiki