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?
Mirror a single repository is fairly easy:
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):
If this is just about backup then I think there are probably easier ways. I'm assuming you've seen our backup documentation?
Are you looking for some kind of cold/warm standby? We just recently released a document describing how high availability can be configured:
You might also be interested in following this issue:
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?
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.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...
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!
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