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

Periodic Backup Failure #412

Closed
bcr-ch opened this issue Mar 8, 2022 · 6 comments · Fixed by #361
Closed

Periodic Backup Failure #412

bcr-ch opened this issue Mar 8, 2022 · 6 comments · Fixed by #361
Labels
Bug Something isn't working

Comments

@bcr-ch
Copy link

bcr-ch commented Mar 8, 2022

Describe the bug
The backup process will run successfully for a couple of days and then I begin getting errors.

Exception message: mkdir() permission denied

To Reproduce
Steps to reproduce the behavior:

  1. Running Linkage on Docker with the following:2.
services:
  # --- MariaDB
  db:
    image: mariadb:10.5
    container_name: bookmark_db
    restart: unless-stopped
    command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin
    environment:
      - MYSQL_ROOT_PASSWORD=SUPERSECRET
      - MYSQL_USER=linkace
      - MYSQL_PASSWORD=ALSOSECRET
      - MYSQL_DATABASE=linkace
      - TZ=Europe/Zurich
    user: "1000:1000"
    networks:
      - net
    volumes:
      - /volumes/db:/var/lib/mysql
  app:
    image: linkace/linkace:simple
    restart: unless-stopped
    container_name: linkace
    environment:
      - TZ=Europe/Zurich
      - DB_HOST=bookmark_db
      - DB_DATABASE=linkace
      - DB_USERNAME=linkace
      - DB_PASSWORD=ALSOSECRET
    depends_on:
      - db
    networks:
      - net
    expose:
      - 80
    volumes:
      - /volumes/.env:/app/.env
      - /volumes/linkace_logs:/app/storage/logs
    labels:
      - 'traefik.enable=true'
      - 'traefik.http.routers.linkace.rule=Host(`FQDN.com`)'
      - 'traefik.http.routers.linkace.entrypoints=https'
      - 'traefik.http.routers.linkace.tls=true'
      - 'traefik.http.routers.linkace.tls.certresolver=letsencrypt'

Wait a couple of days and check e-mail to get this message

Whoops!

Important: An error occurred while backing up LinkAce

Exception message: mkdir(): Permission denied

Exception trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'mkdir(): Permis...', '/app/vendor/spa...', 43) #1 /app/vendor/spatie/temporary-directory/src/TemporaryDirectory.php(43): mkdir('/app/storage/ap...', 511, true) #2 /app/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(139): Spatie\TemporaryDirectory\TemporaryDirectory->create() #3 /app/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php(56): Spatie\Backup\Tasks\Backup\BackupJob->run() #4 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Spatie\Backup\Commands\BackupCommand->handle() #5 /app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container{closure}() #6 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure)) #7 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #8 /app/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #9 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array) #10 /app/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #11 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #12 /app/vendor/spatie/laravel-backup/src/Commands/BaseCommand.php(16): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 /app/vendor/symfony/console/Application.php(1005): Spatie\Backup\Commands\BaseCommand->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #14 /app/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Spatie\Backup\Commands\BackupCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #15 /app/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #16 /app/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #17 /app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #18 /app/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #19 {main}

Regards,
LinkAce

Expected behavior
Should get the standard Success email instead

Screenshots
N/A

LinkAce setup (please complete the following information):

  • Version: 1.9.1
  • Installed via: Docker
  • OS: Ubuntu

Desktop (please complete the following information if applicable):
N/A

Smartphone (please complete the following information if applicable):
N/A

Additional context
When I delete the file ib_logfile0 from the DB volume it starts working again for a few days. I did this based onthis unrelated Stackoverlow article

@bcr-ch bcr-ch added the Bug Something isn't working label Mar 8, 2022
@Kovah
Copy link
Owner

Kovah commented Mar 10, 2022

Could you run docker exec linkace_app_1 ls -la /app/storage/app to check the current state of the backup directory and docker exec linkace_app_1 chmod -R +w /app/storage/app to make it writable again?

@bcr-ch
Copy link
Author

bcr-ch commented Mar 10, 2022

Sure thing:

docker exec linkace ls -la /app/storage/app
total 24
drwxrwxrwx    1 root     root          4096 Mar  8 11:30 .
drwxrwxrwx    1 root     root          4096 Jan 20 22:06 ..
-rwxrwxrwx    1 root     root            23 Jan 20 22:05 .gitignore
drwxr-xr-x    2 root     root          4096 Mar  9 08:19 backup-temp
drwxrwxrwx    1 root     root          4096 Jan 20 22:05 public

Also ran the second command. Will see if it fails gain tonight

@Kovah
Copy link
Owner

Kovah commented Mar 10, 2022

Thanks. Backup will probably fail, because the backup-temp directory is not writable.
You should be able to fix this with docker exec linkace_app_1 chmod +w /app/storage/app/backup-temp.

@bcr-ch
Copy link
Author

bcr-ch commented Mar 11, 2022

Interesting, every time I recreate the container, the backup-temp dir doesn't have the correct permissions... I've updated my docker file and added:

volumes:
  - /volumes/linkace_backup:/app/storage/app/backup-temp

Made this dir chmod 777 and now it runs successfully.

@bcr-ch bcr-ch closed this as completed Mar 11, 2022
@Kovah
Copy link
Owner

Kovah commented Mar 11, 2022

Glad you solved this.
I will leave this open as a task and add the backup-temp directory while building the image.

@Kovah Kovah reopened this Mar 11, 2022
@bcr-ch
Copy link
Author

bcr-ch commented Mar 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants