"This is a work in progress, and has been changed to reflect the current state in Intrepid"
Launchpad Entry: rubyonrails
Created: Tue, 02 Oct 2007 12:14:52 +0600 by dzportwood
This specification outlines processes and points of action to get a RubyOnRails application stack into Ubuntu Server (Intrepid Ibex)
The RubyOnRails stack needs some manual work to be installed on ubuntu.
If a user wants to install a full Rails stack, he needs to:
- Use apt to install packages -apache2, mysql-server or pgsql-server, rubygems, rails
- Use Gems to install rails componets
- Manually edit configuration files (about 4)
- Adding a user to MySQL or PgSQL for each rails app
- Alice wants to deploy a website based on a rails application to an Ubuntu server configured with Rails support. She enters the installation details of her application and uploads the application to the server. The website is immediately available.
- Alice now wants to maintain her application, and need to put up and take down a maintenance page while she deploys a new release.
- Alice's new release doesn't work properly, so she effortlessly rolls back to the prior release which the server has kept for her.
- John is the administrator of a shared web server. He needs to provide secure areas to his users where they can deploy their Rails applications on different domains safe in the knowledge that they will not interfere with each other, access each others data or overload either the web site or the database.
- Dave has an unprivileged account on a shared web server. His account allows him to deploy his Rails application, run scheduled out-of-band tasks and background tasks, change the domain name of his application and store shared assets on the disk.
- Thomas has a web application he'd like to deploy to Ubuntu servers. It's going to get a lot of load though so he needs the database and the web layer across numerous servers. However he still wants an effortless way of uploading the Rails application to the infrastructure.
- Fred has just uploaded his latest and greatest Rails masterpiece: 'headbook'. Unfortunately his DNS provider isn't as responsive as his Ubuntu Server 'bigiron-002.vmprovider.com' and, being a designer by trade, he can never remember IP addresses. Fortunately he can just point his browser at 'headbook.bigiron-002.vmprovider.com' and bask in glory 48 hours earlier than normal.
- We will provide a full stack on an individual server.
- We'll focus on getting the necessary plumbing to make it easy to deploy a Rails application.
- We won't look at how to package a Rails application.
- We won't look at DNS issues.
The architecture is based around Apache2 configured to work with Phusion Passenger as the web server, with Mysql as the installed database server. We will install all the supported open source database client libraries so that the user can access any type of database without further configurations.
We would expect that Rails server would be offered by the Server installation menu.
That gets the basic infrastructure in place. Then there is the question of how to get the application onto the server
Issues with current Ruby packages
We need to get on top of some of these issues to get Rails into Ubuntu effectively.
Package already in REVU (https://bugs.launchpad.net/ubuntu/+bug/246719)
Create RoR tasksel task
This would: -- Install that Rails server package (passenger, rails, rubygems, client libraries and configuration tools) -- Install the Mysql server --
or a metapackage ====
- depends on:
mod_rails (if packaged)(https://bugs.edge.launchpad.net/ubuntu/+bug/246719) (http://revu.ubuntuwire.com/details.py?package=passenger)
- MOTU's WE NEED ACKS!!
- rails "rails2.0 maybe? or should we wait to see what upstream packages first?"
- mysql gem
all config changes are documented @ https://wiki.ubuntu.com/RubyOnRailsStack/configfiles -OLD FOR MOGREL SPEC
mongrel init script is @ https://wiki.ubuntu.com/RubyOnRailsStack/mongrelinit -OLD FOR MONGREL SPEC
Document the standard way of deploying a Rail application:
Provide a sample application as an example
- welcome to rails application.
- default db configuration file.
- default virtual host file (in /etc/apache2/site-available).
There's also Phusion Passenger, an Apache Module that makes deploying Rails and/or rack applications very easy. A lot easier then configuring proxy and mongrels.
* I would personally suggest going with the Phusion Passenger option mentioned above. It's proven, and as of version 2 is considered (and has proven to be) stable. It's also a "solved problem", as it were. There are quite a few simple guides to setting up Ubuntu with Passenger and a full Ruby / Rails stack that might be useful, such as this. (Peter Cooper - editor of RubyInside.com)
* I second the suggestion of using Phusion Passenger. It's simple to set up and that's what you want for the average user. An experienced rails developer is going to have their own preferred stack setup for production use (and may not even be running Ubuntu on their production server), so Ubuntu doesn't necessarily have to make it easy for them; I wouldn't suggest making that your target. Rather, I would suggest focusing on simplifying two things: 1. Easy stack set up for those just getting started with Rails. 2. Easy set up of a development-mode stack, for developers (when you're first starting an app you don't want to have to spend much time working out deployment issues). For both of these, Passenger will work fine. I suggest something along the lines of the Passenger Preference Pane on OSX (http://www.fngtps.com/2008/06/putting-the-pane-back-into-deployment). With that tool, getting deployment set up is a synch. --zerohalo
* The technology quoted in this spec works, but can be improved. There are numerous problems with the current Debian Ruby packaging that prevents effective support of Ruby on Rails in Ubuntu. At Brightbox we do Ubuntu Ruby on Rails for a living and we're very well aware of the problems with the current system. What needs to happen is:
Get Phusion Passenger in the archive (https://bugs.edge.launchpad.net/ubuntu/+bug/246719)
Fix Rubygems so that it supports gem installed binaries in the path in all versions of Ruby. (Already kicked off: https://bugs.edge.launchpad.net/ubuntu/+source/libgems-ruby/+bug/145267)
- Incorporate or create a separate package set for Ruby Enterprise Edition (which is essentially just a garbage collector patch to improve memory usage).
- Make Apt packages that are based on Gems tell Rubygems that they are installed. That is easy to do and I've been working with Rubygems people to make this happen, but it will mean wholesale changes to a great number of apt packages.
- Scrap the current Rails package and create one that is useful and conforms to what a Rails person expects.
- Package up a few of our Brightbox refinements and gems that make deploying Rails applications trivial.
- For the future look at automatically generating apt packages from Gems, allowing swapping of Ruby backends and technology front ends.
I've kicked off a couple of project groups with a view to testing out effective Rails packaging, UbuntuRuby and UbuntuRubyBackPorts. If that isn't the best focus for this then let me know. Essentially we're very keen at Brightbox to find a way of feeding our technology back into Ubuntu Server - NeilWilson
How-to improve RoR application deployment ?
Integrate Capistrano (website http://www.capify.org/). It is a utitily known for its ease of use in web app deployment. It is written in ruby but it is not limitated for ruby based apps. There are documentation available for ruby on rails specific use case http://wiki.rubyonrails.org/rails/pages/Capistrano and http://manuals.rubyonrails.com/read/book/17.