Brendan Dawes
The Art of Form and Code

The Path of Least Resistance — Updating A Server Using DeployHQ

It's very easy to get stuck into certain ways of doing things; there's a comfort in the familiar yet the danger is there's actually a better way of doing X. Take FTPing to a site for example. What I used to do is create new content for my site — usually made up of a number of image files, HTML pages and then upload to the development version of my site. I would check it, then somehow remember which files are new or updated, transfer them by hand to the live local copy of my site, upload to the live server and hope that I haven't forgotten anything. This all works kind of OK when you've only got one or two files but becomes a bit of a headache when you've got many files, especially over several directories.

Thankfully there is a better, more efficient way which involves Git and a deploy service such as DeployHQ.

Automating Deployment

My entire site is tracked in a Git repo in two branches — one called dev and another called live. These are also configured in DeployHQ so each branch references the relevant server credentials. When I want to make changes to my site I make them on the dev branch. In DeployHQ I've set it up so any changes pushed from the dev branch to the repo automatically upload to my dev server — all done via a Webhook from the Git repo.

Deployhq screenshot
A successful deployment

Once I check the dev server and see everything is good I then switch the branch to Live and do a git merge dev. The changes on the dev branch are then merged with the live branch. To put these files on my live server I then just do a git push and those files automatically get sent via FTP to my live server via DeployHQ. All this is done without firing up an FTP application, navigating to various directories and manually uploading files.

Spin Your Own

There are a few different git deploy services out there but you can of course make your own if you want to. This article details the process involved.

Pros and Cons

There can of course be downsides. Bitbucket — where I host my private repos — has been down a few times over the last couple of years but in those cases I can always go back to FTP if needed.

I'm almost two years in to using this service to deploy to my servers and I have to say I'll never go back to manually FTPing a site now that I've experienced the joy that is DeployHQ.