fr0tt / benotes

An open source self hosted notes and bookmarks taking web app.
https://benotes.org
MIT License
718 stars 49 forks source link

Error message: "Failed to open stream: Permission denied" #67

Closed infracritical closed 1 year ago

infracritical commented 1 year ago

Installed the most recent version. RTFM'd as per instructions for 'docker-compose'. Got this error message 'dump':

/var/www $ php artisan install Initiate installation...

0/4 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0%

ErrorException

file_put_contents(/var/www/.env): Failed to open stream: Permission denied

at vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php:96 92▕ { 93▕ file_put_contents($this->laravel->environmentFilePath(), preg_replace( 94▕ $this->keyReplacementPattern(), 95▕ 'APP_KEY='.$key, ➜ 96▕ file_get_contents($this->laravel->environmentFilePath()) 97▕ )); 98▕ } 99▕ 100▕ /**

  +13 vendor frames 

14 app/Console/Commands/InstallCommand.php:47 Illuminate\Console\Command::call("key:generate")

  +13 vendor frames 

28 artisan:37 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

fr0tt commented 1 year ago

You need to make sure that all volumes (including the .env file) are readable and writeable by the container.

krylon commented 1 year ago

@infracritical I had the same issue. When I exec into the container and looked at the .env file its owned by root:root. I assumed the application user did not have permissions to write against that file. This is what I did to continue the installation:

docker compose exec --user root app sh chown application:application .env exit docker compose exec --user application app sh php artisan install

fr0tt commented 1 year ago

Is this issue resolved - thanks to @krylon ? If so please close this issue.