Create a Stash mirror as a backup

We have a primary instance of Stash. I want to setup a post-receive hook that will automatically push any commits to the mirror instance as well. The problem I'm not sure how to handle is getting the repositories initially created in the mirror. Can this be handled by Stash or the hook where every time a repository is created in the primary instance it is also created in the mirror?

2 answers

This widget could not be displayed.

Hi Adam,

Mirror a single repository is fairly easy:

https://marketplace.atlassian.com/plugins/com.englishtown.stash-hook-mirror

To do it for all repositories is a little more complicated. Post-receive hooks don't fire when repositories are created, for example, so you're going to need something custom to handle that. Or even on the first push you're still going to have to detect that the repository doesn't exist yet and then create it in the appropriate location with the correct permissions.

Just keep in mind that by mirroring, you're not backing up anything related to pull requests (for example):

https://answers.atlassian.com/questions/234680/backup-stash-without-repositories

If this is just about backup then I think there are probably easier ways. I'm assuming you've seen our backup documentation?

https://confluence.atlassian.com/display/STASH/Data+recovery+and+backups

Are you looking for some kind of cold/warm standby? We just recently released a document describing how high availability can be configured:

https://confluence.atlassian.com/display/STASH/High+availability+for+Stash

You might also be interested in following this issue:

https://jira.atlassian.com/browse/STASH-2714

We are very keen to see Stash implement a more sophisticated form of mirroring at some point, but I can't give you much more on when that might happen.

Does that help?

Charles

This widget could not be displayed.

This is not just about backup, but more of a disaster recovery situation where if something happened in our primary data center, we can fail over to the services hosted in another without data loss. The reason for looking into a mirror post-receieve hook was to have the DR instance be updated in real time. We could set up an rsync, but those are scheduled and you are guaranteed some amount of data loss.

For your HA Stash documentation that is basically what we are looking at with the missing piece being the copying/replication of the data.

I have seen that ticket, voted for it and am watching it.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,258 views 8 11
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you