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

I can't backup #639

Closed
welrbraga opened this issue Apr 14, 2023 · 3 comments · Fixed by #652
Closed

I can't backup #639

welrbraga opened this issue Apr 14, 2023 · 3 comments · Fixed by #652
Labels
Bug Something isn't working

Comments

@welrbraga
Copy link

Bug Description

I've follow the backup and cron instructions but without success, because "it's unable to create a directory".

How to reproduce

The enviroment is working fine for one or two weeks but just yesterday, before a update, I noted that I have read nothing about backups.

Looking for it I've found the page Backup Instruction and after read the instructions I added these lines on my ".env" file and restarted my docker compose stack.

BACKUP_ENABLED=true
BACKUP_DISK=local_backups
BACKUP_NOTIFICATION_EMAIL=welrbraga@MYMAILDOMAIN
BACKUP_MAX_SIZE=100
MAIL_DRIVER=log

The instructions were not clear about the necessity of a cron job config, so I follow this another page about Advanced Settings to generate the cron token and create file /etc/cron.d/linkace with this content:

* * * * * wbraga curl -L 'http://myhost.mydomain/cron/<my-cron-token>'

Thats is running fine, but there are nothing backed up and after almost a day with this config I caught this log message:

Level Context Date Content
error production 2023-04-14 02:02:04 Unable to create a directory at /app/storage/app/backups/linkace-backup. {"exception":"[object (League\Flysystem\UnableToCreateDirectory(code: 0): Unable to create a directory at /app/storage/app/backups/linkace-backup. at /app/vendor/league/flysystem/src/UnableToCreateDirectory.php:18)

Maybe it will be solved manually creating this folder with write permission for nginx, apache or whatever (I wil try this).

But I didn't understand why it wants to create a folder "linkace-backup" inside a folder "backup". It's is really important?

Expected behavior

I were expecting that the app creates all folders need to run correctly during installing or when it is needed used it. And in this specific case some backup files too.

Logs

error	production	2023-04-14 02:02:04	Unable to create a directory at /app/storage/app/backups/linkace-backup. {"exception":"[object] (League\\Flysystem\\UnableToCreateDirectory(code: 0): Unable to create a directory at /app/storage/app/backups/linkace-backup. at /app/vendor/league/flysystem/src/UnableToCreateDirectory.php:18)

Screenshots

No response

LinkAce version

v1.12.0

Setup Method

Docker

Operating System

Linux (Ubuntu, CentOS,...)

Client details

Server

  • OS Linux ubuntu 20.04 (Server)
  • Docker version 23.0.3, build 3e7cbfd
  • Docker Compose version v2.17.2

Client

  • OS Linux ubuntu 20.04 (Client)
  • Browser: Google Chrome 112.0
@welrbraga welrbraga added the Bug Something isn't working label Apr 14, 2023
@welrbraga
Copy link
Author

Like as expected, I've manually created the linkace-backup folder with "uid 82" as owner of this folder and the backup started to run fine.

On the first test I've created the folder (without adjust on ownership) but the log was clear (Unable to write = wrong permissions):

error production 2023-04-15 02:00:07 Unable to write file at location: linkace-backup/2023-04-15-02-00-06.zip. {"exception":"[object] (League\Flysystem\UnableToWriteFile(code: 0): Unable to write file at location: linkace-backup/2023-04-15-02-00-06.zip. at /app/vendor/league/flysystem/src/UnableToWriteFile.php:24)

After that, I changed the owner of folder from root to "82" (UID of www-data user inside container) and finally, my backup was concluded with a zip file saving the "/app" folder and a mysql dump.

@Kovah
Copy link
Owner

Kovah commented Apr 17, 2023

Thanks for taking the time to write the detailed report. The app should already have that folder writable by default by all users because this issue was reported last year. I'll take a look to check what's the issue.

Will also update the docs to include a hint for the Cron setup.

@Alfablos
Copy link

Hello,
looking at the production Dockerfile I can guess that if you're running LinkAce under a "rootful" Docker installation this is expected: if you don't manually create the ./backup directory the Docker daemon creates it for you even before LinkAce does. As a result the directory's ownership is going to be "root:root" with a non permissive mode, which makes it inaccessible to LinkAce which, I assume, is not running as root.

I'd suggest to either adjust the configuration to put all the volumes in a ./volumes directory created before the containers start and then chmod that directory to the UID:GID LinkAce uses inside the container or (better) adding the user:"$UID:$GID" directive to the service in the compose file. You still have to create the volumes directory in advance and run chmod -R but you'll then be able to manage all the files because they'll be owned by you.

I hope this helps!

@Kovah Kovah linked a pull request Jun 4, 2023 that will close this issue
@Kovah Kovah closed this as completed in #652 Jun 4, 2023
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.

3 participants