Introduction to Deployer

Deployment, for the longest time the standard approach was to manually upload changed files from a development to the remote production server. But as the years progressed, people realised that this approach just wasn't practical, because of all the potential problems which it can cause.

From a lack of security and clobbering remote files, with no hope of rolling back, to needing ever more sophisticated deployment processes, which cleared and pre-warmed caches, sent Slack and IM notifications, and reloaded servers; the days of just grabbing an FTP client and dumping files on a remote server are a thing of the past.

But once you've accepted you have to implement a proper deployment solution, you have another challenge - what tool do you use? Do you roll your own? Or do you integrate one of the array of existing ones already available.

If you've looked at the competing options, there's plenty to choose from. From Phing, Jenkins, Capistrano, and Capifony, to Deploybot, PHPCI, Rocketeer, Teamcity, and Envoyer.

But which one do you choose?

All of them have pros and cons, but are any of them right for your project?

I want to save you the trouble of choosing the right tool, and introduce you to a simple, yet very effective one in this series. It's called deployer.php.

What is deployer.php

So what is Deployer?

In short, it's a deployment tool written in PHP. This isn't to decry any of the other options, but it's often nice to stay within the confines of one language, instead of chopping and changing between them.

This has the added advantage of avoiding a mental, context switch.

Deployer has a range of benefits, including:

  • It's Fast
  • Modular
  • Supports Rollbacks
  • Supports Atomic Deploys
  • Supports Parallel Tasks
  • Supports Deployment Consistency

Now that's the marketing spiel. The reason why I like it is that it's light and effective, and it doesn't take very long to setup, let alone understand.

When I first started using it, I'd made my first deployment inside a half an hour.

So if you're looking for a tool to get started with quickly, one which takes a minimum of effort, then Deployer is just what you're looking for.

What We'll Cover

Now that I've given Deployer a good sales pitch, what are you going to learn in this series? In a nutshell, you're going to learn the foundations of using it; from installing it, through to your first deployment.

You'll then learn how to configure Deployer to deploy to a range of servers, both local and remote, looking at the different remote authentication options.

With the server configuration completed, we'll then move on to learning how to make use of the in-built tasks, as well as how to write our own tasks, for custom requirements, such as rebooting Nginx and PHP FPM.

After that, you'll be ready to explore further and expand your configuration to the level of complexity which your setup requires. So we'll finish up by looking at how to get help if and when the time comes.

What the Student Will Need

To follow along you're going to need several things.

Server Setup

Firstly, you're going to need either a virtual machine or remote server account, such as those from Digital Ocean and Linode, or another hosting provider, running a recent copy of Linux.

You're not going to need many command-line tools, just git.

The rest should be available in a standard Linux server setup.

On the virtual machine or remote server, you'll need to have a virtual host setup, ready to receive your application's source files. I'm not concerned whether you're running Apache or Nginx. But to follow along, you're going to need one of them, and a directory where your can deploy files to.

PHP Version

In addition to this, you'll need to be running at least PHP 5.4, both locally and remotely. I'm assuming that that won't be an issue. Ideally you'll be working with PHP 5.6, right?


# Title Duration
1 Introduction to Deployer 04:41
2 Installing Deployer 05:17
3 Configuring Deployment Server(s) 07:14
4 Deployer Settings 06:43
5 Running Your First Deployer Deploy 04:53