As of February 4, 2008, DreamHost now officially supports the Mongrel application server on all DreamHost PS and DreamHost dedicated servers. If you have one of those hosting plans setup you can visit the Mongrel and Proxy section of the web panel to set one up.
Note that Mongrel and Passenger provide much of the same functionality so you most likely do NOT want to be using both of them on the same website.
1. Upload your working application.
2. Configure your Mongrel server from Mongrel and Proxy section of the web panel
3. Within a few minutes your application will be up and running on Mongrel.
Restarting Your Mongrel
Once your Mongrel application server is created you will need to restart it any time you change your application code. Unlike FastCGI, Mongrel does not automatically restart. To do this you must connect to the server via ssh, cd to the application directory, and then run one of these commands:
Those each do exactly what you'd expect from the name.
It took some time to figure out how to properly configure the Mongrel server and Rails application. These are the steps I took to set up my Mongrel Server. The web panel is very useful, but there is no documentation on exactly what steps you have to take to make sure Mongel is running properly, or how to tell if it is working.
- Create a directory "my_dir" in my web account. ( If the director. does not exist, then the mongrel-start, and stop apps don't appear in the directory.).
- Copy the rails application code to the directory, with the config and public appearing in the "my_dir" directory.
- Go to the web panel and use the form to specify the directory "http/my_dir" from the root of the user's account and the url for the application "www.mysite.com/my_rails_app" or leave blank for "www.mysite.com" to be proxied to the rails port. Although this is automatically done, there is not explanation that this is what is happening.
- After the proxy is set up (and the information appears in the Monrel list, and the port number is listed), then ssh back into your site and you should find "mongrel-start, mongrel-stop, and mongrel-restart" applications copied into your "my_dir" directory.
- execute mongrel-start from the command line
- visit "www.mysite.com:300X" where 300X is your mongel port. This should connect directly to your rails application which is already running via mongrel. If you have not executed "mongrel-start" from the command line, you should get see an error message.
- Finally, test that "www.mysite.com/my_rails_app" properly connects and proxies to your rails application. (or "www.mysite.com" if you want the root to work).
If you do not make the directory properly you might see only the following:
The only thing I see is $ mongrel_rails start | stop | restart
More Advanced Options
If you would like more control over the proxy setup of your Mongrel application, you can delete the proxy server automatically created when you created your Mongrel application, and then use mod_rewrite to proxy specific requests. You may want to do this if you have a lot of static files so those can be processed by Apache instead of passed to Mongrel.
- Can we get some examples of how to do this?
I've tried modifying /home/username/example.com/.htaccess but it is ignored by Apache altogether, all request are currently served by mongrel out of /home/username/example.com/current/