snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.09k stars 3.18k forks source link

docker container - laravel log cannot be written - permission denied. #12725

Open tsprich opened 1 year ago

tsprich commented 1 year ago

Debug mode

Describe the bug

Debian 11 minmal VM with docker

.myenv MYSQL_PORT_3306_TCP_ADDR=snipe-mysql MYSQL_PORT_3306_TCP_PORT=3306 MYSQL_ROOT_PASSWORD= MYSQL_DATABASE=snipeit MYSQL_USER=snipeit MYSQL_PASSWORD=snipeit

Email Parameters

- the hostname/IP address of your mailserver

MAIL_PORT_587_TCP_ADDR=localhost

the port for the mailserver (probably 587, could be another)

MAIL_PORT_587_TCP_PORT=587

the default from address, and from name for emails

MAIL_ENV_FROM_ADDR=noreply@neusta.de MAIL_ENV_FROM_NAME=Snipe-IT

- pick 'tls' for SMTP-over-SSL, 'tcp' for unencrypted

MAIL_ENV_ENCRYPTION=tcp

SMTP username and password

MAIL_ENV_USERNAME=your_username

MAIL_ENV_PASSWORD=your_email_pw

Snipe-IT Settings

APP_ENV=local APP_DEBUG=true APP_KEY=base64: APP_URL=https://snipe-it.internal.domain.local APP_TIMEZONE=Europe/Berlin # you should change this to your timezone APP_LOCALE=de # you should change this for the desired language APP_TRUSTED_PROXIES= # reverse proxy on localhost SECURE_COOKIES=true

docker-compose.yml version: '3' services: snipe-mysql: container_name: snipe-mysql image: mariadb:10.5 env_file:

laravel log cannot be written. permission denied. This happens either started with an local user or root.

Reproduction steps

Run container with the posted docker-compose on deb 11.

Expected behavior

no errors. It should just start up and run out of the box. If this is an user ID thing (I presume) it should be clearly stated in the docs for Docker how to set this up. https://snipe-it.readme.io/docs/docker

and when I do a chmod -R 777 on /var/www/html/storage in the container for fun the error vanishes .. but I get a new one:

Class 'Laravel\Dusk\DuskServiceProvider' not found...

Screenshots

No response

Snipe-IT Version

latest as of today

Operating System

Debian 11

Web Server

docker exec -ti docker-snipe-it-1 a2query -v 2.4.41

PHP Version

docker exec -ti docker-snipe-it-1 php -v PHP 7.4.3-4ubuntu2.18 (cli) (built: Feb 23 2023 12:43:23) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.3-4ubuntu2.18, Copyright (c), by Zend Technologies

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied The exception occurred while attempting to log: Error: Class 'Laravel\Dusk\DuskServiceProvider' not found in /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:745 Stack trace: #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(679): Illuminate\Foundation\Application->resolveProvider() #1 /var/www/html/app/Providers/AppServiceProvider.php(82): Illuminate\Foundation\Application->register() #2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(682): App\Providers\AppServiceProvider->register() #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\Foundation\Application->register() #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(659): Illuminate\Foundation\ProviderRepository->load() #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders() #6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap() #7 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(153): Illuminate\Foundation\Application->bootstrapWith() #8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(137): Illuminate\Foundation\Http\Kernel->bootstrap() #9 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter() #10 /var/www/html/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle() #11 {main} in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:146 Stack trace: #0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(48): Monolog\Handler\StreamHandler->write() #1 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(359): Monolog\Handler\AbstractProcessingHandler->handle() #2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(602): Monolog\Logger->addRecord() #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Logger.php(183): Monolog\Logger->error() #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Logger.php(94): Illuminate\Log\Logger->writeLog() #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(590): Illuminate\Log\Logger->error() #6 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Log\LogManager->error() #7 /var/www/html/app/Exceptions/Handler.php(47): Illuminate\Support\Facades\Facade::__callStatic() #8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(415): App\Exceptions\Handler->report() #9 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(113): Illuminate\Foundation\Http\Kernel->reportException() #10 /var/www/html/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle() #11 {main}

Additional context

No response

welcome[bot] commented 1 year ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

stepanov1975 commented 1 year ago

Yep, same issue here on the freshly created docker install You need to execute

docker exec -it snipeit chown docker:root /var/www/html/storage/logs/laravel.log
mrnonz commented 1 year ago

@tsprich Did you ever try with php8? How about that?