{"id":1122,"date":"2020-04-26T22:36:40","date_gmt":"2020-04-26T14:36:40","guid":{"rendered":"http:\/\/39.97.231.10\/?p=1122"},"modified":"2020-04-26T22:36:40","modified_gmt":"2020-04-26T14:36:40","slug":"gitlab%e6%97%a5%e5%b8%b8%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=1122","title":{"rendered":"Gitlab\u65e5\u5e38\u7ba1\u7406"},"content":{"rendered":"<h1 style=\\\"padding-left: 40px;\\\">Gitlab\u670d\u52a1\u7ec4\u6210<\/h1>\n<pre style=\\\"padding-left: 40px;\\\">nginx: \u9759\u6001web\u670d\u52a1\u5668\ngitlab-shell: \u7528\u4e8e\u5904\u7406Git\u547d\u4ee4\u548c\u4fee\u6539authorized keys\u5217\u8868\ngitlab-workhorse: \u8f7b\u91cf\u7ea7\u7684\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\nlogrotate\uff1a\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406\u5de5\u5177\npostgresql\uff1a\u6570\u636e\u5e93\nredis\uff1a\u7f13\u5b58\u6570\u636e\u5e93\nsidekiq\uff1a\u7528\u4e8e\u5728\u540e\u53f0\u6267\u884c\u961f\u5217\u4efb\u52a1\uff08\u5f02\u6b65\u6267\u884c\uff09\nunicorn\uff1aAn HTTP server for Rack applications\uff0cGitLab Rails\u5e94\u7528\u662f\u6258\u7ba1\u5728\u8fd9\u4e2a\u670d\u52a1\u5668\u4e0a\u9762\u7684\u3002<\/pre>\n<h1 style=\\\"padding-left: 40px;\\\">\u8fd0\u7ef4\u6545\u969c\u6392\u67e5<\/h1>\n<pre class=\\\"rich-text editor-rich-text__editable block-editor-rich-text__editable is-selected\\\" style=\\\"padding-left: 40px;\\\" role=\\\"textbox\\\" contenteditable=\\\"true\\\" aria-multiline=\\\"true\\\" aria-label=\\\"\u7f16\u5199\u9884\u683c\u5f0f\u5316\u6587\u672c\u2026\\\"># \u67e5\u770b\u7248\u672c <br data-rich-text-line-break=\\\"true\\\" \/>cat \/opt\/gitlab\/embedded\/service\/gitlab-rails\/VERSION\n <br data-rich-text-line-break=\\\"true\\\" \/># \u68c0\u67e5gitlab <br data-rich-text-line-break=\\\"true\\\" \/>gitlab-rake gitlab:check SANITIZE=true --trace\n <br data-rich-text-line-break=\\\"true\\\" \/># \u5b9e\u65f6\u67e5\u770b\u65e5\u5fd7 <br data-rich-text-line-break=\\\"true\\\" \/>gitlab-ctl tail\n <br data-rich-text-line-break=\\\"true\\\" \/># \u6570\u636e\u5e93\u5173\u7cfb\u5347\u7ea7 <br data-rich-text-line-break=\\\"true\\\" \/>gitlab-rake db:migrate\n <br data-rich-text-line-break=\\\"true\\\" \/># \u6e05\u7406redis\u7f13\u5b58 <br data-rich-text-line-break=\\\"true\\\" \/>gitlab-rake cache:clear\n <br data-rich-text-line-break=\\\"true\\\" \/># \u5347\u7ea7GitLab-ce \u7248\u672c <br data-rich-text-line-break=\\\"true\\\" \/>yum update gitlab-ce\n <br data-rich-text-line-break=\\\"true\\\" \/># \u5347\u7ea7PostgreSQL\u6700\u65b0\u7248\u672c <br data-rich-text-line-break=\\\"true\\\" \/>gitlab-ctl pg-upgrade<\/pre>\n<h1 style=\\\"padding-left: 40px;\\\">\u670d\u52a1\u7ba1\u7406<\/h1>\n<pre class=\\\"rich-text editor-rich-text__editable block-editor-rich-text__editable is-selected\\\" style=\\\"padding-left: 40px;\\\" role=\\\"textbox\\\" contenteditable=\\\"true\\\" aria-multiline=\\\"true\\\" aria-label=\\\"\u7f16\u5199\u9884\u683c\u5f0f\u5316\u6587\u672c\u2026\\\"># \u542f\u52a8\u6240\u6709 gitlab \u7ec4\u4ef6\uff1a <br data-rich-text-line-break=\\\"true\\\" \/>gitlab-ctl start\n <br data-rich-text-line-break=\\\"true\\\" \/># \u505c\u6b62\u6240\u6709 gitlab \u7ec4\u4ef6\uff1a\ngitlab-ctl stop\n# \u505c\u6b62\u6240\u6709 gitlab postgresql \u7ec4\u4ef6\uff1a\ngitlab-ctl stop postgresql\n# \u505c\u6b62\u76f8\u5173\u6570\u636e\u8fde\u63a5\u670d\u52a1\ngitlab-ctl stop unicorn gitlab-ctl stop sidekiq\n# \u91cd\u542f\u6240\u6709 gitlab \u7ec4\u4ef6\uff1a\ngitlab-ctl restart\n# \u91cd\u542f\u6240\u6709 gitlab gitlab-workhorse \u7ec4\u4ef6\uff1a\ngitlab-ctl restart  gitlab-workhorse\n# \u67e5\u770b\u670d\u52a1\u72b6\u6001\ngitlab-ctl status\n# \u751f\u6210\u914d\u7f6e\u5e76\u542f\u52a8\u670d\u52a1\ngitlab-ctl reconfigure<\/pre>\n<p>\u65e5\u5fd7\u7ba1\u7406<\/p>\n<pre class=\\\"rich-text editor-rich-text__editable block-editor-rich-text__editable is-selected\\\" role=\\\"textbox\\\" contenteditable=\\\"true\\\" aria-multiline=\\\"true\\\" aria-label=\\\"\u7f16\u5199\u9884\u683c\u5f0f\u5316\u6587\u672c\u2026\\\"># \u5b9e\u65f6\u67e5\u770b\u6240\u6709\u65e5\u5fd7\ngitlab-ctl tail\n# \u5b9e\u65f6\u68c0\u67e5redis\u7684\u65e5\u5fd7\ngitlab-ctl tail redis\n# \u5b9e\u65f6\u68c0\u67e5postgresql\u7684\u65e5\u5fd7\ngitlab-ctl tail postgresql\n# \u68c0\u67e5gitlab-workhorse\u7684\u65e5\u5fd7\ngitlab-ctl tail gitlab-workhorse\n# \u68c0\u67e5logrotate\u7684\u65e5\u5fd7\ngitlab-ctl tail logrotate\n# \u68c0\u67e5nginx\u7684\u65e5\u5fd7\ngitlab-ctl tail nginx\n# \u68c0\u67e5sidekiq\u7684\u65e5\u5fd7\ngitlab-ctl tail sidekiq\n# \u68c0\u67e5unicorn\u7684\u65e5\u5fd7\ngitlab-ctl tail unicorn\n#\u68c0\u67e5\u5728gitlab\u4e2d\u662f\u5426\u6709\u4efb\u4f55\u914d\u7f6e\u3002\u5728\u6307\u5b9a\u7248\u672c\u4e2d\u5220\u9664\u7684rb\u3002\ngitlab-ctl check-config\n#\u5b89\u88c5\u90e8\u7f72\u9875\u9762\ngitlab-ctl deploy-page\n#\u5c06\u7528\u6237\u914d\u7f6e\u4e0e\u5305\u53ef\u7528\u914d\u7f6e\u8fdb\u884c\u6bd4\u8f83\ngitlab-ctl diff-config\n#\u5220\u9664\u6240\u6709\u7528\u6237\u548c\u7ec4\ngitlab-ctl remove-accounts\n#\u7248\u672c\u5347\u7ea7\ngitlab-ctl upgrade<\/pre>\n<h1>GitLab\u5907\u4efd\u548c\u6062\u590d<\/h1>\n<ul>\n<li><strong>\u5907\u4efd<\/strong><br \/>\nGitLab\u5907\u4efd\u7684\u9ed8\u8ba4\u76ee\u5f55\u662f \/var\/opt\/gitlab\/backups \uff0c\u53ef\u901a\u8fc7\u4fee\u6539\/etc\/gitlab\/gitlab.rb\u66f4\u6539\u3002<\/li>\n<\/ul>\n<pre>gitlab_rails[\\'backup_path\\'] = \\'\/data\/backups\\'<\/pre>\n<p style=\\\"padding-left: 40px;\\\"><strong>\u5907\u4efd\u547d\u4ee4<\/strong><\/p>\n<pre>gitlab-rake gitlab:backup:create<\/pre>\n<p style=\\\"padding-left: 40px;\\\">\u5907\u6ce8\uff1a\u8be5\u547d\u4ee4\u4f1a\u5728\u5907\u4efd\u76ee\u5f55\uff08\u9ed8\u8ba4\uff1a\/var\/opt\/gitlab\/backups\/\uff09\u4e0b\u521b\u5efa\u4e00\u4e2atar\u538b\u7f29\u5305xxxxxxxx_gitlab_backup.tar\uff0c\u5176\u4e2d\u5f00\u5934\u7684xxxxxx\u662f\u5907\u4efd\u521b\u5efa\u7684\u65f6\u95f4\u6233\uff0c\u8fd9\u4e2a\u538b\u7f29\u5305\u5305\u62ecGitLab\u6574\u4e2a\u7684\u5b8c\u6574\u90e8\u5206\u3002<\/p>\n<p style=\\\"padding-left: 40px;\\\"><strong>\u4fee\u6539\u914d\u7f6e\u4fdd\u7559\u4e03\u5929\u5907\u4efd \/etc\/gitlab\/gitlab.rb\u00a0<\/strong><\/p>\n<pre># \u6570\u503c\u5355\u4f4d\uff1a\u79d2\ngitlab_rails[\\'backup_keep_time\\'] = 604800<\/pre>\n<h1 style=\\\"padding-left: 40px;\\\">\u6062\u590d\u5907\u4efd\u6587\u4ef6\uff1a<\/h1>\n<p style=\\\"padding-left: 40px;\\\">\u505c\u6b62 unicorn \u548c sidekiq \uff0c\u4fdd\u8bc1\u6570\u636e\u5e93\u6ca1\u6709\u65b0\u7684\u8fde\u63a5\uff0c\u4e0d\u4f1a\u6709\u5199\u6570\u636e\u60c5\u51b5\u3002<\/p>\n<pre style=\\\"padding-left: 40px;\\\"># \u505c\u6b62\u76f8\u5173\u6570\u636e\u8fde\u63a5\u670d\u52a1\ngitlab-ctl stop unicorn\ngitlab-ctl stop sidekiq\n# \u6307\u5b9a\u6062\u590d\u6587\u4ef6\uff0c\u4f1a\u81ea\u52a8\u53bb\u5907\u4efd\u76ee\u5f55\u627e\u3002\u5982\/var\/opt\/gitlab\/backups\/499244722_2020_04_05_12.10.1_gitlab_backup.tar\u3002\n# \u6307\u5b9a\u6587\u4ef6\u540d\u7684\u683c\u5f0f\u7c7b\u4f3c\uff1a499242399_2020_04_05_12.10.1\uff0c\u52a0 \u201c_gitlab_backup.tar\u201d\n# \u4e00\u5b9a\u6309\u8fd9\u6837\u7684\u683c\u5f0f\u6307\u5b9a\uff0c\u5426\u5219\u4f1a\u51fa\u73b0 The backup file does not exist! \u7684\u9519\u8bef\ngitlab-rake gitlab:backup:restore BACKUP=499242399_2020_04_05_12.10.1\n# \u542f\u52a8Gitlab\ngitlab-ctl start<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Gitlab\u670d\u52a1\u7ec4\u6210 nginx: \u9759\u6001web\u670d\u52a1\u5668 gitlab-shell: \u7528\u4e8e\u5904\u7406Git\u547d\u4ee4\u548c\u4fee\u6539au &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=1122\"> <span class=\"screen-reader-text\">Gitlab\u65e5\u5e38\u7ba1\u7406<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":1125,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[103],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"shop_catalog":false,"shop_single":false,"shop_thumbnail":false},"uagb_author_info":{"display_name":"weijing","author_link":"http:\/\/www.weijing.co\/?author=4"},"uagb_comment_info":0,"uagb_excerpt":"Gitlab\u670d\u52a1\u7ec4\u6210 nginx: \u9759\u6001web\u670d\u52a1\u5668 gitlab-shell: \u7528\u4e8e\u5904\u7406Git\u547d\u4ee4\u548c\u4fee\u6539au&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1122"}],"collection":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1122"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1122\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1122"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}