Open Strehk opened 9 months ago
Hey @TadeSF, thx for opening this issue.
First, are you running this on Linux or Mac/Windows?
The issue I found is the following, the storage folder inside the image contains a directory structure that needs to exist for the app to work. Usually, the expected behavior would be that on first mount, the volume is populated with the container contents. This is what happens if you are using named volumes, for example.
Since on Mac / Windows Docker is running inside a Virtual Machine, there might be problems with this behavior? I also just tested it on MacOS.
If you are indeed on a Linux machine, I will further test this.
The best solution right now would be to use a named volume and then backup this named volume?
I too am getting this, on Linux. Using named volumes is not an option for me, as I require all data to be stored in a local directory for my Docker containers (I am using a server where the Docker volumes may be cleared).
It seems that the mounted directory is not being populated.
The error on request:
work/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#42 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle()
#43 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#45 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then()
#47 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#48 /var/www/html/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle()
#49 {main}
"}
10.0.0.66 - - [09/Mar/2024:04:38:26 +0000] "GET / HTTP/1.1" 500 1027 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0" "-" 0.025 0.025 . -
INFO No scheduled commands are ready to run.
Hello. Is there any update on this? This is really needed in certain docker deployments.
@anarion80 no solution yet. The problem is that the application is unable to create the folder structure in the volume. If you guys have to suggestions on how to tackle this, I appreciate it.
I thought about adding a script for the case where you can not use named volumes, that runs on startup and creates the folder structure inside the mounted path. But not sure if this is the right way to go.
Hey @PhilReinking! You already have a start-container.sh
script that starts the container – is it not possible to just make adaptions to it similar to the following? After my (admittedly not very extensive) research, I would say its best practice.
#!/usr/bin/env sh
# Create necessary directories and set permissions
mkdir -p /var/www/html/storage/framework/sessions
mkdir -p /var/www/html/storage/framework/cache
mkdir -p /var/www/html/storage/framework/views
chown -R nobody:nobody /var/www/html/storage
# Migrate the database
/usr/bin/php /var/www/html/artisan migrate --force
# Start Supervisor
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
# Execute the main command passed to docker run (this is what "exec "$@" does)
exec "$@"
The script inside the container should have all necessary execution rights thanks to these lines already in the Docker-Compose:
COPY --chown=nobody:nobody ./start-container.sh /opt/input/start-container.sh
RUN chmod +x /opt/input/start-container.sh
USER nobody
ENTRYPOINT ["/opt/input/start-container.sh"]
And if I understand Docker correctly, Docker should create the files on the mounted volume with ownership of the configured Docker-User (e.g. www-data
or smth similar)
Btw. sorry for being so unresponsive after submitting the issue – i lost track of it and just now stumbled over the notification 😅
Hey there!
I tried to setup input and I got it working so far. Altough I ran into the same issue raised in #131 today too when trying to add new teammembers, I have a different problem when it comes to docker volumes.
When I create a docker-volume like this ...
... I have no issue. However, when I try to bind mount the volume to my persisted/backed-up storage directory, I get weird errors in the logs, no matter what I try with ownership and permissions and creating the folders and database in advance and/or not... Since storing the data within my persisted path would make my backup-life much easier, I decided to raise this issue.
I got sometimes got different errors, but when I try it like this with no preexisting folder-structure or data without any modification like this ...
... I first get somewhat successful logs ...
... but when I try to access the webpage, I get these errors:
I understand that this must be related to permissions somehow since it works perfectly in a not bind mounted volume. But still whatever I tried, I got (sometimes slightly different) error messages of missing files...
I hope you can help – apart from this I am really enjoying input! If you need any further Info or if I can help in any way, please let me know.
Thanks and all the best, Tade