Single-command High-Performance Drupal/LEMP Deployment
Everyone deserves a fast server.
It is easy to think that performance is a concern mostly to large websites, but with Drupal 7, it is abundantly clear that performance matters to us all now. Drupal 7 simply performs poorly on shared hosting, even on better providers, and although it’s too early to tell, it doesn’t seem likely that Drupal 8 will improve the situation. Small users have been able to get a fairly reasonably-priced VPS for a while now, and some have done so, but this comes with a lot of extra work to set up the server. In addition, small VPSs have memory and processor limitations that can make them perform poorly on a traditional LAMP stack, so performance matters to small sites just as much as big ones.
We need a way to set up high-performance servers without spending hours manually running apt-get and editing config files.
Project Quicksilver solves these problems by giving you single-command installation of a high-performance LEMP stack, including basic tuning and best practices. The name is inspired by Project Mercury, a project that pioneered high-performance Drupal for large sites. It is intended to save you the time it would have taken you to manually set up your VPS, but leave you in full control of your setup. You can set up dev environments locally on your own machine that exactly mirror your production config. This will allow you to experiment with settings and packages that would be unsafe to try on production (want to try Redis? Varnish? Switch to MongoDB or PostgreSQL?), but also allow you to interact with your dev environment with the exact same tools and workflows you use on production.
- Deploy new VPSs in minutes with a repeatable process.
- Alter your configuration quickly and reliably, including the ability to add and remove subdomains, users, and software packages.
- Keep your server config in version control.
- Store your complete server config with less than 1MB–no need to store and migrate full disk images.
- Greatly improve migration and disaster recovery
- Reliably rebuild compromised systems, when a straight backup might be tainted.
Project Quicksilver uses a powerful and reliable stack.
- Ubuntu: Ubuntu Server x64 12.04 LTS (Precise Pangolin). This is a common, well-supported release and will be supported through 2017.
- Nginx: Nginx is simply much faster out of the box than Apache, and it is rock-solid, has a small memory footprint, and is easy to configure - perfect for small sites. It can also serve static assets directly without going to Drupal, resulting is much more efficient downloads for those resources.
- MariaDB: MariaDB is a feature-equivalent branch of MySQL. It will behave exactly the same, but it has fewer bugs and better performance, and it is pure open source (see the Drupalcon Portland presentation).
- PHP-FPM with APC: This version of PHP uses fastCGI and the APC cache to perform much better than stock PHP.
- Memcached: Memcached provides a significant performance boost through caching of pages and other resources.
- Drupal: Project Quicksilver is pretuned for a small Drupal site but is easy to customize for any size site. All of the most important settings for Nginx, FPM, and Memcached have been gathered in the single
tuning.ymlfile, while basic server config and passwords go in the
config.ymlfile, which is not tracked by Git to keep your passwords safe.
Server set up
phpMyAdmin is installed for gui-based management of your databases. For your site management needs, Project Quicksilver includes Git, Git-Flow, and Drush, as well as some scripts for adding and removing sites and subdomains. With these and a good remote file manager (e.g., Forklift(osx), Notepad++(win), FileZilla), you probably won’t miss CTools as much as you might imagine.
You can set timezone and locale settings with simple variables. User accounts are provisioned by default with oh-my-zsh for a pleasant shell experience. SSMTP is set up to allow you to link to an email sending service or gmail.
This technology stack makes for very snappy loading and better scaling, all wrapped up and delivered automatically to the vm of your choice in just a few minutes.
- Vagrant: Vagrant allows single-command provisioning of virtual machines, either on your computer using VirtualBox or VMWare, or on a live VPS provider like Linode or Digital Ocean. The initial implementation is for VirtualBox (free) and Digital Ocean (author’s current choice of provider, although we like Linode a lot too). As seen below, though, this project will be useful on any server, not just those with Vagrant support.
- Ansible: Is a new entrant in the provisioning space, and like the better known Chef and Puppet, it can provision and configure a server in minutes. Ansible is already being used in the Drupal community. It has several advantages for small users:
- The commands and API are very simple and can be learned in a few hours.
- Ansible playbooks are written in YAML and are very human-readable. If you want to understand exactly how a configuration was done, following an Ansible playbook is like reading step-by-step directions.
- It is designed from the ground up to work without an additional provisioning server. Ansible uses SSH to do its work, the same way you would, and it runs from your own computer. Ansible also has a very light footprint on the target system.
- Ansible can provision on any system, so even if the Vagrantfile provided won’t allow you to build on the provider of your choice, you can always run the Ansible scripts on it after you create the VPS manually.
Project Quicksilver installs the latest version of Drush and uses it for all Drupal-related configuration. The choice of when to use a Project Quicksilver script vs. when to use Drush is simple: Project Quicksilver is there to handle the server-level tasks around site creation and destruction: Nginx config files, Drush alias files, etc. If you need a new domain or subdomain, use Project Quicksilver to establish the infrastructure for that in one command. Similarly, if you want to permanently remove a subdomain or tune server performance, use Project Quicksilver. Once the site is up and serving correctly, all you need is Drush to do any updates, imports, or Drupal configuration. Once a site is installed, Project Quicksilver scripts will ignore that site, so you can change configuration of the server without worrying that changes you made to your site with Drush (or manually) will be overwritten.
For instructions to install and user Project Quicksilver, check it out on Github.