One tool I am particularly fond of is deployer []

This is such a handy tool, I use it for most of my sites.

What is it?

Deployer is a tool that will help you put your code on your web server (deploying), and without any downtime. This means that it won’t install your new code, when something is wrong during the deploy. Even when everything runs as it should, but you find a bug in your code, you can roll back with ease.

All you need to do is give it a simple configuration. Tell it what host to deploy on, what user to log into that host, what path do you need, where do the files come from, etc. 

Then you provide it by giving it the steps needed to do a deploy. 

  • Take the files from Github.
  • Link the shared directories, these are the files that need to stay intact after a deploy.
  • Do a composer install.
  • etc.

Then deploy has succeeded.  So let’s go with an example.


How does this work?

First we pull in a recipe (Drupal8). This can be anything, from Wordpress, to Laravel, to Symfony, there are tons of recipes.

We tell it where to get the files, in this case they come from Bitbucket. 

The shared directory (in the case of Drupal these are `web/sites/default/files`). Drupal will store the user uploads here. Since these aren’t stored in the repostory, the directory is a shared directory.

There is also a shared files (`web/sites/default/settings.php`). This is the file that contains the database credentials. We don’t want that in our repository and only on the server. This is because the staging and development servers might have different credentials.

In the servers part, we tell it what host to deploy to, what user to user, how to log in, and the directory to deploy to.

Finally, we tell it which tasks to run.

Since the actual Drupal deployment is in the Drupal recipe, we don’t have any of de Drupal specifics.

But, after a deployment, php-fpm needs restarting, so there is a task for that.

Because I run a Drupal installation from composer, and it isn't dowloaded from the site. The `composer install` command needs run, before we create the symlinks.

When that task finishes, we call the restart PHP-FPM function, to restart PHP.

When finishes we can unlock the deploy, and we have the new code running on out server.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.