Postpostmodern » Capistrano http://postpostmodern.com Speaking of web development. Wed, 11 Jan 2012 00:21:50 +0000 http://wordpress.org/?v=2.9.1 en hourly 1 Capistrano on Media Temple http://postpostmodern.com/2006/11/29/a-recipe-for-capistrano-rails-deployment-on-media-temples-grid-server/ http://postpostmodern.com/2006/11/29/a-recipe-for-capistrano-rails-deployment-on-media-temples-grid-server/#comments Thu, 30 Nov 2006 00:25:58 +0000 Jason Johnson http://blog.postpostmodern.com/2006/11/29/a-recipe-for-capistrano-rails-deployment-on-media-temples-grid-server/ [UPDATE 1/6/07]

I had originally left out the step where you create the ‘rails’ directory inside the container directory. I thought that the mtr add utility might do that automatically, but it doesn’t look it. So, make sure you do #8 of Step 1 if you’re starting from scratch.

[UPDATE 12/1/06]

When I first wrote this article, WordPress was converting my double hyphens to en dashes (like a hyphen/dash but longer). Consequently, copy/pasting the command line input didn’t work. Now, it should be fixed and copy/pasting the commands should work. When in doubt, re-type it.

…easy as pie! You could even call it a recipe for pie!

I had the pleasure of deploying a Rails site on Media Temple’s new Grid Server recently. I have to say, it’s probably the easiest set up I’ve used for Rails.

There are basically three simple steps to setting up and deploying once you have the account set up: installing the container and rails; configuring your Capistrano recipe; and deploying.

I have created my own deploy.rb recipe which makes things even easier than the default MT recipe.

Step 1: Rails and the Container

The following is mostly taken straight from MT’s Server Guide. The part that differs is in Step 2 and 3.

  1. The first thing you need to do is enable ssh access for your server admin on your Grid Server account. That’s done via the Account Center control panel.
  2. Next, you need to activate the container. That’s also done via the control panel (under Ruby on Rails).
  3. SSH into your acocunt and set up your gems: mtr setup_rubygems -u serveradmin@domain.com -p
  4. Load your newly created environment variables: source ~/.bash_profile
  5. Install Rails and dependencies: gem install rails -y
  6. Install MySQL driver (postgres is also available): gem install mysql --source=http://gems.mediatemple.net/
  7. Install Mongrel: gem install daemons gem_plugin -y gem install mongrel --source=http://gems.mediatemple.net/
  8. Create a rails directory: mkdir ~/../../containers/rails

Rails is pretty much ready for an app now.

Step 2: Configuring your Application

This is standard Capistrano procedure except for the specialized gem and deploy recipe.

[UPDATE] I should mention that the rest of this procedure takes place on your local (development) machine.

  1. If you don’t have Capistrano installed, do it: sudo gem install capistrano
  2. Install MT’s special Capistrano tasks (all one line): sudo gem install mt-capistrano --source=http://gems.mediatemple.net/
  3. “Capistranize” your application by cd-ing into your rails root and running: cap --apply-to ./ YourApplicationName
  4. Download my Grid Server deployment recipe, unzip it and use it to replace your default config/deploy.rb file.
  5. Open up the new deploy.rb in your favorite text editor and fill in the config info at the top.
  6. Check your app in to your svn repository.

Now, your app is properly set up.

Step 3: Deploy (the fun part)

  1. Set up the directory structure: cap setup
  2. Do a “cold deploy”: cap cold_deploy
  3. Visit your site, and revel in your overwhelming sense of accomplishment.

Disclaimer

The above worked for me. Unless I’ve mis-documented something, it should work for you, but I can’t guarantee it. Please don’t blame me for any damage, and let me know if you find errors. I’ll do my best to address questions in the comments.

]]>
http://postpostmodern.com/2006/11/29/a-recipe-for-capistrano-rails-deployment-on-media-temples-grid-server/feed/ 13
Dog Days of an Indian Summer http://postpostmodern.com/2006/08/07/dog-days-of-an-indian-summer/ http://postpostmodern.com/2006/08/07/dog-days-of-an-indian-summer/#comments Tue, 08 Aug 2006 02:18:44 +0000 Jason Johnson http://blog.postpostmodern.com/2006/08/07/dog-days-of-an-indian-summer/ “The future of Rails deployment belongs to Mongrel,” they said.

So, about a month ago, not long after Lighty had settled into its little corner of the new server and was happily churning out web sites, I decided to shut it down. Lightttpd is a great web server, but my new CRAM setup feels so much better.

I’m talking about Capistrano, Rails, Apache, Mongrel. Coda Hale wrote a great article on setting it up. I used his basic procedure, tailored it to my specific needs/personality, and voila! CRAM!

See, Apache + FastCGI was sketchy at best, but Apache + Mongrel seems to be delightful. Now that Apache’s back in the mix, it’s a lot easier to run my PHP-based sites (and sites that rely on .htaccess files) alongside my Rails apps. And, even though Apache 2.2 wasn’t my favorite thing to install (nor was it my least favorite), I’m feeling darn good about my decision. Not only have I had much success with CRAM so far, there’s plenty of evidence that the Mongrel will be around for a bit. Edge Rails now uses Mongrel by default, and it’ll even be a part of Leopard’s Rails setup.

Speaking of Rails in Leopard. Nothing surprised me more that that news. I’m still a bit dumbfounded.

So, if you are developing in Rails and are trying to decide what sort of server stack/deployment you want to use, try CRAM.

]]>
http://postpostmodern.com/2006/08/07/dog-days-of-an-indian-summer/feed/ 0