Postpostmodern » Media Temple 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
Quick Email Aliases on Media Temple http://postpostmodern.com/2006/11/29/quick-email-aliases-on-media-temple/ http://postpostmodern.com/2006/11/29/quick-email-aliases-on-media-temple/#comments Wed, 29 Nov 2006 05:17:41 +0000 Jason Johnson http://blog.postpostmodern.com/2006/11/29/adding-email-aliases-on-a-media-temple-dv-server/ The Short Story:

If you have a Media Temple (dv) vps server account with Ruby1 installed and root/sudo access, you can use my handy-dandy script to create instant email aliases for any of your hosted domains.

Usage2:

sudo ./alias.rb email_alias@hosted-domain.com recipient@anydomain.com

That’s it. 5 seconds and you have a new email alias. No Plesky mess involved.

I even aliased my alias script in my .bashrc file:

alias ealias='sudo ~/alias.rb'

The Backstory (and how the script works):

I use a lot of email aliases. I rarely give out my real email address. I usually create an alias that forwards to my real address. For example, if Amazon.com thinks my email address is amazon (@ my domain.com). That way, if I ever start getting spam, I know who gave away my address, and I can just delete the alias.

I use Media Temple’s Dedicated Virtual (dv) hosting plan. The Plesk control panel is kinda limited (and a pain) when it comes to creating lots of email aliases. I’ve yet to find a way to create an alias that forwards to an external email address, and any alias creation takes a crapload of mouse clicks. So, I decided to figure out a simpler way. After looking under hood, I discovered qmail. I didn’t know a thing about qmail, but I was willing to do some research to get to a solution for my alias thing. It turns out, qmail has kind of a neat way of dealing with aliases: for each domain, there is a directory. Each file in this directory represents an email alias3. The files are named thusly: ‘.qmail-alias’ where alias is the actual name part of the alias address. The contents of the file consist of the actual recipient addresses (prefixed by & and separated by newlines). So, a file called .qmail-amazon in /var/qmail/mailnames/postpostmodern.com that contains my real email address, prefixed by an ampersand, would be all that is needed for a functioning alias. All my script does is parse the input to figure out the name of the file, the contents of the file and where to put the file. Then, of course, it just creates the file.

The nice thing about qmail’s system is that the files are utilized instantly. There is no reloading of alias info or anything. It just works.

Oh, and adding a bash alias like this:

alias emails='sudo ls -a /var/qmail/mailnames/hosteddomain.com/'

will give you a list of existing aliases.

  1. Yes, I could have used Bash or something, but I’m more comfortable with Ruby, okay? ↑ back up there
  2. Please adjust the shebang line for your ruby installation. And don’t forget to chmod the script so it’s executable (755)! ↑ back up there
  3. There are also subdirectories for each real email account. ↑ back up there
]]>
http://postpostmodern.com/2006/11/29/quick-email-aliases-on-media-temple/feed/ 7