Problems
•We cannot move all projects to GHE
• We have over 700 repositories
• To choose projects to move is difficult
and boring...
•Some teams do not want GHE
We need a way
to Switch to GHE Gradually
Slide 14
Slide 14 text
Goals
•Both GHE and existing repos can be
used for production.
•Anyone can start using GHE easily.
•GHE failure should not cause to
stop deployment.
Slide 15
Slide 15 text
GHE Server
•Spec
• VMWare ESXi
• Active/Standby configuration
• 8 core/500GB SSD
• High-spec!
Slide 16
Slide 16 text
Before GHE
16
developer
developer
developer
git push
git push
git push
Hatena
Repos Server
App server
deploy
3FQPT"
3FQPT#
Slide 17
Slide 17 text
After GHE
developer
developer
developer
git push
git push
git push
GHE
Mirroring
App server
deploy
Hatena
Repos Server
3FQPT"
3FQPT#
3FQPT"
Slide 18
Slide 18 text
Mirroring
developer
git push
Hatena
Repos
GHE
ghm
(later)
Web Hook
call
git remote update
replace all refs
by git remote update
Mirrors changes on GHE to Hatena’s Repos
Slide 19
Slide 19 text
Setting up Mirroring
1.Register Hatena repos
and GHE repos as a Mirroring Pair
2.Set mirroring config to Hatena repos
3.Set push-denial hook to Hatena repos
4.Register WebHook for mirroring to
GHE repos
Slide 20
Slide 20 text
1. Register Hatena repos and
GHE repos as a Mirroring Pair
•Mirroring Pair
hatena.repos:/path/to/projects/Hatena-Bookmark.git
ghe.repos/hatena/Hatena-Bookmark.git
[email protected]
Register the mirroring pair to ghm (next).
[email protected]
.JSSPS
Slide 21
Slide 21 text
ghm
•in-house Web Application for
mirroring pairs management
• Stores mirroring pairs
• Has WebHook API that invoke mirroring
(later)
• Provides some APIs
Slide 22
Slide 22 text
No content
Slide 23
Slide 23 text
2. Set mirroring config to
Hatena repos
• refs/ on the remote will be directly mirrored
into refs/
→ “git remote update“ replaces everything
under refs/ by GHE repos’s refs/
• This is the same as “git clone --mirror”
[remote "origin"]
fetch = +refs/*:refs/*
mirror = true
url = [email protected]:/hatena/Hatena-Bookmark
DPOpH!NJSSPSETU )BUFOB`TSFQPT
Slide 24
Slide 24 text
• “git remote update” destroy changes in dst
repos(Hatena repos)
• Confirm the repos has mirroring config at pre-
receive hook by ghm API
3. Set push-denial hook to
Hatena repos
http://ghm/api/repos?mirror=projects/Hatena-Bookmark
HINSFQPT"1*
Returns repos info if the repos pair is registered.
Slide 25
Slide 25 text
• “git remote update” replaces dst(Hatena repos)
contents by latest src(GHE repos) contents
4.Register WebHook for
mirroring to GHE repos
ssh hatena.repos.host \
'env GIT_DIR="/path/to/HatenaBookmark.git" git remote update'
HIN8FC)PPL"1*SVOT
Slide 26
Slide 26 text
Mirroring behavior
developer
git push
Hatena
Repos
GHE
ghm
Web Hook
call
git remote update
replace all refs
by git remote update
Slide 27
Slide 27 text
Mirroring settings are
too difficult to me..
ϛϥʔϦϯάͷઃఆ͗͜͢͠ΔͩΖ
Slide 28
Slide 28 text
git-hatena
•repository setting tools
• git hatena mirror
‣Set up mirroring
• git hatena sync
‣Change current repository setting
• Easy install (1file & few dependencies)
git hatena sync
• Reflect the mirroring setting to local
repository setting
‣ghm API can returns corresponding
repos of mirroring pairs
$ cd /path/to/local/repos
$ git hatena sync
Slide 31
Slide 31 text
Goals & Solutions
•Both GHE and existing repos can be
used for production.
→ mirroring
•Anyone can start using GHE easily
→ git-hatena
•GHE failure should not cause to stop
deployment.
→ mirroring, rich server
Slide 32
Slide 32 text
GHE and Hatena
•from 2012/8
•80% teams are using GHE
•25% active repositories are on GHE
• many submodules are’t on GHE
• Gradually increasing
Slide 33
Slide 33 text
Dev flow workshop (in-house)
•We are GHE newbies
•Sharing the workflow of development
• from spec definition to production release
• Issues, Pull Request, Code Review, Test, CI,
deploy, etc...
Slide 34
Slide 34 text
Conclusion
•git and Hatena
• We are heavy git users
• 700 over repositories
•Environment for Gradual Switches
• Mirroring (ghm)
• Automation tool (git-hatena)
• High-spec server
•GHE and Hatena