How to update a Composer based concrete5 website

In this post I describe the steps I take to update a Composer based concrete5 installation.

If you are not familiar with a Composer based installation, please take a look at https://github.com/concrete5/composer.

These are the steps I normally take when updating a live website that uses Composer:

  1. Export the production database via SSH with mysqldump. Make sure the .sql file is not publicly accessible.
  2. Download the database via SCP.
  3. Import the production database locally with mysql.
  4. Verify the website runs locally, if not, fix errors first.
  5. Run 'composer update' locally.
  6. Run './vendor/bin/concrete5 c5:update' locally.
  7. Verify the website still runs well locally.
  8. Put production instance in maintenance mode via './vendor/bin/concrete5 c5:config set concrete.maintenance_mode true'.
  9. Commit + push the changes to 'composer.lock'.
  10. Pull changes manually on production, if automatic deployment is not set up.
  11. Run 'composer install' on production, if automatic deployment is not set up.
  12. Run './vendor/bin/concrete5 c5:update' on production.
  13. Verify the website runs well on production and disable the maintenance mode with './vendor/bin/concrete5 c5:config set concrete.maintenance_mode false'.

In case of an unexpected error on production, either fix it asap or 1) Run 'git checkout some_older_commit_hash', 2) Run 'composer install' to go to install the former dependencies and 3) Restore the database backup.