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

Create a Stash mirror as a backup

Adam Nerderman January 27, 2014

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

0 votes
Adam Nerderman January 28, 2014

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.

0 votes
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2014

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events