Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v7.1.15] Snipe-IT – Docker / php artisan schedule:run snipeit:backup #16129

Open
e3elettronica opened this issue Jan 24, 2025 · 1 comment

Comments

@e3elettronica
Copy link

Describe the bug

Hi there

I installed Snipe-IT with docker compose on a ubuntu machine default settings.
It basically works except scheduled backup.
It seems that the php artisan scheduler does not run every minute or it runs with wrong user or wrong permissions.
I seems that running the php artisan scheduler:run with docker user has some permission issues when running some tasks.
I propose to run the php artisan scheduler:run as root user and if needed chown backup file to docker user later, after backup.

Reproduction steps

  • Customize Snipe-IT app section in docker compose file with image snipe/snipe-it:v7.1.15
  • Customize Snipe-IT app section in docker compose file with a local volume bind to /var/lib/snipeit
  • Run docker compose
  • Wait for next day
  • Backups is not created at night at 0.00; no file is found in dumps directory in local volume bind path

Logging inside the container and running

su - docker -c "/var/www/html/artisan schedule:list"

I get

ErrorException

 fopen(/var/www/html/storage/framework/cache/3e/ad/3eadccc6aa63746dc9acc84ccb6cefd1b7031aa7): Failed to open stream: Permission denied

  at /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/LockableFile.php:69
     65▕      * @throws \Exception
     66▕      */
     67▕     protected function createResource($path, $mode)
     68▕     {
  ➜  69▕         $this->handle = fopen($path, $mode);
     70▕     }
     71▕
     72▕     /**
     73▕      * Read the file contents.

      +8 vendor frames

  9   [internal]:0
      Illuminate\Console\Scheduling\ScheduleListCommand::Illuminate\Console\Scheduling\{closure}()
      +15 vendor frames

  25  /var/www/html/artisan:35
      Illuminate\Foundation\Console\Kernel::handle()


Logging inside the container and running

su - root -c "/var/www/html/artisan schedule:list"

I get the scheduler list

Inside the container if running

su - root -c "/var/www/html/artisan schedule:run"

I get

INFO  No scheduled commands are ready to run.

Logging inside the container and running

su - docker -c "/var/www/html/artisan schedule:run"

I get

INFO  No scheduled commands are ready to run.

Logging inside the container and running

su - docker -c "/var/www/html/artisan snipeit:backup"

I get

Starting backup...
Backup failed because: mkdir(): Permission denied.

Expected behavior

Get a new backup file every day, created at 0.00 by snipeit:backup invoked by scheduler:run

Screenshots

No response

Snipe-IT Version

v7.1.15

Operating System

Ubuntu

Web Server

apache

PHP Version

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

No response

Additional context

No response

Copy link

welcome bot commented Jan 24, 2025

👋 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant