Backups keep failing

AI-generated summary

Backups are failing with a permission error when trying to create an archive in /var/www/discourse/public/backups/default/. darkpixlz reports the issue started after moving to a new machine, where they copied the app.yml file and restored from a backup. pfaffman suggests checking if the container is running as root and verifying the disk mappings in app.yml. crcoli7307 confirms the mappings, and gerhard points out that copying parts of /var/discourse might have caused permission issues. darkpixlz plans to inspect the container to check directory existence and write permissions.

Hello,

Whenever I try and backup my site, I get an error.

[2022-12-05 00:08:22] pg_dump: executing SEQUENCE SET custom_emojis_id_seq
[2022-12-05 00:08:22] Finalizing backup...
[2022-12-05 00:08:22] Creating archive: blackiron-2022-12-05-000759-v20221201035918.tar.gz
[2022-12-05 00:08:22] Making sure archive does not already exist...
[2022-12-05 00:08:22] Creating empty archive...
[2022-12-05 00:08:22] EXCEPTION: /var/www/discourse/lib/discourse.rb:131:in `exec': tar: /var/www/discourse/public/backups/default/blackiron-2022-12-05-000759-v20221201035918.tar: Cannot open: Permission denied
tar: Error is not recoverable: exiting now

[2022-12-05 00:08:22] /var/www/discourse/lib/discourse.rb:158:in `execute_command'
/var/www/discourse/lib/discourse.rb:131:in `exec'
/var/www/discourse/lib/discourse.rb:28:in `execute_command'
/var/www/discourse/lib/backup_restore/backuper.rb:205:in `create_archive'
/var/www/discourse/lib/backup_restore/backuper.rb:41:in `run'
/var/www/discourse/script/spawn_backup_restore.rb:9:in `backup'
/var/www/discourse/script/spawn_backup_restore.rb:34:in `block in <main>'
/var/www/discourse/script/spawn_backup_restore.rb:4:in `fork'
/var/www/discourse/script/spawn_backup_restore.rb:4:in `<main>'
[2022-12-05 00:08:22] Deleting old backups...
[2022-12-05 00:08:22] Cleaning stuff up...
[2022-12-05 00:08:22] Removing '.tar' leftovers...
[2022-12-05 00:08:22] Marking backup as finished...
[2022-12-05 00:08:22] Refreshing disk stats...
[2022-12-05 00:08:22] Notifying 'darkpixlz' of the end of the backup...
[2022-12-05 00:08:29] Finished!

I’m not sure what’s causing this. It was working fine before yesterday, when we moved to a new machine, which was fresh before we copied over the app.yml file to include our config.

Are you running discourse as root? What is the disk mapping (in the app.yml)?

Yes I am, and I’ll check the disk layout.

These are the disk mappings:

volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

Strange. I would enter the container and see what) whether that directory exists and if you can create a directory there.

Did you copy (parts of) the /var/discourse folder to the new server? That might have messed with the permissions/owner.

We ran the setup script, copied the app.yml, and restored from backup.

I will do that!