1

When developing a Craft 3 site on a multi-environment setup, where would I apply the Craft and Plugin updates?

Should I apply them locally and then commit and replace the database in the dev env, or in dev env and then pull down the database?

Or does Craft have some versioning of the database through db migrations that will help this issue? (Is this where project.yaml comes into play?)

2

You have options, but most people probably do the following...

  1. Apply the updates locally.
  2. Push those changes to the server.
  3. Have Craft run any necessary migrations.

My deployment process ends with the following command being executed on the server:

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

And in my composer.json file, it runs this:

  "scripts": {
    "post-install-cmd": [
      "./craft migrate/all"
    ],
    "post-update-cmd": [
      "./craft migrate/all"
    ]
  }

Between those two commands, it ensures that (A) all of the plugins and libraries specified in my composer file are identical on the production server, and (B) any necessary migrations are run after that.

  • Ah. Yea, good to hear that Craft has database migrations. Perhaps all serious systems have that nowadays. I am currently hosting the site on Hyperlane, and I am guessing they run similar command when composer runs. Just tested it and it worked fine ;-) – nitech Jun 13 at 20:49

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.