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:
- Export the production database via SSH with mysqldump. Make sure the .sql file is not publicly accessible.
- Download the database via SCP.
- Import the production database locally with mysql.
- Verify the website runs locally, if not, fix errors first.
- Run 'composer update' locally.
- Run './vendor/bin/concrete5 c5:update' locally.
- Verify the website still runs well locally.
- Put production instance in maintenance mode via './vendor/bin/concrete5 c5:config set concrete.maintenance_mode true'.
- Commit + push the changes to 'composer.lock'.
- Pull changes manually on production, if automatic deployment is not set up.
- Run 'composer install' on production, if automatic deployment is not set up.
- Run './vendor/bin/concrete5 c5:update' on production.
- 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.