Drupal Backup and Update

Basic Setup Resources

Drupal 7 setup

Drupal 8 setup

Docker docker docker

SSH & Beavernetes

/wiki/spaces/LTD/pages/54874656

TLDR:

  • install kubectl
  • get kubeconfig from Rancher
  • set KUBECONFIG in your shell environment to the path of your kubeconfig file, if it's not in the default $HOME/.kube/config

About half of the sites are on Beavernetes, half on regular servers that need ssh. You probably don't need the AWS stuff for Beavernetes. For SSH, just give ryan your public key. When in doubt, ask ryan


The Process

Run backups

Ryan and Christa run daily database backups and server images that save to AWS. However, this doesn't download the files (drupal files or user-uploads) so it's a good idea to grab those manually. It's also a good idea to have an offline-offsite copy of the database and files just in case. I've included the script I use in the files. It's a bit messy and doesn't backup databases from k8s correctly, so keep that in mind

Update Core (Drupal 7)

  1. Locate these files in your backup

    .htaccess
    .gitignore
    robots.txt
    sites/default/settings.php
  2. Check for updates locally. This will tell you which updates are available and what kind of updates they are.

    drush ups
  3. checkout to new branch

    git checkout -B somethingsomethingsomethingbranchname
  4. update core

    drush up drupal
  5. update db

    drush updatedb
  6. check if the thing works
  7. check release notes (or website) to see if you need to manually update settings.php, .htaccess, or .gitignore. Otherwise, just replace .htaccess, .gitignore, and robots.txt with your backup. (no need to replace settings.php, unless there's updates listed in the release notes)
  8. Commit and push
  9. If you have module updates, skip to the next section, otherwise – merge and pull to server
    1. make sure you run drush updatedb on the server as well

Update Modules (Drupal 7)

  1. on the same branch, check again for updates from drupal.org
    drush ups
  2. make note of any modules that need updates – especially security updates. In general, you don't want to auto update modules with customizations. For Biblio, that's the biblio module. For the main site, that's classy-paragraphs and profile. You also don't want to auto-update anything that will update the version of bootstrap, as OSU's drupal 7 theme relies on a specific, older, version of bootstrap. For oregon explorer and anything on the default osul theme, that's views-bootstrap.
  3. run the updates individually or in bulk. you probably want to only run three or four at a time.
    drush up names of modules separated by a space
  4. clear cache and make sure everything looks ok
  5. repeat
  6. commit with some kind of message about which modules you updated
  7. Sometimes OSUIT releases updates to their custom drupal modules and themes. We use a lot of these. Those are located at https://gitlab.cws.oregonstate.edu/ and are managed by Matthew Brabham. These will need to be downloaded manually from gitlab and the contents of the module/theme folder need to replace the contents of the module or theme folder. If you replace the folder itself, sometimes there's issues
    1. special note for the theme – we have a few css customizations. Nothing huge, but they're there.
  8. clear cache and make sure everything looks ok
  9. repeat
  10. commit with some kind of message
  11. push. review. merge and pull to server.


Update Core (Drupal 8+) (Drupal.org docs)

  1. create a new branch off of staging
  2. check for drupal updates with drush ups
  3. DO NOT INSTALL DRUPAL UPDATES WITH DRUSH. We use Composer now. Long live Composer.
  4. for small updates (Drupal 8.7 → 8.9 for example) follow the docs or just run

    composer update drupal/core --with-dependencies

    1. for the major updates (Drupal 8.9 → 9) first update to the latest possible version of drupal
    2. then update your modules to the newest possible version (below)
    3. install the