This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
One thing that really is annoying, is problem with Symfony cache, when it shouldn't be an issue when working with Symfony4+.
For now, your template suggests that you should mount the
/var/cache
so it can be writable. But not only, having it mounted, means it's shared between deployments.Why is it bad to share symfony cache between deployments ?
1/ Because you need to clear the cache 2 times. once in the
build
step and one in thedeploy
step.If you ommit to do it in the
deploy
step, the application will use the cache from the previous deployment even if you cleared the cache in thebuild
step.2/ Clearing the cache both in the
build
anddeploy
is not reliable. When you are making big changes to your Symfony application, sometimes, Symfony loose the ability to remove the cache with the Symfony command because the application is no longer bootable. It's not that rare, and we all experienced it in dev. So I'm not sure we should suffer from it in a PaaS environment.Exemple of a failure when clearing the cache with Symfony command.
The only workaround is to
rm -rf var/cache/*
which is bad.The solution:
STOP sharing the cache between deploys. Since Symfony4, as long as you're calling
bin/console cache:warmup
the application does not need to write anything by default in the cache folder.See : https://symfony.com/doc/current/setup/file_permissions.html