DIY Drupal hosting: Aegir
I had started this series with a post about what features will be evaluated when selecting DIY Drupal hosting solutions. We shall start with the most simplest and earliest solution of them all, Aegir. First, the nomenclature. Aegir is the God of seas and oceans in Norse folklore, much like Varuna in the Hindu pantheon. If Drupal is associated with water drops, it only makes sense to associate a lot of Drupal sites with something relating to the sea or ocean after all! And Aegir stands true to this metaphor.
Aegir has an opinionated view of a Drupal site. Instead of having core and a set of modules and themes checked in, Aegir recommends a Makefile based approach. The former model works equally well on Aegir, as we will see. A drush makefile is more like a snapshot of your Drupal site's code. It contains the version of every module used, all the patches applied to them, and specific installation instructions. All the configuration is stored in features and Aegir heavily relies on a features-based workflow. This set of makefiles, modules and instructions are tagged as a single drupal profile, and this constitutes a "platform", in Aegir lingo. Each platform can have multiple instances(or sites) running on Aegir.
For example, this site will be modelled as "lakshminp blog" platform in Aegir. This will comprise of a set of contrib and custom modules, themes and features tagged as a single Drupal profile. This could be a custom profile, or some contrib profile, like Panopoly. There will be multiple sites running the "lakshminp blog" platform, like the live site, a staging version, a dev version where I'm adding a new feature or fixing a bug. Each of these multisites will be using the same code base and will be modelled as Drupal multisites.
If each of your websites is as unique as a snowflake, then you will have to create an Aegir platform for every site and run an instance of the site on that platform. As a corollary, Aegir suits you best if you have sites with similar functionality/features, as there is lesser administrative overhead involved. Here's where Aegir shines. If you are having a critical security update in core or a contrib module, you have to create a new platform by patching the respective module and simply migrate all the site instances from the old platform to the new one.
Aegir rests on 3 pillars, Hostmaster, provision and drush. Hostmaster is a Drupal 7 install profile which runs the Aegir frontend. Provision is essentially the backend of Hostmaster and contains a set of drush commands like verifying new platforms, creating new instances, adding servers etc. There are other terms which you will hear often when discussing about Aegir, like Eldir, the default theme of Hostmaster(cleverly named, as Eldir is the servant of Aegir), and Hosting, the set of modules which power the Hostmaster installation profile. This is where you need to lay your hands on if you want to extend Aegir's functionality.
The best pick to install Aegir is to use an open source elaborate shell script provided by the nice folks at Omega8. You can try installing an Aegir setup while reading this post. I've tested it on a DigitalOcean(that's an affiliate link BTW) box and the accompanying screenshots are from there. It shouldn't be too different on other VPS providers. Omega8 recommends using a Debian 8 system to install it, which you can do so in the DigitalOcean interface,
DigitalOcean DNS setup for Aegir
I'd suggest that you use a $10 box to try out the setup. You can always scale it up later(very convenient, that). Make sure you are able to ssh as root into the system. After this, you have to download and run a pre-install script,
$ $ cd;wget -q -U iCab http://files.aegir.cc/BOA.sh.txt;bash BOA.sh.txt
This will install another script called
boa. BOA is an acronym for Barracuda Octopus and Aegir. Barracuda is the base system which will install the main instance of Aegir, OS related dependencies and the Hostmaster platform. Octopus is the name given to one or more "satellite" instances where you can install the platforms. Aegir, because, well, the system is powered by it. In essence, a bare minimum BOA setup will consist of one machine, with Barracuda and Octopus running alongside Aegir.
The Aegir model of a drupal site
We've seen how Aegir views your site, i.e. as an instance of an Aegir platform. The first step in creating a new site or importing an existing site into Aegir is creating a platform out of it. A platform can be as sophisticated as a drush makefile, or just the codebase of your existing site. Aegir can take in both, but recommends the former approach, for 2 reasons:
- Our codebase is lean as it contains only the metadata, not the code itself, i.e. the module names, locations(where to download them or git clone them etc.), the versions, the exact patches to be applied. I've seen Drupal codebases grow monstrous and taking a lot of time to clone and setup. A drush makefile based build, especially when applied along with caching strategies works like a charm. Besides, there is also no duplication of code.
- There is no way a hack or a quickfix can seep into your code, as every tiny patch is thoroughly documented in the makefile.
So, makefile or otherwise, your first step is to extract your codebase in a path recommended by Aegir and let Aegir verify this. Once this platform is successfully verified, you can start adding sites to that platform.
Client Acme's ecommerce site could be a platform, and their live site, an instance of this platform. Let's assume that you have 4 other clients with the same set of features, you could add an instance for each of them on the same platform. Now, if there is a security update for one of the modules in this platform, you create a new platform with the fix for that module, and migrate all the instances from the older platform to the newer one.
Aegir can run Drupal 8
Aegir can comfortably run a Drupal 8 site and most of the popular Drupal 8 distributions. The idea being the same, i.e. platform-ize a site, and create new instances out of that platform. There are some limitations though, at the time of writing this, Aegir does not support a composer based Drupal 8 workflow, which IMO is not a mainstream practice in D8 yet. This shouldn't stop you from using Aegir to launch and manage Drupal 8 sites. There have also been attempts to run other PHP frameworks in Aegir with various degrees of success. This could be a killer feature if implemented.
Being one of the first and earliest implementations of DIY Drupal hosting, Aegir is a tried and tested stack. Omega8 has excellent support and provide hosted Aegir instances. Big shoutout to them for open sourcing huge parts of their business back to the community.
Aegir's strengths are its simplicity and its close alignment with Drupal's nuances, like multisite, drush, installation profiles etc. It works best for running bulk updates across sites. This kind of workflow is Suitable for large number of websites with similar profiles. Ex: Universities, brochureware style sites.
Though it serves well for one segment, platform and feature based model is not a good fit for all sites. This point led to creating another awesome tool in the DIY ecosystem, which we will look at next.
DIY Drupal hosting series
DIY Drupal hosting using Aegir - you're here