Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,457,046
Community Members
 
Community Events
176
Community Groups

Bitbucket DIY backup (with postgres) fails on second execution

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:

  1. Is there any easy option to configure the DIY backup to clean the previous dump?
  2. Why is Bitbucket still in maintenance mode after such an error!? It should get unlocked, but it's not! The Web UI keeps informing about "Performing backup - Backup is currently underway and shouldn't take long."

2 answers

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


0 votes

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

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events