Main website
Government Drupal Developers NetworkCommunity

Development & DevOps

Zero-downtime deploys with Kubernetes and drush deploy

Started by Liam Tremblay on · 279 views · 3 replies · 6 likes

LT

Liam TremblayStarted the thread

Platform Engineer, Canadian Digital Service ·

Sharing our current pipeline for bilingual sites at CDS. Rolling updates on Kubernetes with a pre-deploy Job:

apiVersion: batch/v1
kind: Job
metadata:
  name: drupal-deploy
spec:
  template:
    spec:
      containers:
        - name: drush
          image: registry.example/drupal:${SHA}
          command: ["drush", "deploy", "-y"]
      restartPolicy: Never

The tricky part is schema changes while old pods are still serving. How do others handle update hooks that aren't backwards compatible?

3 replies

  1. Ben Carter

    Security Engineer, Government Digital Service ·

    #1

    We split risky update hooks into two releases (expand, then contract). Slower, but no maintenance pages.

  2. Tama Rangi

    Tech Lead, Department of Internal Affairs ·

    #2

    Same approach. We also put the site in read-only mode for editors (not visitors) during the Job using the readonly_mode module.

  3. Daniel Ortiz

    Drupal Architect, General Services Administration ·

    #3

    Do you run config import in the Job too? We had a race where a new pod booted with old config for ~20s.

Join the conversation

GDDN is for people working on Drupal in government. Log in or apply to reply.