Add new comment

John's picture
Submitted by John on

I haven't yet had any opportunity of looking at this problem in full, but here are some ideas that may be of help:

  • Use --dev flag for composer commands (require, install, update?) on local/dev environments. Make sure to only add modules used for development purposes that way. Just don't use the flag on prod to get a non-dev build.
  • Use config_split in order to have small chunks of configuration that you use selectively on a given env. Here's an excellent presentation from DrupalCon Seattle 2019 with a systematic approach.
  • For the actual deploy script:
    • Make sure to run drush updb before drush config:import.
    • Be careful if planning to use symlinks, I remember reading somewhere that Drupal core would not allow using those for a fast directory switch when deploying. Not sure if that's still true, though.
  • Learn the different ways to store small bits of information. This is mostly related to custom code, but also helps when having to set some values in settings.*.php files to move across envs. Also, integrate the concept of "secrets" when handling settings.*.php files, so that you never commit things like API keys, DB credentials, etc.
  • Test your script/workflow to ensure it'll do fine for Drupal core updates. I think 8.4 was somewhat hard for some people; related to this: drush may be a challenge if core changes in a way that requires you to also get a newer drush at the same time.
  • Make sure to setup a proper backup strategy. If you don't want to be super-fancy for this, there is a super-simple script (leveraging drush) over at my personal blog that you can use for reference.

Additionally, I highly recommend using docker + docker-compose for setting up your local env. It gives lots of flexibility given the kind of isolation it provides (easy to rebuild if an env breaks, easy to test out new env options). You may want to have a look at the custom setup I use for any ideas that may be useful for you. BTW, I/O is better on Linux (it's virtualized in macOS).

Hope it helps!

Additional Terms