Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket Backup Edited

Hello,

I am using a windows environment and self hosted "Server" version of bitbucket

I've read several docs on how to do a bitbucket backup but the "Client" looks dated and im not sure how to proceed with that.

Why does bitbucket not have a native backup option like confluence has ?

Documentation is important but you know what is even more important ?

CODE...

Suggestions, help, advice, tutorials...

Essentially what Im looking for is to have a nightly backup made like I have with confluence and store it on another server which is a normal procedure when it comes to data.

Again I am on a pure windows environment with a MSSQL as the database and self hosted "Server" version of bitbucket

 

Thanks

4 answers

1 accepted

1 vote
Answer accepted

Hi Siavash,

for backup the bitbucket you need to backup two things 

1. data directory 

2. database

 write  batch file to copy your bitbucket data directory to your backup machine every day ,

for database you can write a procedure to backup db every day and copy to backup machine 

HI @CenturyX476

Why does bitbucket not have a native backup option like confluence has ?

As you will know the bitbucket has the code and for native backup, it will take a lot of time (depends on data) as well as consume memory.

As @ajeet_singh said, you can sync your <Bitbucket_Home> dir to your backup server every interval time (depends on you how to want to sync at every an hour/day) and you can write a bash script using which you can take the database backup.

For running automatically the Bash script you need to add the corn job accordingly.

Hello,

Before performing a backup should I stop the bitbucket service ?

Reminder this is a windows environment..

 

Thanks

No need , but you should scheduled backup at night time when server is not busy  

OK great.

I got some scripts to write...

 

Thank You

Hello,

Am using Bitbucket Server self host but not using any database,then HOW should i backup and restore????

I suggest taking a look at SCM Backup tool: https://github.com/christianspecht/scm-backup

We've been using this tool through a Jenkins job to take daily backups of our repositories. It's very convenient and works cross-platform. 

Like # people like this

Hello @Haas, regarding SCM, can you confirm if in fact it doesn’t back up the source files?
In a possible restoration of the data, he will seek the sources from which place?

thank's.

I'm not sure what you mean by source files. It backs up everything in a given git repository as a bare repository. The restoration is a manual task which is not a function of SCM. You just need to copy the back up to the place you want and then just "git clone bare-repo working-repo". You can see the details in its documentation.

Like Vinicius B_ Dezan likes this

@Haas 

I understood, in this case, what I was referring to would be the project's source codes, as these are not saved in the backup file, as described in this part of the documentation:

"Your complete history and your source code are in there - you just don’t see the actual files!

The repository is backed up without a working directory, because it’s not necessary. "

In reality I did not understand very well what it says there, in this case, the source codes are also backed up or when I restore the backup will I have to get the source codes from my local workspace or from my bitbucket repository?

thank you again.

Like Haas likes this

@Vinicius B_ Dezan 

I see your confusion. That's the "bare repository" concept. It seems strange at first glance, indeed. However, it's very simple and it actually forms the backbone of the whole git system.

A bare repository is basically what we call a remote repository in practice, in our case Bitbucket. It's used for centralizing the code versioning for the developers who share it, as you know. Because no one ever makes edits directly to files in the shared bare repo, a working tree is not needed. That's why I mentioned in my previous post "working-repo". If you think about it, it makes sense: it's "bare" because it does not have a working tree. ;)

What SCM does is simple: it creates a new bare repo for you and it becomes your backup file for that repository. Therefore, to restore your working repository to your local environment, you just need to clone from the backup file, just like cloning from a remote repo. In the end, after restoration, you'll see the source code files in your local. Depending on the type of restoration, there might be some additional things to do, such as changing the remote repo URL or (re)tracking all the remote branches, etc.

Like Vinicius B_ Dezan likes this

@Haas 

Now I understand, so in this case, even though there are several developers working on the project, I can do the restoration from a previous day for example using the backup made by SCM (daily backup with the same) and with that, I will have all the source code with the changes that day, without relying on bitbucket or any local directory, correct?

Thank you very much again for returning.

@Vinicius B_ Dezan 

You're welcome and yes, what you said is correct.

Like Vinicius B_ Dezan likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

538 views 6 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you