Synchronizing code and data between multiple environments is a fact of development life. In Adobe Commerce, there are plenty of moving pieces and peculiarities to remember for refreshing lower level environments in a “clean” way; simply running a git pull or importing a database snapshot is not going to be enough to ensure your env is in a working state. If you periodically have to spend time with your team members debugging side effects of refreshes, only to come to conclusions like “that third-party Composer package got updated” or “you need to run app:config:import, you probably need to develop a consistent workflow around how environments get refreshed.
Every single time upstream code is pulled down in a Magento environment, these steps should be part of the refresh:
Importing a fresh database snapshot from a higher level environment? Make sure you have a solid refresh workflow for this as well. The setup:upgrade and cache flush steps outlined above take care of most of the implications, but it’s good to have a grasp on what those implications are:
Some dev teams might be accustomed to an additional step in their refresh workflow: Updating Store Config values that differ between environments (with config:set or manual SQL queries). I’ve been on teams that employed automated scripts for this very thing, but … then those teams grew into better workflows! This is precisely what locked on-disk configuration in Adobe Commerce is for. Config values that differ between environments - like integration endpoints or credentials, or settings appropriate for production but not development, like static signing - should be locked in env.php in lower level environments. And you should have a good workflow for reliably maintaining this configuration and distributing it to the members of your team.
Chris Nanninga
Director of Training and Development at SwiftOtter