fr0tt / benotes

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

Docker Install Errors Out With "Invalid Cache Path" When Running "php artisan install --only-user" Inside Container #107

Open Majoraslayer opened 1 month ago

Majoraslayer commented 1 month ago

I'm following the guide here for a Docker install --> https://benotes.org/docs/installation/docker

Note, I'm running on Debian Bullseye. When I reach the step to run "php artisan install --only-user" inside of the container, I get the following output:

   InvalidArgumentException

  Please provide a valid cache path.

  at vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php:36
     32▕      */
     33▕     public function __construct(Filesystem $files, $cachePath)
     34▕     {
     35▕         if (! $cachePath) {
  ➜  36▕             throw new InvalidArgumentException('Please provide a valid cache path.');
     37▕         }
     38▕
     39▕         $this->files = $files;
     40▕         $this->cachePath = $cachePath;

      +20 vendor frames
  21  [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Facade\Ignition\IgnitionServiceProvider))

      +5 vendor frames
  27  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
adelina2kx commented 1 month ago

i hava this issue too

fr0tt commented 1 month ago

Are you using a volume or a bind mount for the storage directory (or in other words, did you alter the command) ?

Majoraslayer commented 1 month ago

Are you using a volume or a bind mount for the storage directory (or in other words, did you alter the command) ?

I'm using volume mounting, but I did alter the command to replace $PWD with the absolute path to the mount point.

fr0tt commented 1 month ago

That's rather strange.

Can you check if the directory storage/framework/cache/data inside the container exists ?

Could be a permission issue, but they usually don't appear using named volumes.

Majoraslayer commented 1 month ago

That's rather strange.

Can you check if the directory storage/framework/cache/data inside the container exists ?

Could be a permission issue, but they usually don't appear using named volumes.

That directory indeed does not exist. The storage directory only contains database.sqlite and a logs directory.

fr0tt commented 1 month ago

Seems the container can't copy the data into the volume, yet somehow manage to copy some data.

You can try to stop the container and delete the volume with docker volume rm benotes_storage and see if it works this time.

RoySRC commented 3 weeks ago

This fixed the problem for me. There was nothing in the /storage directory other than the logs:

    volumes:
      - .env:/var/www/.env
      - ./data/storage/app/public/thumbnails:/var/www/storage/app/public/thumbnails
      - ./data/storage/backup:/var/www/storage/backup
      - ./data/storage/logs:/var/www/storage/logs
      # or instead one named volume to rule them all:   
      #- ./benotes_storage:/var/www/storage
      # this is optional (either way):
      #- ./data/nginx/logs/:/var/lib/nginx/logs/