Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How Gitlab Works
Search
Saito
November 18, 2012
Technology
34
4.3k
How Gitlab Works
RubyConfChina presentation.
Saito
November 18, 2012
Tweet
Share
More Decks by Saito
See All by Saito
Middle-Scale F2E Application
saito
3
6.7k
Other Decks in Technology
See All in Technology
DMMブックスへのTipKit導入
ttyi2
1
110
re:Invent2024 KeynoteのAmazon Q Developer考察
yusukeshimizu
1
150
Git scrapingで始める継続的なデータ追跡 / Git Scraping
ohbarye
5
500
Unsafe.BitCast のすゝめ。
nenonaninu
0
200
0→1事業こそPMは営業すべし / pmconf #落選お披露目 / PM should do sales in zero to one
roki_n_
PRO
1
1.5k
RubyでKubernetesプログラミング
sat
PRO
4
160
Bring Your Own Container: When Containers Turn the Key to EDR Bypass/byoc-avtokyo2024
tkmru
0
860
技術に触れたり、顔を出そう
maruto
1
160
Reactフレームワークプロダクトを モバイルアプリにして、もっと便利に。 ユーザに価値を届けよう。/React Framework with Capacitor
rdlabo
0
130
20250116_JAWS_Osaka
takuyay0ne
2
200
【Oracle Cloud ウェビナー】2025年のセキュリティ脅威を読み解く:リスクに備えるためのレジリエンスとデータ保護
oracle4engineer
PRO
1
100
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!事例のご紹介+座学②
siyuanzh09
0
110
Featured
See All Featured
Optimizing for Happiness
mojombo
376
70k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
Rails Girls Zürich Keynote
gr2m
94
13k
How GitHub (no longer) Works
holman
312
140k
The Cult of Friendly URLs
andyhume
78
6.1k
The Invisible Side of Design
smashingmag
299
50k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Designing Experiences People Love
moore
139
23k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Automating Front-end Workflow
addyosmani
1366
200k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
570
A better future with KSS
kneath
238
17k
Transcript
How GitLab Works
Saito github.com/saitowu @saitowu
AIXForce
GitLab?
GitLab? Self Hosted Git Management Application
None
issues code snippet ssh & http wall ... code view
wiki network graph merge request
happy to use it.
happy to use it. want to know how it works?
None
backend
backend repo access
backend repo access presentation layer
Backend
Can be backend:
Can be backend: protocol
Can be backend: file => (RW) git => (R) ssh
=> (RW) http => (RW) protocol
Can be backend: file => (RW) git => (R) ssh
=> (RW) http => (RW) protocol x x
Can be backend: file => (RW) git => (R) ssh
=> (RW) http => (RW) protocol x x #=> remote #=> authentication
SSH:
SSH: normal: authorized_keys
SSH: normal: authorized_keys
SSH:
SSH: gitosis/gitolite: authorized_keys
SSH: gitosis/gitolite: authorized_keys SSH magic command
SSH: gitosis/gitolite: authorized_keys SSH magic command
SSH:
SSH: sshd: not authorized_keys
SSH: sshd: not authorized_keys but patched sshd
SSH: sshd: not authorized_keys but patched sshd
SSH: sshd: not authorized_keys but patched sshd
SSH: sshd: not authorized_keys but patched sshd <= instead of
sshd
SSH:
SSH: GitLab v1.0: gitosis #=> python
SSH: GitLab v1.0: gitosis #=> python GitLab v2.0: gitolite #=>
perl
HTTP:
HTTP: before Git v1.6.6: dumb
HTTP: before Git v1.6.6: dumb after Git v1.6.6: smart!!!
HTTP: https://github.com/schacon/grack/blob/master/lib/git_http.rb#L10-23
git-upload-pack #=> send git-receive-pack #=> receive HTTP:
git-upload-pack #=> send git-receive-pack #=> receive HTTP: smart
HTTP: GitLab v2.7: smart HTTP protocol
Repo Access
Grit: command-line wrapper
Rugged: ruby bindings to libgit2
Grit vs Rugged
Grit vs Rugged win
Grit vs Rugged win lose
Grit vs Rugged win lose github will migrate from grit
to rugged too
Repo Browser
Must Know:
Must Know: Git object model
Must Know: Git encoding strategy Git object model
Must Know: Git encoding strategy Ruby encoding Git object model
Git Object Model:
Git Object Model: 4 basic objects: blob tree commit tag
Git Object Model: 4 basic objects: blob tree commit tag
stored in: .git/objects
Git Object Model:
Git Object Model: git show <sha>
Git Object Model: git cat-file -p <sha> git show <sha>
Git Object Model: http://saito.im/note/Git-Internals/
Git Encoding Strategy: At the core level, git is character
encoding agnostic. http://www.kernel.org/pub/software/scm/git/docs/v1.5.0.2/git-log.html#_discussion
Git Encoding Strategy:
Git Encoding Strategy: filename
Git Encoding Strategy: filename blob contents
Git Encoding Strategy: filename blob contents commit message
Git Encoding Strategy: filename #=> tree blob blob contents commit
message
Git Encoding Strategy: filename #=> tree blob blob contents #=>
blob commit message
Git Encoding Strategy: filename #=> tree blob blob contents #=>
blob commit message #=> commit tag
Git Encoding Strategy:
Git Encoding Strategy: no need #=> blob contents
Git Encoding Strategy: no need #=> blob contents need #=>
commit message, filename
Git Encoding Strategy: no need #=> blob contents need #=>
commit message, filename IMHO: #=> hg hybird strategy & svn
Ruby Encoding: detect encoding:
Ruby Encoding: detect encoding:the longer the better
Ruby Encoding: detect encoding:the longer the better filename
Ruby Encoding: detect encoding:the longer the better filename blob contents
Ruby Encoding: detect encoding:the longer the better filename blob contents
commit message
Ruby Encoding: detect encoding:the longer the better #=> too short
filename blob contents commit message
Ruby Encoding: detect encoding:the longer the better #=> too short
#=> good to detect filename blob contents commit message
Ruby Encoding: detect encoding:the longer the better #=> too short
#=> good to detect #=> not long enough filename blob contents commit message
Ruby Encoding: Character encoding detection:
Ruby Encoding: Character encoding detection: charlock_holmes
Ruby Encoding: Character encoding detection: charlock_holmes rchardet19
Ruby Encoding: Character encoding detection: charlock_holmes #=> libicu rchardet19
Ruby Encoding: Character encoding detection: charlock_holmes #=> libicu rchardet19 #=>
pure ruby
Ruby Encoding:
Ruby Encoding: blob contents:
Ruby Encoding: blob contents: filename and commit message:
Ruby Encoding: blob contents: filename and commit message: detect and
encode
Ruby Encoding: blob contents: filename and commit message: detect and
encode hard to deal with
Ruby Encoding:
Ruby Encoding: CSI
Ruby Encoding: CSI #=> Character Set Independent
Ruby Encoding: CSI USC #=> Character Set Independent
Ruby Encoding: CSI USC #=> Character Set Independent #=> Universal
Character Set
Ruby Encoding: CSI USC #=> Ruby #=> Character Set Independent
#=> Universal Character Set
Ruby Encoding: CSI USC #=> Ruby #=> Java Python Perl
#=> Character Set Independent #=> Universal Character Set
Ruby Encoding:
Ruby Encoding: MRI 1.8:
Ruby Encoding: MRI 1.8: defective encoding
Ruby Encoding: MRI 1.8: MRI 1.9: defective encoding
Ruby Encoding: MRI 1.8: MRI 1.9: defective encoding Encoding Class
Ruby Encoding: MRI 1.8: MRI 1.9: defective encoding pros: regexp
length Encoding Class
Ruby Encoding: MRI 1.8: MRI 1.9: defective encoding pros: regexp
length cons: incompatible character encodings Encoding Class
Hooks
Post-receive:
Post-receive: push event to redis
Post-receive: push event to redis resque it
scalability : Web Hooks Post-receive:
interoperability : API Post-receive:
interoperability : API based on grape Post-receive:
More
Git: pull-request
Git: pull-request git format-patch <br>..<br>
Git: git apply --check <patch> pull-request git format-patch <br>..<br>
Git: git apply --check <patch> pull-request git format-patch <br>..<br> git
am <patch>
Git: git cherry-pick <sha> cherry-pick
One More Thing
Gitlab CI
Thanks