How to deploy your code

If you use a source code repository like Git or Subversion and have to push code manually you're missing out. There are deployment tools that can save you a lot of time. You can also set up automatic deployment so that every time you push a commit to your repository the change gets automatically deployed to your server.

This is extremely helpful when you're working locally. Create a deployment to watch your dev branch and every time you push a commit it will be automatically pushed to your staging site.

Does your production site run on more than one server? Setup a deployment that pushes to them both at the same time.

Do you have a more complicated deployment process that requires running a database migration or other custom script? A deployment can handle that for you automatically.

There are a couple services that can help make deployments easier, Beanstalk and DeployHQ.

Comparing Beanstalk and DeployHQ

Beanstalk has a much cleaner interface and more deployment options than DeployHQ. It also provides hosting for your repositories, which DeployHQ does not. However, it can only deploy its own repositories. For example, you can’t deploy a GitHub repository.

DeployHQ is focused only on deployment. It doesn’t provide repository hosting. I find the interface to be clunkier than Beanstalk. But, it can deploy repositories that are hosted just about anywhere.

We used Beanstalk for a long time, but recently switched to GitHub for repository hosting and DeployHQ for deployment. We’ve found that what DeployHQ lacks in ease of use, GitHub more than makes up for in its social coding features (pull requests, comments, etc). But really, both services offer adequate solutions.

Configuring Deployments with Beanstalk

Beanstalk Deployment

Beanstalk's deployment overview

To set up a deployment on Beanstalk:

  1. Go to the Deployments tab for your repository
  2. Click Add Environment
  3. Configure a development, staging or production environment by giving it the proper name and selecting the correct branch.
  4. Set the Deployment Mode to Automatic for development or staging environments or Manual for production environments.
  5. Add one or more servers by selecting your destination (e.g. FTP, SFTP, Heroku, Amazon S3, etc) and then providing the proper credentials.

Read Beanstalk’s Deployment Best Practices guide and knowledge base article for more details.

Beanstalk Deployment Options

Beanstalk's deployment options

Configuring Deployments with DeployHQ + GitHub

To setup DeployHQ to deploy a GitHub repository:

  1. Create a new project in DeployHQ
  2. Select the GitHub repository tab
  3. Enter your GitHub username and password
  4. Select the GitHub repository you want to deploy
  5. Add server information like FTP/SFTP, environment, branch, path, username and password and save your settings

DeployHQ's deploy hook URL

If you want to setup auto deployment:

  1. Go to Settings > Servers and Groups for your project and click the server you just setup
  2. Copy the Deploy Hook URL from the sidebar
  3. In GitHub, go to your repository and click Settings > Service Hooks > Webhook URLs
  4. Paste the Deploy Hook URL into the URL field and Update Settings

Read DeployHQ’s article on Using Automatic Deployments for more details.

Posted March 12, 2013 by Jason Siffring

Jason has over 15 years of web development experience and is the owner of Surprise Highway. Follow him on Twitter or Google+.


Scott Munn Scott Munn
on March 13, 2013

We’ve been using auto-deploy too, through Beanstalk.  Changed our workflow!  And now I just signed up for auto-deploy for my personal projects too.  Really beneficial.

John Faulds John Faulds
on March 13, 2013

DeployButton is another service you can look at which does this sort of thing too.

Jason Siffring Jason Siffring
on March 13, 2013

Agreed @Scott. Once you setup deployment you never go back. :)

Thanks @John. I hadn’t heard of that service but it looks worth investigating.

Howdy Stranger Josh Bertrand
on May 21, 2013

DeployButton is seriously perfect and much simpler than DeployHQ for basic deployments. I don’t see any pricing plans so I guess it’s free? So awesome. Thanks John!

John Faulds John Faulds
on May 21, 2013

I actually had some problems with DeployButton not setting up my projects properly so found which is another (at the moment) free service which does the same thing.

Dima Sabanin Dima Sabanin
on January 7, 2014

Have you seen It’s a product of the same company (Wildbit) that makes Beanstalk.

Basically it’s Beanstalk’s deployments but without hosting so you can very easily deploy your GitHub/Bitbucket repos in few clicks.

Disclaimer: I wrote and Beanstalk’s deployments.

Banago Banago
on March 4, 2014

I’ve written a little PHP script for GIT + FTP deployments tool that you can sue locally. It si called PHPloy and is tightly-coupled with Git to determine what which files where edited/added/deleted and uploads them accordingly. You put your FTP details in a deploy.ini file and run just a command to deploy:

>> phploy

You can also deploy to multiple servers at once. And if you have multiple servers configured, you can select to deploy to one of them like this:

>> phploy—server staging

There is more that can be done – check it out on Github.

Dima Sabanin Dima Sabanin
on March 12, 2014

Tiny note about – we dramatically slashed prices and introduce a free plan for 1 private repo. Paying plans now start at $15. Check it out!

Howdy Stranger A
on February 18, 2018

Most of the time I don’t make comments on websites, but I’d like to say that this article really forced me to do so. Really nice post!
app builder

Howdy Stranger as
on February 18, 2018

I found that site very usefull and this survey is very cirious, I ’ ve never seen a blog that demand a survey for this actions, very curious…
mactan newtown

Howdy Stranger robertfcrocker
on February 20, 2018

I can see you have got some very nice customers reviews of Premieressay . I am sure many people want to hire your services after viewing these reviews.

Howdy Stranger ada
on February 21, 2018

I really impressed after read this because of some quality work and informative thoughts . I just wanna say thanks for the writer and wish you all the best for coming!.
Fahrschule Stuttgart

Add your comment

Howdy Stranger
What to do when business is slow
← Previous
Dealing with six degrees of client separation
© 2018 Surprise Highway Inc.