Pro Yearly is on sale from $80 to $50! »

How Gitlab Works

7777fbc132a52a9e5f71812645dc534d?s=47 Saito
November 18, 2012

How Gitlab Works

RubyConfChina presentation.

7777fbc132a52a9e5f71812645dc534d?s=128

Saito

November 18, 2012
Tweet

Transcript

  1. How GitLab Works

  2. Saito github.com/saitowu @saitowu

  3. AIXForce

  4. GitLab?

  5. GitLab? Self Hosted Git Management Application

  6. None
  7. issues code snippet ssh & http wall ... code view

    wiki network graph merge request
  8. happy to use it.

  9. happy to use it. want to know how it works?

  10. None
  11. backend

  12. backend repo access

  13. backend repo access presentation layer

  14. Backend

  15. Can be backend:

  16. Can be backend: protocol

  17. Can be backend: file => (RW) git => (R) ssh

    => (RW) http => (RW) protocol
  18. Can be backend: file => (RW) git => (R) ssh

    => (RW) http => (RW) protocol x x
  19. Can be backend: file => (RW) git => (R) ssh

    => (RW) http => (RW) protocol x x #=> remote #=> authentication
  20. SSH:

  21. SSH: normal: authorized_keys

  22. SSH: normal: authorized_keys

  23. SSH:

  24. SSH: gitosis/gitolite: authorized_keys

  25. SSH: gitosis/gitolite: authorized_keys SSH magic command

  26. SSH: gitosis/gitolite: authorized_keys SSH magic command

  27. SSH:

  28. SSH: sshd: not authorized_keys

  29. SSH: sshd: not authorized_keys but patched sshd

  30. SSH: sshd: not authorized_keys but patched sshd

  31. SSH: sshd: not authorized_keys but patched sshd

  32. SSH: sshd: not authorized_keys but patched sshd <= instead of

    sshd
  33. SSH:

  34. SSH: GitLab v1.0: gitosis #=> python

  35. SSH: GitLab v1.0: gitosis #=> python GitLab v2.0: gitolite #=>

    perl
  36. HTTP:

  37. HTTP: before Git v1.6.6: dumb

  38. HTTP: before Git v1.6.6: dumb after Git v1.6.6: smart!!!

  39. HTTP: https://github.com/schacon/grack/blob/master/lib/git_http.rb#L10-23

  40. git-upload-pack #=> send git-receive-pack #=> receive HTTP:

  41. git-upload-pack #=> send git-receive-pack #=> receive HTTP: smart

  42. HTTP: GitLab v2.7: smart HTTP protocol

  43. Repo Access

  44. Grit: command-line wrapper

  45. Rugged: ruby bindings to libgit2

  46. Grit vs Rugged

  47. Grit vs Rugged win

  48. Grit vs Rugged win lose

  49. Grit vs Rugged win lose github will migrate from grit

    to rugged too
  50. Repo Browser

  51. Must Know:

  52. Must Know: Git object model

  53. Must Know: Git encoding strategy Git object model

  54. Must Know: Git encoding strategy Ruby encoding Git object model

  55. Git Object Model:

  56. Git Object Model: 4 basic objects: blob tree commit tag

  57. Git Object Model: 4 basic objects: blob tree commit tag

    stored in: .git/objects
  58. Git Object Model:

  59. Git Object Model: git show <sha>

  60. Git Object Model: git cat-file -p <sha> git show <sha>

  61. Git Object Model: http://saito.im/note/Git-Internals/

  62. 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
  63. Git Encoding Strategy:

  64. Git Encoding Strategy: filename

  65. Git Encoding Strategy: filename blob contents

  66. Git Encoding Strategy: filename blob contents commit message

  67. Git Encoding Strategy: filename #=> tree blob blob contents commit

    message
  68. Git Encoding Strategy: filename #=> tree blob blob contents #=>

    blob commit message
  69. Git Encoding Strategy: filename #=> tree blob blob contents #=>

    blob commit message #=> commit tag
  70. Git Encoding Strategy:

  71. Git Encoding Strategy: no need #=> blob contents

  72. Git Encoding Strategy: no need #=> blob contents need #=>

    commit message, filename
  73. Git Encoding Strategy: no need #=> blob contents need #=>

    commit message, filename IMHO: #=> hg hybird strategy & svn
  74. Ruby Encoding: detect encoding:

  75. Ruby Encoding: detect encoding:the longer the better

  76. Ruby Encoding: detect encoding:the longer the better filename

  77. Ruby Encoding: detect encoding:the longer the better filename blob contents

  78. Ruby Encoding: detect encoding:the longer the better filename blob contents

    commit message
  79. Ruby Encoding: detect encoding:the longer the better #=> too short

    filename blob contents commit message
  80. Ruby Encoding: detect encoding:the longer the better #=> too short

    #=> good to detect filename blob contents commit message
  81. Ruby Encoding: detect encoding:the longer the better #=> too short

    #=> good to detect #=> not long enough filename blob contents commit message
  82. Ruby Encoding: Character encoding detection:

  83. Ruby Encoding: Character encoding detection: charlock_holmes

  84. Ruby Encoding: Character encoding detection: charlock_holmes rchardet19

  85. Ruby Encoding: Character encoding detection: charlock_holmes #=> libicu rchardet19

  86. Ruby Encoding: Character encoding detection: charlock_holmes #=> libicu rchardet19 #=>

    pure ruby
  87. Ruby Encoding:

  88. Ruby Encoding: blob contents:

  89. Ruby Encoding: blob contents: filename and commit message:

  90. Ruby Encoding: blob contents: filename and commit message: detect and

    encode
  91. Ruby Encoding: blob contents: filename and commit message: detect and

    encode hard to deal with
  92. Ruby Encoding:

  93. Ruby Encoding: CSI

  94. Ruby Encoding: CSI #=> Character Set Independent

  95. Ruby Encoding: CSI USC #=> Character Set Independent

  96. Ruby Encoding: CSI USC #=> Character Set Independent #=> Universal

    Character Set
  97. Ruby Encoding: CSI USC #=> Ruby #=> Character Set Independent

    #=> Universal Character Set
  98. Ruby Encoding: CSI USC #=> Ruby #=> Java Python Perl

    #=> Character Set Independent #=> Universal Character Set
  99. Ruby Encoding:

  100. Ruby Encoding: MRI 1.8:

  101. Ruby Encoding: MRI 1.8: defective encoding

  102. Ruby Encoding: MRI 1.8: MRI 1.9: defective encoding

  103. Ruby Encoding: MRI 1.8: MRI 1.9: defective encoding Encoding Class

  104. Ruby Encoding: MRI 1.8: MRI 1.9: defective encoding pros: regexp

    length Encoding Class
  105. Ruby Encoding: MRI 1.8: MRI 1.9: defective encoding pros: regexp

    length cons: incompatible character encodings Encoding Class
  106. Hooks

  107. Post-receive:

  108. Post-receive: push event to redis

  109. Post-receive: push event to redis resque it

  110. scalability : Web Hooks Post-receive:

  111. interoperability : API Post-receive:

  112. interoperability : API based on grape Post-receive:

  113. More

  114. Git: pull-request

  115. Git: pull-request git format-patch <br>..<br>

  116. Git: git apply --check <patch> pull-request git format-patch <br>..<br>

  117. Git: git apply --check <patch> pull-request git format-patch <br>..<br> git

    am <patch>
  118. Git: git cherry-pick <sha> cherry-pick

  119. One More Thing

  120. Gitlab CI

  121. Thanks