{"id":1405,"date":"2021-07-30T15:53:24","date_gmt":"2021-07-30T07:53:24","guid":{"rendered":"https:\/\/egonlin.com\/?p=1405"},"modified":"2022-04-07T11:57:13","modified_gmt":"2022-04-07T03:57:13","slug":"%e7%ac%ac%e4%ba%8c%e8%8a%82%ef%bc%9agitlab%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=1405","title":{"rendered":"\u7b2c\u4e8c\u8282\uff1agitlab\u5e38\u7528\u547d\u4ee4"},"content":{"rendered":"<h1>gitlab\u57fa\u7840\u4f7f\u7528<\/h1>\n<h2>\u4e00\u3001\u7ec4\u4ef6\u4ecb\u7ecd<\/h2>\n<pre><code class=\"language-bash\">1\u3001nginx: \u9759\u6001web\u670d\u52a1\u5668\u5728\u8fd9\u91cc\u63d2\u5165\u4ee3\u7801\u7247\n\n2\u3001gitlab-shell: \u7528\u4e8e\u5904\u7406Git\u547d\u4ee4\u548c\u4fee\u6539authorized keys\u5217\u8868\n3\u3001gitlab-workhorse: \u8f7b\u91cf\u7ea7\u7684\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u5904\u7406\u4e00\u4e9b\u5927\u7684HTTP\u8bf7\u6c42\uff08\u78c1\u76d8\u4e0a\u7684 CSS\u3001JS \u6587\u4ef6\u3001\u6587\u4ef6\u4e0a\u4f20\u4e0b\u8f7d\u7b49\uff09\uff0c\u5904\u7406 Git Push\/Pull \u8bf7\u6c42\uff0c\u5904\u7406\u5230Rails \u7684\u8fde\u63a5\u4f1a\u53cd\u5411\u4ee3\u7406\u7ed9\u540e\u7aef\u7684unicorn\uff08\u4fee\u6539\u7531 Rails \u53d1\u9001\u7684\u54cd\u5e94\u6216\u53d1\u9001\u7ed9 Rails \u7684\u8bf7\u6c42\uff0c\u7ba1\u7406 Rails \u7684\u957f\u671f WebSocket \u8fde\u63a5\u7b49\uff09\u3002\n\n4\u3001logrotate\uff1a\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406\u5de5\u5177\n\n5\u3001postgresql\uff1arepository \u4e2d\u7684\u6570\u636e\uff08\u5143\u6570\u636e\uff0cissue\uff0c\u5408\u5e76\u8bf7\u6c42 merge request \u7b49 , \u53ef\u4ee5\u767b\u5f55 Web \u7684\u7528\u6237\n\n6\u3001redis\uff1a\u7f13\u5b58\u6bcf\u4e2a\u5ba2\u6237\u7aef\u7684sessions\u548c\u540e\u53f0\u961f\u5217\uff0c\u8d1f\u8d23\u5206\u53d1\u4efb\u52a1\u3002Redis\u9700\u6c42\u7684\u5b58\u50a8\u7a7a\u95f4\u5f88\u5c0f\uff0c\u5927\u7ea6\u6bcf\u4e2a\u7528\u623725KB\n\n7\u3001sidekiq\uff1a\u7528\u4e8e\u5728\u540e\u53f0\u6267\u884c\u961f\u5217\u4efb\u52a1\uff08\u5f02\u6b65\u6267\u884c\uff09\n\n8\u3001unicorn\uff1aGitlab \u81ea\u8eab\u7684 Web \u670d\u52a1\u5668(Ruby Web Server)\uff0c\u5305\u542b\u4e86 Gitlab \u4e3b\u8fdb\u7a0b\uff0c\u8d1f\u8d23\u5904\u7406\u5feb\u901f\/\u4e00\u822c\u4efb\u52a1\uff0c\u4e0e Redis \u4e00\u8d77\u5de5\u4f5c\uff0c\u914d\u7f6e\u53c2\u8003\uff1aCPU\u6838\u5fc3\u6570 + 1 = unicorn workers\u6570\u91cf\u3002\n    1. \u901a\u8fc7\u68c0\u67e5\u5b58\u50a8\u5728 Redis \u4e2d\u7684\u7528\u6237\u4f1a\u8bdd\u6765\u68c0\u67e5\u6743\u9650\n    2. \u4e3a Sidekiq \u5236\u4f5c\u4efb\u52a1\n    3. \u4ece\u4ed3\u5e93\uff08warehouse\uff09\u53d6\u4e1c\u897f\u6216\u5728\u90a3\u91cc\u79fb\u52a8\u4e1c\u897f\n\n9\u3001gitlab-shell\uff1a\u7528\u4e8e SSH \u4ea4\u4e92\uff0c\u800c\u4e0d\u662f HTTP\u3002gitlab-shell \u901a\u8fc7 Redis \u4e0e Sidekiq \u8fdb\u884c\u901a\u4fe1\uff0c\u5e76\u76f4\u63a5\u6216\u901a\u8fc7 TCP \u95f4\u63a5\u8bbf\u95ee Unicorn\u3002\u7528\u4e8e\u5904\u7406Git\u547d\u4ee4\u548c\u4fee\u6539authorized keys\u5217\u8868\n\n10\u3001Gitaly\uff1a\u540e\u53f0\u670d\u52a1\uff0c\u4e13\u95e8\u8d1f\u8d23\u8bbf\u95ee\u78c1\u76d8\u4ee5\u9ad8\u6548\u5904\u7406 gitlab-shell \u548c gitlab-workhorse \u7684git \u64cd\u4f5c\uff0c\u5e76\u7f13\u5b58\u8017\u65f6\u64cd\u4f5c\u3002\u6240\u6709\u7684 git \u64cd\u4f5c\u90fd\u901a\u8fc7 Gitaly \u5904\u7406\uff0c\u5e76\u5411 GitLab web \u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u4e00\u4e2a API\uff0c\u4ee5\u4ece git\uff08\u4f8b\u5982 title, branches, tags, other meta data\uff09\u83b7\u53d6\u5c5e\u6027\uff0c\u5e76\u83b7\u53d6 blob\uff08\u4f8b\u5982 diffs\uff0ccommits\uff0cfiles\uff09\n\n11\u3001Sidekiq\uff1a\u540e\u53f0\u6838\u5fc3\u670d\u52a1\uff0c\u53ef\u4ee5\u4eceredis\u961f\u5217\u4e2d\u63d0\u53d6\u4f5c\u4e1a\u5e76\u5bf9\u5176\u8fdb\u884c\u5904\u7406\u3002\u540e\u53f0\u4f5c\u4e1a\u5141\u8bb8GitLab\u901a\u8fc7\u5c06\u5de5\u4f5c\u79fb\u81f3\u540e\u53f0\u6765\u63d0\u4f9b\u66f4\u5feb\u7684\u8bf7\u6c42\/\u54cd\u5e94\u5468\u671f\u3002Sidekiq\u4efb\u52a1\u9700\u8981\u6765\u81eaRedis\n\n12\u3001prometheus:\u63d0\u4f9b\u76d1\u63a7<\/code><\/pre>\n<h2>\u4e8c\u3001\u5e38\u7528\u547d\u4ee4<\/h2>\n<h3>1\u3001\u670d\u52a1\u63a7\u5236\u547d\u4ee4<\/h3>\n<h4>1\uff09\u542f\u52a8\/\u505c\u6b62\/\u91cd\u542f\u6240\u6709 gitlab \u7ec4\u4ef6\uff1a<\/h4>\n<pre><code class=\"language-bash\">gitlab-ctl start\/stop\/restart<\/code><\/pre>\n<h4>2\uff09\u542f\u52a8\u6307\u5b9a\u6a21\u5757\u7ec4\u4ef6\uff1a<\/h4>\n<pre><code class=\"language-bash\"> gitlab-ctl start redis\/postgresql\/gitlab-workhorse\/logrotate\/nginx\/sidekiq\/unicorn<\/code><\/pre>\n<h4>3\uff09\u505c\u6b62\u6307\u5b9a\u6a21\u5757\u7ec4\u4ef6\uff1a<\/h4>\n<pre><code class=\"language-bash\">gitlab-ctl stop \u6a21\u5757\u540d<\/code><\/pre>\n<h4>4\uff09\u67e5\u770b\u670d\u52a1\u72b6\u6001<\/h4>\n<pre><code class=\"language-bash\">gitlab-ctl status<\/code><\/pre>\n<h4>5\uff09\u751f\u6210\u914d\u7f6e\u5e76\u542f\u52a8\u670d\u52a1<\/h4>\n<pre><code class=\"language-bash\"> gitlab-ctl reconfigure<\/code><\/pre>\n<h3>2\u3001\u5176\u4ed6\u5e38\u7528\u7ba1\u7406\u547d\u4ee4<\/h3>\n<h4>1\uff09\u67e5\u770b\u7248\u672c<\/h4>\n<pre><code class=\"language-bash\">cat \/opt\/gitlab\/embedded\/service\/gitlab-rails\/VERSION <\/code><\/pre>\n<h4>2\uff09\u68c0\u67e5gitlab<\/h4>\n<pre><code class=\"language-bash\">gitlab-rake gitlab:check SANITIZE=true --trace<\/code><\/pre>\n<h4>3\uff09\u5b9e\u65f6\u67e5\u770b\u65e5\u5fd7<\/h4>\n<pre><code class=\"language-bash\">gitlab-ctl tail<\/code><\/pre>\n<h4>4\uff09\u5173\u7cfb\u6570\u636e\u5e93\u5347\u7ea7<\/h4>\n<pre><code class=\"language-bash\">gitlab-rake db:migrate<\/code><\/pre>\n<h4>5\uff09\u6e05\u7406redis\u7f13\u5b58<\/h4>\n<pre><code class=\"language-bash\">gitlab-rake cache:clear<\/code><\/pre>\n<h4>6\uff09\u5347\u7ea7gitlab-ce\u7248\u672c<\/h4>\n<p><\/p><div id=\"rml_readmorelogin_placeholder\" style=\"position:relative;\"><div id=\"rml_fade_content\" style=\"position: absolute;\r\ntop:-10em;\r\nwidth:100%;\r\nheight:10em;\r\nbackground: -webkit-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -moz-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -o-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -ms-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\"><\/div><div class=\"wpf-controller aru_rml_from_in_post\" style=\"background-color:#eeeeee;border:5px solid #cce6ff;\" id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><h2 id=\"Header\">\u67e5\u770b\u66f4\u591a<\/h2><div id=\"Message\"><p>\u8054\u7cfb\u7ba1\u7406\u5458\u5fae\u4fe1tutu19192010\uff0c\u6ce8\u518c\u8d26\u53f7<\/p>\n<\/div><div id=\"StatusBarHeader\"><\/div><form id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><input name=\"post_id\" value=\"1405\" type=\"hidden\"\/><input name=\"_init_callback\" value=\"InitLogin\" type=\"hidden\"\/><input name=\"post_id\" value=\"1405\" type=\"hidden\"\/><input name=\"rt_ype\" value=\"1\" type=\"hidden\"\/><input name=\"nonce\" value=\"1a3058e86e\" type=\"hidden\"\/><input name=\"_wpnonce\" value=\"2f39b0f723\" type=\"hidden\"\/><input name=\"_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_proxy_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_view\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginView\" type=\"hidden\"\/><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\" width=\"400px\"><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Username:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"username\" value=\"\" type=\"text\"\/><\/td><\/tr><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Password:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"password\" value=\"\" type=\"password\"\/><\/td><\/tr><\/tbody><\/table><p class=\"wpf-table-placeholder submit\"><button class=\"wp_plugin_framework_ajax_button\" type=\"button\" style=\"background-color:#4D90FE;;color:#ffffff;;border:1px solid #3079ed;\" name=\"_event\" value=\"ButtonLogin\">Log in<\/button><\/p><\/td><td class=\"wpf-table-placeholder-input\"><\/td><\/tr><\/tbody><\/table><\/form><div id=\"ButtonStartRegister\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=register\">Register<\/a><\/div><div id=\"Link1\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=lostpassword\">Forgotten username or password?<\/a><\/div><div id=\"StatusBarFooter\"><\/div><\/div><\/div><div id=aru_remaining_content><\/div>","protected":false},"excerpt":{"rendered":"<p>gitlab\u57fa\u7840\u4f7f\u7528 \u4e00\u3001\u7ec4\u4ef6\u4ecb\u7ecd 1\u3001nginx: \u9759\u6001web\u670d\u52a1\u5668\u5728\u8fd9\u91cc\u63d2\u5165\u4ee3\u7801\u7247 2\u3001gitlab-sh [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":1390,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[170],"tags":[21,178,179,181,182,19,22,180,20],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/1405"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1405"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/1405\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/media\/1390"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}