Deploying PHP applications with Ansible, Ansible Vault and Ansistrano
Great! You’ve built your website, and now you just need to deploy it. There are various ways that this could be done - from (S)FTP, to SCP and rsync, to running commands like git pull
and composer install
directly on the server which is not ideal.
As well provisioning and maintaining your server configuration and running commands, you can also use Ansible to deploy your PHP application - leveraging relevant Ansible modules such as Git and Composer, custom Ansible roles, Ansible Vault for managing secrets, and features such as idempotency out of the box to build a simple deployment playbook. We can then extend that and make it more robust by adding Ansistrano - a port of Capistrano - which adds extra features such as storing multiple builds for each project and the ability to roll-back if needed, customising your build steps using built-in hooks, multi-stage environments and more.
I've been using Ansible and Ansistrano to deploy a variety of PHP projects - including Drupal 7 & 8, Symfony, Laravel and Sculpin, as well as basic HTML websites, and found it to be very flexible and easy to install and use, and by the end of this talk we will have a fully working deployment playbook, deploying real code onto a real server.
Slides
Video
Events
- Drupal Bristol in Bristol, UK - January 23rd, 2019
- PHP South Wales in Cardiff, UK - July 23rd, 2019
- DrupalCon Europe 2019 in Amsterdam, NL - October 30th, 2019
- Bristol Cloud Native & DevOps in Bristol, UK - January 30th, 2020
- Drupal Edinburgh - March 12th, 2020 (online)
- CMS Philly - May 1st, 2020 (online)
- Drupal Yorkshire - May 21st, 2020 (online)
- PHP London - June 4th, 2020 (online)
- PHP North East - June 16th, 2020 (online)
- PHP Sussex - July 1st, 2020 (online)
- Midwest PHP - April 23rd, 2021 (online)
- PHP Oxford - April 28th, 2021 (online)
- Ansible London - May 25th, 2021 (online)
- DrupalNYC - June 15th, 2021 (online)