I disable admin updates on production sites, and update Craft and its plugins by updating in the development environment, and then deploying to production using Git.

My basic process starts like this:

  1. Update Craft/Plugins in the development environment
  2. Commit updated composer.json and composer.lock
  3. On production, pull changes from Git
  4. Run composer install

What additional steps are necessary to ensure that the production site is updated correctly?

I'm aware that we still have to run:

  • ./craft project-config/apply
  • ./craft migrate/up

Should we also run these commands?

  • ./craft clear-caches/all
  • ./craft queue/run

Are there any other commands that should be run to help ensure a smooth update? Also, what is the correct order to run them in?



Updating Craft on the production server

Assuming the up-to-date composer file was committed and pushed to the repository:

cd /path/to/repo

# Removes any changes that would block the pull and then pulls from master (or your branch name of choice)
git reset HEAD --hard
git pull origin master

composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader

# Depending on the actual server, reload the PHP FPM service to clear the cache
service php7.4-fpm reload

# This one does a backup by default
./craft migrate/all

./craft project-config/apply

# Watch out here, because probably not all caches should be cleared: Imagine all image transforms are gone, not great.
./craft clear-caches/all 

Updating Craft in the development environment

This part is covered by the docs: Updating from the terminal

To queue or not to queue

In most cases it is not necessary to touch the queue system, since it relies on Control Panel visits. Here is some more info: Queues

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.