-
Notifications
You must be signed in to change notification settings - Fork 61
Remove Doctrine proxy directory after fixture loading CLI command #844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Doctrine proxy directory after fixture loading CLI command #844
Conversation
The database reset commands run on container initialization as root. Since these commands also create the Doctrine proxies, the proxy files are then owned by root. This becomes a problem later when a www-data owned process tries to write to the proxy directory. However if we just remove everything that the console commands have created in the data directory, www-data can create its own proxy files and works happily.
… responsibility of the command
Ich würde noch folgende alternative prüfen. $entityManager->getConfiguration()->setAutoGenerateProxyClasses(false); Zu prüfen ist, ob Doctrine damit umgehen kann, wenn man diese Config zur Laufzeit anpasst. |
Kann ich gerne probieren. Denkst du das klappt dann direkt nach einem neu-Deployment, wenn noch gar keine Proxies da sind? Kommt Doctrine dann einfach ohne Proxies aus? In der Doku steht:
(dein vorgeschlagener Wert |
Ich habs ausprobiert. Bei recreate-database und update-database werden die Proxies überhaupt nicht gebraucht, und sie werden auch nicht erstellt wenn sie nicht vorhanden sind. Daher habe ich das unnötige Löschen des Verzeichnisses dort entfernt. Bei load-data-fixtures werden die Proxies aber benötigt und nofalls generiert, und es hat keinen Unterschied gemacht, wenn ich am Anfang des Commands |
The database reset console commands run on container initialization as root. Since these commands also create the Doctrine proxies, the proxy files are then owned by root. This becomes a problem later when a www-data owned process tries to write to the proxy directory.
However if we just remove everything that the console commands have created in the data directory, www-data can create its own proxy files and works happily.
I also added
set -euo pipefail
to the backend entrypoint script, which causes the whole script to exit immediately when one command in it fails. This is unfortunately not the default behaviour of bash, see https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425