问题
I run an instance of a rails application that is developed by another team. Back when I started, the common way to deploy Rails apps was to use Mongrel behind Apache, and that's the configuration that that team used for their own instances. Since I'm a Windows guy, and since both Apache and Mongrel can easily be set up as Windows services, I used a (virtual) Windows box and set up everything there.
I guess since than things changed in Rails land. Mongrel has stagnated (at least that's my impression of the common perception). The team developing my app has switched to using mod_rails a while back. I have not concerned myself with all this, since my Mongrel setup continued to work, until the last time I synced with their code. Apparently, there's a name conflict where they created a 'Service' model, which clashes with a module name in mongrel_service (see http://aspn.activestate.com/ASPN/Mail/Message/ruby-rails/3497181 ). When I asked them to rename the model, they said they're not interested in supporting Mongrel.
Is Mongrel still a valid option for Rails applications? If not, is there a valid alternative for deploying under Windows? Neither mod_rails nor Thin run under Windows... Or should I just bite the bullet, give up on Windows deployment, and rebuild my VM as a Linux box?
To clarify: The VM where this runs is not on my development desktop. It's a VM that our IT department hosts, used in production. I have admin on it. I can get IT to set up a Linux VM instead if I must.
回答1:
This doesn't directly answer your question but personally I'd bite the bullet and move to Linux, install Apache and Passenger and go with it like that. Installing Ubuntu Server and installing the aforementioned is a pretty painless experience and you should be up and running within an hour or two at most.
In the past, this is the approach I've used and really the only barrier to this would be the learning curve if you don't have much/any experience with Linux and/or Apache. It might be worth checking out the "Linux for Softies" series on TekPub which cover setting up this very stack.
回答2:
Give up on Windows.
Two years ago, when I also considered myself a "Windows guy," I started fooling around with Ubuntu on a spare laptop. After about two days I realized how many unnecessary headaches I had been living with on Windows, and I decided to switch.
It took some time to get everything set up comfortably, but I estimate that this switch has saved me 6 months of productivity in just these past two years. The positive impact on my quality of life is significant: installing languages and web development libraries takes a fraction of the time it did on Windows, and I can use pretty much anything out there, meaning I'm learning more, and having more fun.
I know it's a big change, but if you have a spare computer I'd highly recommend giving it a shot. There's always some way to get things working on Windows, but you should really question if its worth the effort.
回答3:
Chiming in. When I had to deploy on Windows, I used VirtualBox with Ubuntu. Works well for most typical websites. You'll probably run into scaling issues pretty soon if it's a bigger site, though.
回答4:
Glassfish with jruby works great on windows- and it can handle multiple requests.
回答5:
Mongrel is still a valid option but passenger (mod_rails) is far more popular.
You can try to use Webrick which comes as a standard with rails.
script/server webrick
To force the use of Webrick
But If I were you I would install a virtual box on my computer, with a shared folder (given than you want to stay on windows) and use the virtual box to run my app using mod_rails
回答6:
Don't give up. Mongrel is still fine on Windows and Windows is still a good development environment for Rails. Looking through the linked problem you mentioned, the guy solved his problem by uninstalling the mongrel_service gem. If you don't need to run mongrel as a service, and I guess you wouldn't on your development box, you should be fine. I don't know what version of mongrel_service you are running, but it would be worth seeing if you can upgrade.
回答7:
If you must do something on Windows, then I would go with JRuby and a Java app server (like Glassfish or Tomcat). I wouldn't try to go with any native Ruby on Windows - in my experience it's just a big headache. Also Matz has admitted that on Windows Ruby runs significantly slower (I think he said almost 20 times slower) than it does on Unix/Linux. Now this likely isn't the case for JRuby, which again is why I'd recommend it for Windows.
Just my 2 cents.
回答8:
I know that it's been a while, but thin now compiles on windows, if you use the --pre argument.
来源:https://stackoverflow.com/questions/1890226/should-i-give-up-on-deploying-rails-under-windows