Boxcar Conductor: Rails deployment made easy
In a previous post, I showed how we’ve been working on an interactive deployment process for Rails applications to reduce the time it takes to deploy to a Boxcar.
We began to move our Boxcar deployment recipes into it’s own Rails plugin and just made it available on GitHub.
Introducing Boxcar Conductor
The Boxcar Conductor plugin aims to automate the entire process for deploying to your Boxcar. We’re down to just a few simple commands to run to get your application up and running. While mileage may vary with other hosting providers, we did want to open up this work to the community and centralize our work with the community of Boxcar customers who have helped us build and test these tools.
Install Boxcar Conductor
If you’re running on Edge Rails… you can take advantage of the new support for installing plugins in git repositories.
$ ./script/plugin install git://github.com/robbyrussell/boxcar-conductor.git
note: If you’re not using edge rails, you can download a tarball and install the plugin manually.
Installing the plugin will add a custom Capfile and config/deploy.rb, which has a few things for you to define based on your Boxcar subscription.
Configure Your Boxcar
Once the plugin is installed, you can run the following task:
$ cap boxcar:config
This will ask you a few questions about your deployment needs.
- Which database server will you be using? (along with db user/pass info)
- How many mongrels should run in your cluster?
After a few quick multiple choice answers, you’re application is ready to be deployed and you can run an Boxcar-specific deployment task.
$ cap deploy
We’ve also created a new public project on Lighthouse so that you can submit tickets and ideas to us. With Boxcar, we’re really aiming to remove as many steps from the deployment process that aren’t necessary.
To follow along, visit the project on lighthouse or GitHub.
If you’re interested in learning more about Rails Boxcar, feel free to drop us a line.
Related Posts
Announcing Cobalt and monthly subscriptions for Boxcar 2
We’ve been designing and developing a new centralized billing platform over the past few months and late last week, we launched it! Along with this new billing platform, we launched another new application, Cobalt, which is a new account management and support tool for our hosting customers.
We’ll be migrating all of our past customers over to this new system in time, but are initially using it for new Boxcar customers.

We’ve been building the new system to use Braintree as our new credit card payment gateway. With this switch, we’re also introducing monthly subscription rates for Boxcar, which means that you can try it out month-to-month now.
Over the next few weeks/months, we’ll be announcing several features to Cobalt that will ease your Rails deployment experience.
I want to thank all those on my team that helped get these new applications up and running.
If you’re looking for professional VPS-based Rails hosting, hop on our train by ordering a Boxcar today for $99/month!
For more information, visit railsboxcar.com or Planet Argon.
Also, be sure to follow Boxcar on twitter.
git-svn is a gateway drug 6
As we’re migrating away from Subversion to Git, I’m having to learn a lot about git-svn. Andy has posted a few articles on this topic, but I wanted to share a quick tip that I find myself forgetting.
Working with Subversion branches
While you’re hopefully already familiar with how great local branches are with Git, you might not know that you can connect local branches to remote branches in your Subversion repository. This allows those of us who are using Git locally to work against Subversion branches.
I’m going to assume the following:
- Your team is using Subversion
- Your team already has a branch that you’re working in
- Your team is following Subversion directory conventions (
branches/,tags/, andtrunk/) - You have Git installed (with SVN extensions)
Checkout the Subversion project with Git
Please visit Andy’s tutorial, Git SVN Workflow, for a more detailed explanation of the following commands.
First, we’ll initialize your new local Git repository with git-svn.
git svn init -s http://svn.yourdomain.com/repos/project_name
Now, you’ll change directories to your new Git repository.
cd project_name
Let’s fetch all previous revisions into your local repository1.
git svn fetch
Great, once this is done… you’re master (local) branch is linked to trunk/.
Mapping a local repository to a remote branch
Assuming that your team is working in a Subversion branch on the current iteration of work. Our team has a naming convention for branches for each iteration. For example, if we’re in Iteration 18, we’ll write this as ITER-018 everywhere (Basecamp, Lighthouse, Subversion, etc…). At the start of each iteration, we create a new branch with this naming convention.
For ITER-018, the Subversion branch would be located at:
- http://svn.yourdomain.com/repos/project_name/branches/ITER-018
If you were to do a git branch -r, you should see ITER-018 show up in the list. Now, the one thing that wasn’t clear when I first read the git-svn documentation was that you can’t just checkout that branch with one command. In fact, this has tripped me up a few times.
First, you’ll need to checkout a new local branch. I’ve opted to come up with my own convention for local branches and in this case, I’ll name it iter_018.
git co -b iter_018
So, now I’m in the iter_018 branch, which is local. I’m currently still mapped to trunk/, which isn’t what we want. However, all we need to do is reset where Git is currently pointed to. We can run git reset to point this to the ITER-018 branch.
git reset --hard ITER-018
That’s it! Now, the local iter_018 branch will point to branches/ITER-018 in your Subversion repository. This will allow you to work with your existing repository branch and still reap the benefits of local Git repositories.
What about master?
Good question. The git reset command that you ran will ONLY apply that that individual local branch. So, master is still pointing to trunk/. This will allow you to have several local branches that map to remote branches.
Next Steps…
If you’re working with Git already.. great!
If you’re working in an environment that using Subversion, git svn provides you the ability to start exploring Git without making your entire team switchover. Perhaps your a consultant and working for a client that uses Subversion… no problem!
We’re still using Subversion for past client projects and are considering GitHub, which just launched (to the public) today for future projects. A few of us are already using GitHub for open source projects.
Fun.. I just saw the following tweet pass by as I began to wrap up this post.
The Gateway Drug… Git reminds me of Cake
Questions?
I know that I glossed over a few things, so feel free to post questions and/or tips for others who are looking to dabble with Git.
1 You’ll likely have problems if you don’t have a Git authors file specified in your git config.
I am forking Rails 2
...well, creating a fork on GitHub. ;-)
It appears that Rails is moving from Subversion to Git!
Courtenay posted this a little while ago.
git clone git://github.com/rails/rails.git
Check it out the Ruby on Rails project on GitHub.
Start working on your next patch with git…
git clone git://github.com/rails/rails.git
cd rails
git br -a
git br my_patch
git co my_patch
This is cool news. :-)
Managing Required Gems on Rails Projects 17
We’re starting a new project and I’m finding myself adding things to the code base that we’ve done in the past… hence the last few posts. As we’re doing this, I’d like to highlight some of the little things that we do on each project to maintain some consistency and in that process reach out to the community for alternative approaches.
I’m intrigued by the vendor everything concept, but we haven’t yet adopted this on any of our projects (yet).
What we have been doing is to maintain a REQUIRED_GEMS file in the root directory of our Rails application.
For example:
$ cat REQUIRED_GEMS
actionmailer
actionpack
actionwebservice
activerecord
activesupport
cgi_multipart_eof_fix
daemons
fastercsv
fastthread
feedtools
gem_plugin
image_science
mongrel
mongrel_cluster
mysql
rails
rake
RedCloth
Ruby-MemCache
soap4r
uuidtools
Everybody on the team (designers/developers) knows to look here to make sure they have everything installed when beginning to work on the application.
This has worked fairly well from project to project but since we’re starting a new project, I’m curious if anybody has some better ways to approach this. Should we look more seriously at the vendor everything approach or are there any alternative approaches?
Managing SEO-friendly HTML Titles with Rails 20
I’ve seen this come up a few times in the #rubyonrails IRC channel and figured that I’d post a quick entry for future reference.
Problem: HTML titles
You want to have a clean way to manage the titles on your HTML pages.
<html>
<head>
<title>Robby on Rails — Article Title Goes Here</title>
</head>
<body>
...
Possible Solution(s):
Since the <title> tag is usually declared in your layout, you need to be able to dynamically update this information from almost every action in your application.
Here are a few ways that I’ve seen this handled.
- Use a instance variable, which would have a default value and you could override it in any controller action
- Use the
content_formethod to manage it.
Let’s take a few minutes to look at these two approaches.
Instance Variable
With the instance variable, you might end up with something like:
# app/views/layouts/application.html.erb
<title>Robby on Rails — <%= @html_title || 'Default text here...' -%></title>
Then in a controller action…
# app/controllers/articles_controller.rb
def show
# ...
@html_title = @article.title
end
So, that’s one way to handle it and is probably a more common way.
The content_for helper method approach
This solution is very similar (and underneath uses an instance variable).
We’ll use the content_for and a little yield action.
# app/views/layouts/application.html.erb
<title>Robby on Rails <%= (html_title = yield :html_title) ? html_title : '— Default text here...' %></title>
Then we’ll create a helper method.
# app/helpers/application_helper.rb
def set_html_title(str="")
unless str.blank?
content_for :html_title do
"— #{str} "
end
end
end
Now, instead of defining the HTML <title> value in the controllers, we’ll just toss this into our html.erb files as necessary.
<% set_html_title(@article.name) -%>
... rest of view
..and that’s pretty much it.
Which is the better solution?
This is where we’ll not find a lot of consensus amongst people. I’m a fan of the content_for-based approach and defining the title in views rather than in controller actions. I’m an advocate of skinny controllers and while I’m not a big fan of messy views, I believe that there is less overhead in managing this within the View-world.
I’d love to hear your thoughts on this. Perhaps you have a more eloquent for managing things like this? Do share. :-)








