I’m deploying a Rails application to textdrive using Geoffrey Grosenbach’s Shovel—Rails Deployment with Lighttpd. Thanks to Geoff for putting all his learnings into a script for the rest of us. Here’s some things I ran across on the way:
- Textdrive has changed a few aspects of the server config. I updated Geoffrey’s script to cover one of the changes — users/home/[username]/sites is now users/home/[username]/domains. This is now one of the variables you should set for your case at the top of the script. I also added a variable for svn branch path, in case you use a trunk/branch/tag structure in svn as I do. This updated script is here.
- Running the rake task, I was having this common problem with ruby require not finding the ‘openssl’ library. The solution on Ubuntu 5.10 (Breezy Badger) was to install libopenssl-ruby (sudo apt-get install libopenssl-ruby). Don’t be fooled, other packages like ‘openssl’, etc. are not what you’re looking for. A little commentary: I can’t recommend Ubuntu for Ruby/Rails developers — I’ve lost a lot of hours on various problems. The ubuntu/debian package maintainers are working at odds with Ruby’s distribution mechanisms (which works best when you can install ruby+rubygems and use gems to get everything else). Right now, Ruby on Ubuntu is broken in pieces and available in both places, without accurate dependency maps to help you get what you need. Until this is fixed, consider finding another alternative. If you have a Mac, I’ve had good experiences with DarwinPorts+gems.
- Error messages in most of the tools here are not particularly helpful. Often it’s a Ruby exception where the real problem is only discernable way up the stack. Googling the error message (such as it is) is a good first step for debugging.
- Textdrive has moved the ruby bin to /usr/local/bin/ruby. If a ruby script doesn’t work, check the top for this.
- If you keep rails’ database.yml out of source control (e.g. if following subversion with rails), don’t forget to create it on the server now
- After running the shovel script, /users/home/[username]/domains/[application]/current/config/lighttpd.conf wasn’t populated. Running script/server copied an example from the gems directory, but I needed to edit it to provide my textdrive-supplied port for lighttpd, and fix up the ruby location.
At this point, running ‘rake deploy’ and ‘rake rollback’ should work as intended if run from where I’ve checked out the production branch.
Some of the error messages that I hit before hitting on the solutions above:
- (mod_fastcgi.c.1022) execve failed [turned out to be the /usr/local/bin/ruby problem]
- no such file to load — openssl [sudo apt-get install libopenssl-ruby]
Any other updates or suggestions to do this better are welcome.