Drupal Camp OHIO
Drupdates

Drupdates

Drupal + Updates

easy/automateable Drupal code updates

Created by Jim Taylor / @jalama

Who Am I?

Started in Drupal development in 2007 with version 5.2
bigjim on drupal.org
@jalama on Twitter

I have worked at Rooty Hollow, Verizon Wireless, Highlights for Children.

Current gig, Internet Stratey at Able Applied Technologies

What is Drupdates?

A Python script to help keep your Drupal codebase(s) up to date, leveraging Drush.

It's all about the code, it's up to you to implement, i.e. run update.php

Why Drupdates?

Keep your code updated in one command $ drupdates

Avoid things like Drupalgedon!

Worry less about the Drupal secutiry team's Wednesday module/core/theme updates.

Are you in a PCI evironment, then you have 30 days to apply all CRITICAL security patches!


Why Python?

  • Integrates nicely with command line and stdout/stderr outputs.
  • Has great modules for things like Git integration and http requests.
  • Like PHP and Ruby it does well with structured data like JSON and YAML.
  • The package architecture, ie pip/pypi, is super easy to build on.

So how does it work

Drupdates works in 3 phases

  • Build
  • Update
  • Report

Build the code base

The initial phase is to build the code base from the origin Git repository.

After the repository is built Drush's core-quick-drupal command stands the site up on SQLite.

Note: keeping it simple, uses minimal profile, SQLite, and --max-depth=1 for git pull

Update the code base

The second phase leverages Drush pm-updatestatus and pm-updatecode to run the code updates and apply them where necessary.

Including: modules, theme, core, make files, multi-site installs.

The code is then committed to the remote Git repository.

Report on results

Reporting formats include: stdout, Slack, sendmail and outputting to a file (YAML or JSON).

If an error occurs with a single site that will be reported on and Drupdates will move to the next site. If Drupdates can't function (i.e. can't find Drush) it will quit and report on why.

Features:

Supports multiple site structures and layouts

Repos containing vanilla file/folder layout

  • Site folder/webroot
    • .git
    • includes
    • misc
    • modules
    • index.php
    • install.php
    • update.php
    • ...

Repos containing only make files

  • Site folder/webroot
    • .git
    • mysite.make or mysite.yaml

Repos with make file and a built version of the site

  • Site folder
    • .git
    • makefile
      • mysite.make or mysite.yaml
    • webroot
      • modules
      • index.php
      • install.php
      • ...

Repos containing multisite installs

  • Site folder/webroot
    • .git
    • sites
      • all
      • default
      • example.com
    • modules
    • index.php
    • install.php
    • ...

Supports mulitple configurations per install

If you maintain sites with different file structures or other different updating needs, such as:

committing updates to a feature branch
vs. committing to a shared branch.

You can maintain them with a single Drupdates installation

Virtually every aspect is configurable

You can choose to update enabled modules only, update custom modules, etc...

You can submit a request to deploy code to a project management system or not

Results reported via: sendmail, Slack, written to file or stdout

Demo time!

Major technical concepts

Basic Requirements

  • Drush 7+ (was important to support --check-disabled flag for pm-update)
  • Git 1.7+
  • SQLite
  • Python: 2.6, 2.7, 3.3, 3.4, 3.5-dev
  • Drupal 7+ (D8 support in progress, D6 not tested but may work :))
  • $HOME
    • .drupdates
      • settings.yaml
      • builds
        • example.com
        • example2.com

Settings

Drupdates variabes are stored in YAML files.

Base settings file can be found on Github

All settings can be overwritten:
When Drupdates is run on the cli
in the $HOME/.drupdates/settings.yaml file
and other places

See documentation at http://drupdates.readthedocs.org/

Plugins

Drupdates support a relatively primitive plugin system, I'll be the first to admit it's simple.

Plugins support the different options for reporting results, requesting code deployments, and storage of Git repos.

Source code and documentation

Source Code: https://github.com/jalama/drupdates

Documentation: http://drupdates.readthedocs.org/ (also in the /docs folder in the source code.)

PyPi: https://pypi.python.org/pypi/Drupdates

Travis CI: https://travis-ci.org/jalama/drupdates

Waffle.io: https://waffle.io/jalama/drupdates

Props and presentation

Sam Hetrick, @randompants, for testing help

Presenation available at
http://jalama.github.io/dco-drupdates-presentation,
written using @wesruv's fork of reveal.js