Make use of Drupal's deployment identifier
In some rare scenarios, we have an issue after deployment, e.g. when a service declaration has changed, that the Symfony container doesn't get rebuilt, and we need to truncate the cache_container
table manually to get the site to refresh.
Most likely, the use of the deployment identifier could resolve this issue:
/**
* Deployment identifier.
*
* Drupal's dependency injection container will be automatically invalidated and
* rebuilt when the Drupal core version changes. When updating contributed or
* custom code that changes the container, changing this identifier will also
* allow the container to be invalidated as soon as code is deployed.
*/
# $settings['deployment_identifier'] = \Drupal::VERSION;
As we tag our Drupal projects before deployment, we could use that tag as the identifier so that we always get a valid container for updated sites.