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

Fix borg backup location #172

Conversation

CodeShakingSheep
Copy link
Member

Fixes #171 .

Problem

  • Backups not working.

Solution

  • Adding repository location to borg command.

PR Status

  • Code finished and ready to be reviewed/tested
  • The fix/enhancement were manually tested (if applicable)

Automatic tests

Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ after creating the PR, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

Fix borg backup location
@CodeShakingSheep CodeShakingSheep changed the base branch from master to testing August 10, 2024 18:48
@CodeShakingSheep
Copy link
Member Author

!testme

@yunohost-bot
Copy link
Contributor

📚
Test Badge

@yunohost-bot
Copy link
Contributor

🌻
Test Badge

@ericgaspar ericgaspar requested a review from zamentur August 11, 2024 06:53
@kay0u
Copy link
Member

kay0u commented Aug 13, 2024

Thank for the fix, but are you sure it fix the main issue?

In #171 you say:

I investigated this. When I manually try to run /var/www/borg/venv/bin/borg create --stats '::auto_wordpress__8-{now}' /home/yunohost.backup/tmp/auto_wordpress__8 on my server I get the following error message: ...

but, did you try to export the BORG_REPO env var before or run instead BORG_REPO="$(yunohost app setting borg repository)" /var/www/borg/venv/bin/borg create --stats '::auto_wordpress__8-{now}' /home/yunohost.backup/tmp/auto_wordpress__8

Can you also try to run BORG_REPO="$(yunohost app setting borg repository)" /var/www/borg/venv/bin/borg list and give me the logs? (As I can see, your borg repo is on localhost, and there may be something I broke during the last update for this type of repo)

@CodeShakingSheep
Copy link
Member Author

Hi @kay0u ,
Thank you for your reply.

but, did you try to export the BORG_REPO env var before or run instead BORG_REPO="$(yunohost app setting borg repository)"

No, I haven't exported or set the BORG_REPO env. Thanks for the info about this. Makes sense to set it.

BORG_REPO="$(yunohost app setting borg repository)" /var/www/borg/venv/bin/borg list

When I run that command, this is the output:

Failed to create/acquire the lock /root/.cache/borg/bf18cfbb62b9a2a02557d424a27fb86302af762242568b2bccfe28d2655123a3/lock.exclusive (timeout).

Does that help?

@kay0u
Copy link
Member

kay0u commented Aug 14, 2024

You can try this if you are sure no other process is trying to access borg

/var/www/borg/venv/bin/borg break-lock "$(yunohost app setting borg repository)"

@CodeShakingSheep
Copy link
Member Author

/var/www/borg/venv/bin/borg break-lock "$(yunohost app setting borg repository)"

Ah, thank you. I could successfully break the lock with the command. Afterwards when I ran

BORG_REPO="$(yunohost app setting borg repository)" /var/www/borg/venv/bin/borg list

my snapshots are displayed correctly. There is no error message. So, I'll try again to run the borg backups tonight. Might be the lock that caused my backups to fail. Will report back. Thank you for your support.

@CodeShakingSheep
Copy link
Member Author

Most of my apps could be backed up successfully last night. However, some app backups failed, e.g. for searxng. The error message is really generic:

2024-08-16 07:29:41,983: ERROR - Could not run script: /etc/yunohost/hooks.d/backup_method/05-borg_app
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/yunohost/hook.py", line 298, in hook_callback
    hook_return = hook_exec(
  File "/usr/lib/python3/dist-packages/yunohost/hook.py", line 416, in hook_exec
    raise YunohostError("hook_exec_failed", path=path)
yunohost.utils.error.YunohostError: Could not run script: /etc/yunohost/hooks.d/backup_method/05-borg_app

See https://paste.yunohost.org/raw/lojuputafi Do you have any idea about this @kay0u ?

Anyway, closing this PR as the proposed fix doesn't fix my issue.

@kay0u
Copy link
Member

kay0u commented Aug 19, 2024

@CodeShakingSheep no I have no idea, does it failed again on a more recent backup?

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

Successfully merging this pull request may close these issues.

Borg backup fails "Could not run script: /etc/yunohost/hooks.d/backup_method/05-borg_app"
3 participants