Drupal Development, Deployment and Automation with Puppet David Porter Rackspace Hosting Puppet Camp Austin April 2013
Jun 09, 2015
Drupal Development, Deployment and Automation with Puppet
David Porter Rackspace Hosting
Puppet Camp Austin April 2013
2
Tools
• Ubuntu • Apache HTTP Server • MySQL (Rackspace Cloud Databases) • PHP • Drupal • Varnish Cache
To get started, you need a fresh cloud server instance (or other server) running Ubuntu, with root or sudo access. You will also need a fresh database, with the host and user credentials handy to complete the Drupal install.
That's it! Now that you have these items, lets begin.
3
Step 1: Update your package manager
apt-get update
Updating your package manager ensures you have access to the latest software packages
4
Step 2: Install Puppet
apt-get install puppet
Puppet is available via the common repos. Installation is easy and we will add our own drupalstack puppet module to set everything up.
5
Step 3: Install git
apt-get install git-core
We will need git to clone this repo and obtain the base Drupal application code and drupalstack Puppet module.
6
Step 4: Clone this repo
git clone https://github.com/bighappyface/drupal-cloud-tutorial.git
Now that we have the code we can configure this server to run our Drupal application
7
Step 5: Copy module to the Puppet modules folder cp -r drupal-cloud-tutorial/drupalstack /etc/puppet/modules/drupalstack
All Puppet modules from the Puppet Forge will be installed here as well.
8
Step 6: Install Apache and configure
puppet apply -e "include drupalstack::apache"
This class follows a standard pattern in Puppet:
Package/File/Service
9
Step 7: Install PHP
puppet apply -e "include drupalstack::php"
This class is very simple: install PHP and the necessary extensions for Drupal. Also, it installs libapache2-mod-php5 to ensure Apache and PHP work together.
10
Step 8: Install and centralize Drupal
puppet apply -e "include drupalstack::drupalcore"
This technique provides a simple method of upgrading/downgrading Drupal Core without modifying or deploying your application code.
To change Drupal Core, simply update the "$drupal_version" variable to the desired version and run the class.
11
Step 9: Configure Drupal requirements
puppet apply -e "include drupalstack::drupalapp"
This class provides the most common final steps of setting up a new Drupal site.
12
Lessons Learned - Development
Our Drupal application code is decoupled from a full copy of Drupal core.
• Application-specific code under version control • Small file size • Easy upgrade of Drupal core via symlink update
13
Our Drupal application is wrapped within a Puppet module that defines the full application stack necessary to run our whole application.
• Application-specific stack configuration and essentials • Fire-and-forget design to deploy servers and application in isolation
• Configuration under version control to adapt deployment process with application overtime.
Lessons Learned - Deployment
14
Our Puppet module provides a convenient and reliable method for maintaining our application configurations and dependencies.
• Application-specific package, service, and file inventory and documentation
• Configuration under version control to adapt dependencies with application overtime
• Limitless expansion and enhancement options for logging, monitoring, caching, etc.
Lessons Learned - Automation
15
Install Varnish cache, an HTTP accelerator. We can install it on our server using a Drupal-specific configuration and store the raw HTTP output of our application in memory, along with all resources.
To get it going, apply the Puppet class as shown below: puppet apply -e "include drupalstack::varnish"
Bonus – HTTP Accelerator
16
Can you think of a class that could combine these steps into a single step?
With tools like Vagrant, could we tie our Puppet module into a provisioning service to automate spawning instances and applying our module?
For deployment, could offerings such as Cloud Backup, Cloud Load Balancers, and Cloud Monitoring be integrated to improve your applications stability, scalability, and reliability?
Next Steps
17
Discussion
18