Making of a Web App: Part 11 – Technical Interlude

For people with an interest in the technical side of the project, here are notes on the configuration of our development, test, and production environments.

For those who couldn’t care less if PlaybookIQ is powered by mongrels or mice – don’t run away yet. Later this week, I will have the beginnings of actual product on the “production” server where anyone interested can follow along in real-time as updates are made throughout each development day. I would love ongoing feedback from the “live” site. Stay tuned because some real stuff is starting to happen.

Environments and Tools

My environments look like this:

Development and Testing Platform

  • MacBook Pro running OS X
  • TextMate editor
  • Ruby v1.8.6 programming language
  • Ruby on Rails v1.2.2 open source web framework
  • mySQL open source database
  • web-brick web server
  • Subversion version control system
  • net-ssh for password-less connectivity to remote server
  • Dreamweaver and Fireworks for working with html and graphics
  • CSSEdit for working with .css
  • Capistrano to automate deployment
  • a few other little goodies

Remote Host

  • VPS slices at Slicehost.com
  • Ubuntu Unix
  • Rails v1.2.2
  • mySQL database
  • Apache2 web server
  • mongrel cluster as an http load balancer
  • svn server for source code control
  • trac for project management and source code management

The local environment setup was actually done some time ago. The great news for Mac fans is that when OS X Leopard is released in October you will be able to write and deploy Rails apps “out of the box” with Rails, Mongrel and Capistrano pre-bundled into OS X 10.5. Awesome.

Deprec

Once the local install of Ruby and Rails was complete, the rest was easily configured and deployed using deprec, deployment recipes for Capistrano. I first read through the info from the deprec site, then followed a combination of instructions from here, here, and here and now can easily deploy updates using these few commands and without manually logging into the server.


svn commit -m 'new update'
cap disable_web
cap deploy_with_migrations
cap enable_web

Anyone running Rails on Slicehost, drop me a line and I can send you the step-by-step details of what worked for me to get the complete stack setup with deprec.

SSL

All PlaybookIQ users will have SSL, so I wanted to get that built out from the start so that all code would handle it properly. While the setup of all other components was straightforward thanks to deprec, configuring Apache, mongrel, and the Rails app to use SSL took way too much time. The key to anyone looking to use SSL with Apache is to understand VirtualHosts. More details on the exact steps I took to deploy SSL on Rails and Apache will be in a future post.

7 comments

  1. nathanc · ·

    I would like your step by step for setting up on slice host please. nathanclark80@gmail.com

  2. Scott Meade · ·

    Nathan – I’ll email them to you. I’ll also post them here as a followon comment.

  3. Scott,

    Interesting to see you’re using Slicehost. I’m in the process of moving some apps over to Slicehost as well. My biggest decision point right now is whether I should bring the SVN archives over to Slicehost. Currently they are on Dreamhost, but there are hurdles at Dreamhost that don’t allow quite the automation that I’d like.

    While I’m concerned about putting everything on the same box/with the same host, I’m leaning toward going full-on with Slicehost. If I become more successful, I can always dedicate a slice just to SVN and other low-level things. And I’ll have things backed up locally just in case.

    I more or less followed the “wiki”:http://wiki.slicehost.com/doku.php?id=automated_rails_install_and_deployment_with_deprec_capistrano for setup. Not being a server guru, it took a bit of time for me to get out of my own way. But I think I have things down reasonably well now. It wouldn’t hurt to see what you’ve done, though…

  4. Scott Meade · ·

    Barry,

    Like you, I basically followed the Slicehost “wiki”:http://wiki.slicehost.com/doku.php?id=automated_rails_install_and_deployment_with_deprec_capistrano entry for using deprec to install the full Rails stack. I changed a couple steps based on updates at the “deprec”:http://www.deprec.org/trac.cgi/wiki/DeprecSvnTrac site. For example, there are these new handy commands:

    cap install_rails_stack svn_install trac_install

    cap svn_setup

    cap trac_setup

    cap trac_start

    I also found that I needed to make sure to have the Rails gems as part of my project (i.e. needed to freeze Rails) or the migrations would fail.

    scott-meades-computer:~/rails/new_app smeade$ rake rails:freeze:gems

  5. Judging by the commands you are executing, I take it you’re not too concerned about keeping your repositories and apps on the same server?

  6. Scott Meade · ·

    Barry – that’s right, for now. I wanted to have a fresh start on this project and there is no one using it in “production” yet, so I took the easy way out by letting deprec create a new repository as well. (But it is super easy to just create a repository somewhere else and have deprec use it.)

    Other readers: With svn installed, to create a repository somewhere else is super easy:
    svnadmin create REPOS_PATH

    See “here”:http://svnbook.red-bean.com/en/1.0/re29.html and the svn “manual”:http://svnbook.red-bean.com.

    To use any repository with deprec:

    set :repository, _your repos_

  7. The big problem I ran into was that I wanted to keep repositories at Dreamhost. Seemed like a good option, with its oodles of bandwidth and space available. Unfortunately, Dreamhost’s shared environment does not allow the security necessary to automate repository creation.