Word has reached me recently, through RadRails primarily of Mongrel, which apparently hopes to become the defacto standard for hosting rails applications. This being the case, your truly decided to give it a shot.
According to most of what I read the best way to acquire Mongrel was to download the gem for it, easy enough, we just need to run gem install mongrel_service. As I run Windows, services are generally the best way for me to manage application servers, I do the same thing with Cold Fusion, Apache, Postgres, Oracle. The only services that run constantly are IIS (cause I cant seem to turn it off and have it stay off) and MySQL, which I keep up for the Anime Database. So, back to the talk, I ran that command and surprise, my gem install appears to be broken. This I suspected, I had similar problems when I was trying to do MySQL work through pure Ruby.
No big deal, I thought. Ill just download a new version of Ruby and have it overwrite the existing files, its been a while since I changed versions. So I headed out to the Ruby download site and download the Windows One Click installer. I ran the installer, but it failed, saying it was not allowed to overwrite existing versions, it told me to blow away the directory. I considered my options. Well yeah its a pain, but how much work could it be, most of my applications look for a ‘ruby’ folder name, so they would be unaffected, I might have to change a few config options. So I went ahead and blew away my existing rails directory, and installed; it worked.
So now, I had to assess the damage, and as I suspected Rails was gone and many of my other plugins, I expected as much. However, with gem working I quickly brought them all back. This scenario I considered, knowing that Rails would probably have to be reinstalled, but given that gem makes it easy, I didnt count this as a big deal. So I went ahead and installed Rails and Mongrel and made sure the MySQL gem was up to date. And I went ahead and launched my Anime server. I thought, it really shouldnt care about a new version of Rails behind it, after all its mostly a framework: WRONG!
It yelled and complained about a setting in environment.rb, the version. This seemed strange to me, so I decided that I should replace the environments.rb file. However, before doing this I copied my Rails app to make sure that I would have a copy somewhere as backup. I deleted environments.rb from the Rails app and ran rails Anime from the command line. This didnt seem to correct the problem, so I decided I should regenerate the whole application just to make sure I was starting from a clean slate. I deleted the directory and ran the Rails command again, and then ran the generator script for each of my models and controllers. I then went to the back up directory and copy and pasted the files to their original locations, since the code had not changed. This worked as expected, with a minor problem.
Somehow, a couple helper methods had disappeared, I could not find them so I had to reimplement them. Its funny cause even in the backup, they didnt appear to exist. So after doing that, and making sure my other web properties (stylesheets, JS files, and images) were copied over, I ran the application: Success!!
Time to test out Mongrel. Thanks to the Mongrel Win32 HOWTO Iwas able to easily understand the program. Mongrel is really quite neat it how it organizes itself. You essentially create a Service Profile for each app and run it, you can, of course, pick various configuration operations such as environment and port number, most notably. To take it farther, I attempted to use Mongrel from within the recently updated RadRails plugin for Eclipse, but it appears to have been designed exclusively for Linux. This is not an issue, however, as Mongrel is intended primarily as the staple Production server for Rails applications, and its not a good idea to run a server in Production mode as a development server, because of the load process, meaning you have to restart the service to see Ruby code changes. I have WebBrick working fine from within Eclipse and that is satisfactory for now.