koillection
koillection copied to clipboard
Container won't start when using Volumes on NFS share
The Container won't start and remains unhealthy when the Config Folder is bound as a NFS Share.
The Log says:
[04-Aug-2022 19:04:40] NOTICE: PHP message: PHP Warning: Can't preload already declared class ReflectionEnum in /var/www/koillection/vendor/laminas/laminas-code/polyfill/ReflectionEnumPolyfill.php on line 8
When opening the Page it shows Symfony Error : attempted to load class webprofilerbundle'' from namespace symfonybundlewebprofilerbundle
Using the default settings and local named volumes everything works fine. Tested with versions 1.3.5, 1.3.9 and 1.3.10
Maybe related to #448?
Hello, I'll investigate a bit later because I never tried to use NFS.
You get this error because the .env.local file from the config folder isn't loaded. The code fallbacks to the default .env file that is configured to load the dev environment, which requires some dev specific dependencies that aren't installed (that's why you get the web profiler error)
Hello @benjaminjonard ,
I think I may be experiencing the same problem. That is, I do get the same error and I did initially map the uploads directory to a directory on the host system, that is actually located on a NFS-fileshare.
For testing purposes I completely disabled volumes for the container (so, no data would be persisted), but I am still getting the same error. It seems that in my case the NFS-fileshare might not be the cause.
The error details:
Attempted to load class "WebProfilerBundle" from namespace "Symfony\Bundle\WebProfilerBundle".
Did you forget a "use" statement for another namespace?
And:
Symfony\Component\ErrorHandler\Error\ClassNotFoundError:
Attempted to load class "WebProfilerBundle" from namespace "Symfony\Bundle\WebProfilerBundle".
Did you forget a "use" statement for another namespace?
at /var/www/koillection/vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:126
at App\Kernel->registerBundles()
(/var/www/koillection/vendor/symfony/http-kernel/Kernel.php:331)
at Symfony\Component\HttpKernel\Kernel->initializeBundles()
(/var/www/koillection/vendor/symfony/http-kernel/Kernel.php:708)
at Symfony\Component\HttpKernel\Kernel->preBoot()
(/var/www/koillection/vendor/symfony/http-kernel/Kernel.php:172)
at Symfony\Component\HttpKernel\Kernel->handle()
(/var/www/koillection/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
(/var/www/koillection/vendor/autoload_runtime.php:29)
at require_once('/var/www/koillection/vendor/autoload_runtime.php')
(/var/www/koillection/public/index.php:5)
Here's what I'm using for Docker Compose:
koillection:
image: koillection/koillection
container_name: koillection
restart: unless-stopped
depends_on:
- postgresdb # another container that hosts multiple databases
ports:
- 80:80
volumes:
- "/opt/docker/volumes/koillection/uploads/:/uploads/"
environment:
APP_ENV: dev
APP_DEBUG: 1
DB_DRIVER: pdo_pgsql
DB_NAME: "koillection"
DB_HOST: "postgresdb"
DB_PORT: "5432" # note that I cannot leave this out; I would otherwise get an error during container startup
DB_USER: "redacted"
DB_PASSWORD: "redacted"
DB_VERSION: "15" # I use "postgres:15-alpine" as my container
# CORS_ALLOW_ORIGIN: '^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
PHP_TZ: "Europe/Amsterdam"
TZ: "Europe/Amsterdam"
UPLOAD_MAX_FILESIZE: 20M
HTTPS_ENABLED: 0
Regarding the error message: I did try to find some information about it myself and I have heard of Symfony before. But I'm not a PHP developer, so at this point it's a bit hard for me to figure out what is wrong.
I'll keep looking and try to get things working. Do you maybe have any suggestions regarding things that I might have missed?
Hello, I think you just have to change APP_ENV to prod
.
I will update the docker-compose.dist.yml file to avoid this confusion
Nice, using the value prod
did the trick.
Indeed, I took the value dev
from the example and to me that made sense, because I was testing things out, before deploying the container to my production system. 🙂