I followed the official documentation on the Bitbucket DIY Backup and managed to successfully run it to backup my PostgreSQL 14.3 database and the Bitbucket home. However, in a second execution the DIY script fails like this:
[bitbucket.diy-backup.sh:136 -> wait_for_bg_jobs][bb-001] ERROR: Database backup failed with status 1 (PID=25819)
[common.sh:138 -> unlock_bitbucket][bb-001] DEBUG: Running curl -L -s -f -u ******:****** http://localhost:7991/bitbucket/mvc/maintenance/lock?token=2ab330d0a9db44348d9c25d57e5f8d9fb102f421
[bitbucket.diy-backup.sh:139 -> cleanup_incomplete_backup][bb-001] DEBUG: Cleaning up after failed backup
[bitbucket.diy-backup.sh:0 -> main][bb-001] ERROR: Backing up Bitbucket failed
[common.sh:1 -> run_cleanup][bb-001] DEBUG: Running cleanup jobs...
When executing the pg_dump command alone, I see the problem: you cannot dump the database into the same directory (which already contains the first dump) a second time!
pg_dump -U bitbucketuser -h localhost --port=5432 -j 5 -Fd -d bitbucket --no-synchronized-snapshots -f /tmp/pg_dump
pg_dump: error: could not create directory "/tmp/pg_dump": File exists
My questions are now:
If you are looking for a more automated Bitbucket backup and recovery solution you should check Gitprotect.io.
We have an official app listed on the Atlassian marketplace it works both for Bitbucket Cloud and DC. https://marketplace.atlassian.com/apps/1225728/gitprotect-io-backup-for-bitbucket?hosting=cloud&tab=overview
Hi Dominik,
The DIY backup actually has a cleanup function defined in https://bitbucket.org/atlassianlabs/atlassian-bitbucket-diy-backup/src/master/database-postgresql.sh#lines-52 by default it just runs an rm of the dump file - if that's not working as expected you may need to change or amend the function to delete the temporary file.
Cheers,
Christian
Premier Support Engineer
Atlassian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.