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.
Talk slides and previous videos: http://oliverdavies.uk/talks/ansible-ansistrano
Also presented at...
- Drupal Bristol (UK) meetup (short version)
- PHP South Wales meetup (short version)
- DrupalCon Amsterdam 2019 (short version)
- Bristol Cloud Native & DevOps meetup (UK)
- Drupal Edinburgh meetup (remote)
Classifiers
Track | Audience(s) | Experience Level | Tags |
---|---|---|---|
DevOps & Misc Development
|
Developers (Back-end php focused)
DevOps Engineers, Tech Leads, Lead Developers
|
Intermediate
|
PHP
|
Scheduling Information
About the Presenter
Oliver Davies (@opdavies) has been building websites since 2007, and speaking at meetups and conferences since 2012. He is a Full Stack Developer and an Acquia certified Drupal Grand Master, who also has experience developing with Symfony, Laravel, Sculpin and Vue.js, as well as with DevOps and systems administration.
He is a Senior Software Engineer and Technical Team Lead at Inviqa, a Drupal core contributor and mentor, and an open source and contribution advocate.
He regularly blogs and gives talks on various topics, maintains and contributes to various open source projects, and co-organises the PHP South Wales user group.