I've been searching for a way to reliably deploy a Rails 3 application on Windows. I'm quite shocked that it seems like there isn't currently any way to do this. The Apache + few Mongrel services solution don't work currently because Mongrel cannot run in daemon mode therefore I can't install it as a mongrel_service.
The requirements I guess should be:
I found out these things:
-d
) with Rails 3.These are the possible solutions I came up with:
This might be a handy tool: http://projectkenai.com/projects/winsw
I hope we can find a real solution to this issue.
Update:
I agree that JRuby + a j2ee container is the best bet. Some problems must be resolved like gems with extensions, etc. There are lots of valuable ideas here: http://rails-nutshell.labs.oreilly.com/ch14.html#production_r259035_id35801805
Go to your browser and open http://localhost:3000, you will see a basic Rails app running. You can also use the alias "s" to start the server: bin/rails s . The server can be run on a different port using the -p option. The default development environment can be changed using -e .
This is the setup I currently have running:
Installation of these aspects is covered by this great tutorial "How to install and configure Ruby on Rails with Windows Server 2008 EE". I ignored the LDAP and ActiveDirectory bit, but there is a nice workaround discussed there for installing Thin server since gem 'thin'
will normally break on Windows.
For production I set up MySQL Server 5.5 to host my database. The mysql2 adapter is required for Rails 3 but is not yet supported in my Windows environment. The mysql adapter will also throw an error on Rails 3, but as a workaround you can get it to work by installing an older version of libmysql.dll. You just need to drop it into your Ruby192/bin directory.
Once the proper mysql adapter and server is installed you'll need to create the database:
>> mysql -u root -p
[enter root pw]
create database production;
quit;
(You may need to add your MySQL installation to your path if 'mysql' cannot be found.)
Finally, set the database config found at your_rails_app/config/database:
# MySQL Production Database
production:
adapter: mysql
database: production
pool: 5
timeout: 5000
encoding: utf8
password: [your_root_password]
host: localhost
The rest, including the proxy setup and running as a Windows service, is covered at "How to install and configure Ruby on Rails with Windows Server 2008 EE". To make sure your basic Thin setup is running correctly:
thin start -p 3000 -e production
This should start your server on port 3000 in production mode using the MySQL database. The only thing missing here is load balancing, which I'm hoping to find an answer to soon!
Personally, I think the JRuby + Tomcat avenue is going to be your best bet, just because Tomcat is vetted on Windows and it along with JRuby are pretty stable. My first thought was Passenger as well, and it's sad that it's still not ported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With