{"id":1745,"date":"2020-07-01T04:09:41","date_gmt":"2020-06-30T20:09:41","guid":{"rendered":"http:\/\/39.97.231.10\/?p=1745"},"modified":"2020-07-01T04:09:41","modified_gmt":"2020-06-30T20:09:41","slug":"gitlab%e6%90%ad%e5%bb%ba%e5%8f%8a%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=1745","title":{"rendered":"GitLab\u642d\u5efa\u53ca\u914d\u7f6e"},"content":{"rendered":"<div>\n<blockquote>\n<ul>\n<li>\u76ee\u524d\u5e02\u9762\u4e0a\u6bd4\u8f83\u6709\u540d\u7684Git\u670d\u52a1\u63d0\u4f9b\u5546\uff0c\u56fd\u5916\u6709<a href=\\\"https:\/\/link.jianshu.com?t=https:\/\/github.com\/\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">GitHub<\/a>\u3001<a href=\\\"https:\/\/link.jianshu.com?t=https:\/\/bitbucket.org\/\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">BitBucket<\/a>\u3001<a href=\\\"https:\/\/link.jianshu.com?t=https:\/\/about.gitlab.com\/\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">GitLab<\/a>\uff0c\u56fd\u5185\u6709<a href=\\\"https:\/\/link.jianshu.com?t=https:\/\/coding.net\/\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">Coding<\/a>\u3002<\/li>\n<li>\u73b0\u6709\u7684\u670d\u52a1\u5546\uff0c\u5bf9\u4e8e\u514d\u8d39\u7684\u5957\u9910\u90fd\u6709\u4e00\u5b9a\u7684\u9650\u5236\u3002\u6bd4\u5982\uff1aGitHub\u53ea\u5141\u8bb8\u5efa\u7acb\u514d\u8d39\u7684\u5f00\u6e90repository\uff0c\u5efa\u7acb\u79c1\u6709\u7684\u4ed3\u5e93\u9700\u8981\u6536\u8d39\u3002BitBucket\u5141\u8bb8\u5efa\u7acb\u65e0\u9650\u5236\u7684\u79c1\u6709\u9879\u76ee\uff0c\u4e0d\u8fc7\u5bf9\u4e8e\u9879\u76ee\u4e2d\u53c2\u4e0e\u7684\u5f00\u53d1\u4eba\u5458\u662f\u6709\u4eba\u6570\u9650\u5236\u7684\uff0c\u5f53\u56e2\u961f\u4e2d\u5f00\u53d1\u8005\u89c4\u6a21\u8fbe\u5230\u4e00\u5b9a\u6570\u91cf\u540e\uff0c\u9700\u8981\u4ed8\u8d39\u8d2d\u4e70\u76f8\u5e94\u7684\u5957\u9910\u3002GitLab\u793e\u533a\u7248\u662f\u514d\u8d39\u7684\uff0c\u4e0d\u4f46\u80fd\u5efa\u7acb\u514d\u8d39\u7684\u79c1\u6709\u4ed3\u5e93\u800c\u4e14\u6ca1\u6709\u6570\u91cf\u4e0a\u9650\uff0c\u53c2\u4e0e\u4eba\u5458\u4e5f\u6ca1\u6709\u6570\u91cf\u9650\u5236\uff0c\u8fd8\u80fd\u8bbe\u7f6e\u6210\u5458\u7684\u6743\u9650\uff0c\u751a\u81f3\u7ec6\u81f4\u5230\u5177\u4f53\u67d0\u6761\u5206\u652f\u7684\u6743\u9650\uff0c\u4ee5\u53ca\u5f3a\u5927\u7684\u5de5\u4f5c\u6d41\u7b49\u7b49\u3002<\/li>\n<\/ul>\n<\/blockquote>\n<p>GitLab\u5f88\u9002\u5408\u4e2d\u5c0f\u578b\u975e\u5f00\u6e90\u9879\u76ee\u516c\u53f8\u3002<\/p>\n<div>\n<div>\n<div><\/div>\n<div data-width=\\\"585\\\" data-height=\\\"216\\\"><img src=\\\"\/\/upload-images.jianshu.io\/upload_images\/2163345-4294b7b44db48f66.jpg?imageMogr2\/auto-orient\/strip|imageView2\/2\/w\/585\/format\/webp\\\" data-original-src=\\\"\/\/upload-images.jianshu.io\/upload_images\/2163345-4294b7b44db48f66.jpg\\\" data-original-width=\\\"585\\\" data-original-height=\\\"216\\\" data-original-format=\\\"image\/png\\\" data-original-filesize=\\\"16884\\\" data-image-index=\\\"0\\\" \/><\/div>\n<\/div>\n<div><\/div>\n<\/div>\n<h1>\u4e00\u3001GitLab \u7b80\u4ecb<\/h1>\n<p>GitLab \u662f\u4e00\u4e2a\u5229\u7528Ruby on Rails \u5f00\u53d1\u7684\u5f00\u6e90\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5b9e\u73b0\u4e00\u4e2a\u81ea\u6258\u7ba1\u7684Git\u9879\u76ee\u4ed3\u5e93\uff0c\u53ef\u901a\u8fc7Web\u754c\u9762\u8fdb\u884c\u8bbf\u95ee\u516c\u5f00\u7684\u6216\u8005\u79c1\u4eba\u9879\u76ee\u3002<br \/>\n\u5b83\u62e5\u6709\u4e0eGitHub\u7c7b\u4f3c\u7684\u529f\u80fd\uff0c\u80fd\u591f\u6d4f\u89c8\u6e90\u4ee3\u7801\uff0c\u7ba1\u7406\u7f3a\u9677\u548c\u6ce8\u91ca\u3002\u53ef\u4ee5\u7ba1\u7406\u56e2\u961f\u5bf9\u4ed3\u5e93\u7684\u8bbf\u95ee\uff0c\u5b83\u975e\u5e38\u6613\u4e8e\u6d4f\u89c8\u63d0\u4ea4\u8fc7\u7684\u7248\u672c\u5e76\u63d0\u4f9b\u4e00\u4e2a\u6587\u4ef6\u5386\u53f2\u5e93\u3002\u56e2\u961f\u6210\u5458\u53ef\u4ee5\u5229\u7528\u5185\u7f6e\u7684\u7b80\u5355\u804a\u5929\u7a0b\u5e8f\uff08Wall\uff09\u8fdb\u884c\u4ea4\u6d41\u3002\u5b83\u8fd8\u63d0\u4f9b\u4e00\u4e2a\u4ee3\u7801\u7247\u6bb5\u6536\u96c6\u529f\u80fd\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u4ee3\u7801\u590d\u7528\uff0c\u4fbf\u4e8e\u65e5\u540e\u6709\u9700\u8981\u7684\u65f6\u5019\u8fdb\u884c\u67e5\u627e\u3002<br \/>\n\u5f00\u6e90\u4e2d\u56fd\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0 \u7801\u4e91 \u5c31\u662f\u57fa\u4e8eGitLab\u9879\u76ee\u642d\u5efa\u3002<br \/>\nGitLab \u5206\u4e3a GitLab Community Edition(CE) \u793e\u533a\u7248 \u548c GitLab Enterprise Edition(EE) \u4e13\u4e1a\u7248\u3002\u793e\u533a\u7248\u514d\u8d39\uff0c\u4e13\u4e1a\u7248\u6536\u8d39\uff0c\u4e24\u4e2a\u7248\u672c\u5728\u529f\u80fd\u4e0a\u7684\u5dee\u5f02\u5bf9\u6bd4\uff0c\u53ef\u4ee5\u53c2\u8003\u5b98\u65b9\u5bf9\u6bd4\u8bf4\u660e<\/p>\n<h1>\u4e8c\u3001GitLab \u5b89\u88c5\u548c\u914d\u7f6e<\/h1>\n<p>\u5b89\u88c5\u793e\u533a\u7248\uff0cGitLab CE \u7248\u672c\uff1a9.2.6<\/p>\n<h2>1\u3001GitLab\u5b89\u88c5<\/h2>\n<p>\u901a\u8fc7GitLab\u5b98\u65b9\u63d0\u4f9b\u7684Omnibus\u5b89\u88c5\u5305\u6765\u5b89\u88c5\uff0c\u76f8\u5bf9\u65b9\u4fbf\u3002Omnibus\u5b89\u88c5\u5305\u5957\u4ef6\u6574\u5408\u4e86\u5927\u90e8\u5206\u7684\u5957\u4ef6\uff08Nginx\u3001ruby on rails\u3001git\u3001redis\u3001postgresql\u7b49\uff09\uff0c\u518d\u4e0d\u7528\u989d\u5916\u5b89\u88c5\u8fd9\u4e9b\u8f6f\u4ef6\uff0c\u51cf\u8f7b\u4e86\u7edd\u5927\u90e8\u5206\u5b89\u88c5\u91cf\u3002<br \/>\nGitLab\u5b98\u65b9\u5b89\u88c5\u6587\u6863 \uff1aCentOS6.x\u7cfb\u7edf<\/p>\n<h3>\u5b89\u88c5\u4f9d\u8d56\u5305\uff0c\u5e76\u914d\u7f6epostfix\u670d\u52a1\u4e3aGitLab\u90ae\u4ef6\u670d\u52a1<\/h3>\n<div>\n<pre># yum install curl openssh-server openssh-clients postfix cronie\n# service postfix start\n# chkconfig postfix on\n<\/pre>\n<\/div>\n<h3>\u6253\u5f00HTTP\u548cSSH\u7aef\u53e3<\/h3>\n<div>\n<pre># iptables -I INPUT -m tcp -p tcp --dport 22 -j ACCEPT\n# iptables -I INPUT -m tcp -p tcp --dport 80 -j ACCEPT\n<\/pre>\n<\/div>\n<h3>\u4e24\u79cd\u5b89\u88c5\u6e90<\/h3>\n<ul>\n<li>\u4ece\u5b98\u65b9\u955c\u50cf\u6e90\u5b89\u88c5<\/li>\n<\/ul>\n<p>\u6dfb\u52a0GitLab\u4ed3\u5e93\u5e76\u5b89\u88c5\u5230\u670d\u52a1\u5668\u4e0a<\/p>\n<div>\n<pre># curl -sS http:\/\/packages.gitlab.cc\/install\/gitlab-ce\/script.rpm.sh | sudo bash\n# yum install gitlab-ce     # \u81ea\u52a8\u5b89\u88c5\u6700\u65b0\u7248\u672c\n# yum install gitlab-ce-9.2.1-ce.0.el6     # \u5b89\u88c5\u6307\u5b9a\u7248\u672c\n<\/pre>\n<\/div>\n<ul>\n<li>\u4ece\u7b2c\u4e09\u65b9\u955c\u50cf\u6e90\u5b89\u88c5<\/li>\n<\/ul>\n<p>\u5b98\u65b9\u955c\u50cf\u6e90\u5728\u56fd\u5916\uff0c\u56fd\u5185\u5b89\u88c5\u4f1a\u5f88\u6162\uff0c\u751a\u81f3\u6709\u65f6\u56e0\u7f51\u7edc\u95ee\u9898\u4f1a\u65e0\u6cd5\u5b89\u88c5\u3002<\/p>\n<blockquote><p>\u56fd\u5185\u63a8\u8350\u4f7f\u7528<a href=\\\"https:\/\/link.jianshu.com?t=https:\/\/mirror.tuna.tsinghua.edu.cn\/help\/gitlab-ce\/\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">\u6e05\u534e\u5927\u5b66\u5f00\u6e90\u8f6f\u4ef6\u955c\u50cf\u6e90<\/a>\u3002<\/p><\/blockquote>\n<p>\u65b0\u5efa \/etc\/yum.repos.d\/gitlab-ce.repo\uff0c\u5185\u5bb9\u4e3a\uff1a<\/p>\n<div>\n<pre>[gitlab-ce]\nname=Gitlab CE Repository\nbaseurl=https:\/\/mirrors.tuna.tsinghua.edu.cn\/gitlab-ce\/yum\/el$releasever\/\ngpgcheck=0\nenabled=1\n<\/pre>\n<\/div>\n<p>\u518d\u6267\u884c<\/p>\n<div>\n<pre># yum makecache   # \u66f4\u65b0\u672c\u5730YUM\u7f13\u5b58\n# yum install gitlab-ce    # \u81ea\u52a8\u5b89\u88c5\u6700\u65b0\u7248\u672c\n<\/pre>\n<\/div>\n<h3>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\/etc\/gitlab\/gitlab.rb\uff0c\u7ed1\u5b9a\u57df\u540d<\/h3>\n<div>\n<pre>external_url \\'http:\/\/gitlab.xxx.com\\'\n<\/pre>\n<\/div>\n<h3>\u542f\u52a8GitLab\uff0c\u4f7f\u5f97\u914d\u7f6e\u751f\u6548<\/h3>\n<div>\n<pre># gitlab-ctl reconfigure\n<\/pre>\n<\/div>\n<h3>\u5728Dnspod\u4e2d\u6dfb\u52a0\u89e3\u6790\u8bb0\u5f55<\/h3>\n<h3>\u4f7f\u7528\u6d4f\u89c8\u5668\u8bbf\u95eeGitLab<\/h3>\n<blockquote><p>\u9996\u6b21\u8bbf\u95eeGitLab,\u7cfb\u7edf\u4f1a\u8ba9\u4f60\u91cd\u65b0\u8bbe\u7f6e\u7ba1\u7406\u5458\u7684\u5bc6\u7801,\u8bbe\u7f6e\u6210\u529f\u540e\u4f1a\u8fd4\u56de\u767b\u5f55\u754c\u9762.<br \/>\n\u9ed8\u8ba4\u7684\u7ba1\u7406\u5458\u8d26\u53f7\u662froot,\u5982\u679c\u4f60\u60f3\u66f4\u6539\u9ed8\u8ba4\u7ba1\u7406\u5458\u8d26\u53f7,\u8bf7\u8f93\u5165\u4e0a\u9762\u8bbe\u7f6e\u7684\u65b0\u5bc6\u7801\u767b\u5f55\u7cfb\u7edf\u540e\u4fee\u6539\u5e10\u53f7\u540d.<\/p><\/blockquote>\n<h3>GitLab\u5b89\u88c5\u7ec6\u8282<\/h3>\n<div>\n<pre>\u4e3b\u914d\u7f6e\u6587\u4ef6: \/etc\/gitlab\/gitlab.rb\nGitLab \u6587\u6863\u6839\u76ee\u5f55: \/opt\/gitlab\n\u9ed8\u8ba4\u5b58\u50a8\u5e93\u4f4d\u7f6e: \/var\/opt\/gitlab\/git-data\/repositories\nGitLab Nginx \u914d\u7f6e\u6587\u4ef6\u8def\u5f84:  \/var\/opt\/gitlab\/nginx\/conf\/gitlab-http.conf\nPostgresql \u6570\u636e\u76ee\u5f55: \/var\/opt\/gitlab\/postgresql\/data\n<\/pre>\n<\/div>\n<h3>GitLab\u7531\u4ee5\u4e0b\u670d\u52a1\u6784\u6210<\/h3>\n<ul>\n<li>nginx: \u9759\u6001web\u670d\u52a1\u5668<\/li>\n<li>gitlab-shell: \u7528\u4e8e\u5904\u7406Git\u547d\u4ee4\u548c\u4fee\u6539authorized keys\u5217\u8868<\/li>\n<li>gitlab-workhorse: \u8f7b\u91cf\u7ea7\u7684\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668<\/li>\n<li>logrotate\uff1a\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406\u5de5\u5177<\/li>\n<li>postgresql\uff1a\u6570\u636e\u5e93<\/li>\n<li>redis\uff1a\u7f13\u5b58\u6570\u636e\u5e93<\/li>\n<li>sidekiq\uff1a\u7528\u4e8e\u5728\u540e\u53f0\u6267\u884c\u961f\u5217\u4efb\u52a1\uff08\u5f02\u6b65\u6267\u884c\uff09<\/li>\n<li>unicorn\uff1aAn HTTP server for Rack applications\uff0cGitLab Rails\u5e94\u7528\u662f\u6258\u7ba1\u5728\u8fd9\u4e2a\u670d\u52a1\u5668\u4e0a\u9762\u7684\u3002<\/li>\n<\/ul>\n<h2>2\u3001\u914d\u7f6eSMTP\u670d\u52a1<\/h2>\n<p>\u5982\u679c\u4f60\u4e0d\u60f3\u7528\u670d\u52a1\u5668\u81ea\u5e26\u7684postfix\u670d\u52a1\u6765\u53d1\u90ae\u4ef6\uff0c\u53ef\u4ee5\u6539\u7528SMTP\u670d\u52a1\u3002<br \/>\n\u4fee\u6539GitLab\u90ae\u4ef6\u670d\u52a1\u914d\u7f6e(gitlab.rb\u6587\u4ef6)\uff0c\u4f7f\u7528\u817e\u8baf\u4f01\u4e1a\u90ae\u7bb1\u7684SMTP\u670d\u52a1\u5668\uff0c\u586b\u5199\u8d26\u53f7\u548c\u5bc6\u7801<\/p>\n<div>\n<pre>gitlab_rails[\\'smtp_address\\'] = \\\"smtp.exmail.qq.com\\\"\ngitlab_rails[\\'smtp_port\\'] = 25\ngitlab_rails[\\'smtp_user_name\\'] = \\\"xxx\\\"\ngitlab_rails[\\'smtp_password\\'] = \\\"xxx\\\"\ngitlab_rails[\\'smtp_domain\\'] = \\\"smtp.qq.com\\\"\ngitlab_rails[\\'smtp_authentication\\'] = \\'plain\\'\ngitlab_rails[\\'smtp_enable_starttls_auto\\'] = true\n<\/pre>\n<\/div>\n<p>\u4f7f\u914d\u7f6e\u751f\u6548<\/p>\n<div>\n<pre># gitlab-ctl reconfigure\n# gitlab-rake cache:clear RAILS_ENV=production      # \u6e05\u9664\u7f13\u5b58\n<\/pre>\n<\/div>\n<h2>3\u3001GitLab\u914d\u7f6eHTTPS<\/h2>\n<p>GitLab\u9ed8\u8ba4\u662f\u4f7f\u7528HTTP\u7684\uff0c\u53ef\u4ee5\u624b\u52a8\u914d\u7f6e\u4e3aHTTPS<\/p>\n<h3>\u4e0a\u4f20SSL\u8bc1\u4e66<\/h3>\n<p>\u521b\u5efassl\u76ee\u5f55\uff0c\u7528\u4e8e\u5b58\u653eSSL\u8bc1\u4e66<\/p>\n<div>\n<pre># mkdir -p \/etc\/gitlab\/ssl\n# chmod 0700 \/etc\/gitlab\/ssl\n<\/pre>\n<\/div>\n<p>\u4e0a\u4f20\u8bc1\u4e66\u5e76\u4fee\u6539\u8bc1\u4e66\u6743\u9650<\/p>\n<div>\n<pre># chmod 600 \/etc\/gitlab\/ssl\/*\n<\/pre>\n<\/div>\n<h3>\u4fee\u6539GitLab\u7684\u914d\u7f6e\u6587\u4ef6<\/h3>\n<p>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\/etc\/gitlab\/gitlab.rb<\/p>\n<div>\n<pre>external_url \\\"https:\/\/gitlab.xxx.com\\\"\nnginx[\\'redirect_http_to_https\\'] = true\nnginx[\\'ssl_certificate\\'] = \\\"\/etc\/gitlab\/ssl\/gitlab.xxx.com.crt\\\"\nnginx[\\'ssl_certificate_key\\'] = \\\"\/etc\/gitlab\/ssl\/gitlab.xxx.com.key\\\"\n<\/pre>\n<\/div>\n<p>\u91cd\u5efa\u914d\u7f6e\uff0c\u4f7f\u5176\u751f\u6548<\/p>\n<div>\n<pre># gitlab-ctl reconfigure\n<\/pre>\n<\/div>\n<p>\u4ee5\u4e0a\u64cd\u4f5c\u540e\uff0cGitLab\u81ea\u5e26\u7684Nginx\u670d\u52a1\u7684\u914d\u7f6e\u6587\u4ef6 \/var\/opt\/gitlab\/nginx\/conf\/gitlab-http.conf \u4f1a\u88ab\u91cd\u65b0\u4fee\u6539\uff1a<\/p>\n<div>\n<pre>server {\n  listen *:80;\n  server_name gitlab.xxx.com;\n  server_tokens off; ## Don\\'t show the nginx version number, a security best practice\n  return 301 https:\/\/gitlab.xxx.com:443$request_uri;\n  access_log  \/var\/log\/gitlab\/nginx\/gitlab_access.log gitlab_access;\n  error_log   \/var\/log\/gitlab\/nginx\/gitlab_error.log;\n}\n<\/pre>\n<\/div>\n<p>\u4e0d\u7528\u989d\u5916\u518d\u914d\u7f6e\uff0cHTTP \u4f1a\u81ea\u52a8\u8df3\u8f6c\u5230 HTTPS \u3002<\/p>\n<h3>\u5f00\u653e443\u7aef\u53e3<\/h3>\n<p>\u5728\u9632\u706b\u5899\u4e0a\u5f00\u653e443\u7aef\u53e3\uff0c\u7528\u4e8eHTTPS<\/p>\n<div>\n<pre># iptables -I INPUT -m tcp -p tcp --dport 443 -j ACCEPT\n<\/pre>\n<\/div>\n<h2>4\u3001\u4fee\u6539root\u7528\u6237\u5bc6\u7801<\/h2>\n<p>\u5bf9\u4e8e\u666e\u901a\u7528\u6237\u800c\u8a00\uff0c\u53ef\u901a\u8fc7\u7cfb\u7edf\u91cd\u7f6e\u5bc6\u7801\uff0c\u63a5\u6536\u90ae\u4ef6\u5373\u53ef\u3002\u53ef\u662fGitLab\u7ba1\u7406\u5458\u8d26\u53f7\uff0c\u7f3a\u7701\u90ae\u7bb1 admin@example.com \u662f\u4e2a\u4e0d\u5b58\u5728\u7684\u90ae\u7bb1\u5730\u5740\uff0c\u65e0\u6cd5\u901a\u8fc7\u90ae\u7bb1\u4fee\u6539\u5bc6\u7801\u3002<br \/>\n<a href=\\\"https:\/\/link.jianshu.com?t=http:\/\/docs.gitlab.com\/ce\/security\/reset_root_password.html\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">\u5b98\u65b9\u4fee\u6539\u5bc6\u7801\u6587\u6863<\/a>\uff0c\u6839\u636e\u6587\u6863\uff0c\u4fee\u6539root\u5bc6\u7801\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<h3>\u6253\u5f00\u4e0eRails\u7a0b\u5e8f\u4ea4\u4e92\u7684\u63a7\u5236\u53f0<\/h3>\n<p>\u5728root\u6743\u9650\u4e0b\uff0c\u6267\u884c\uff1a<\/p>\n<div>\n<pre># gitlab-rails console production\n<\/pre>\n<\/div>\n<p>\u7b49\u5f85\u4e00\u4f1a\uff0c\u76f4\u5230\u63a7\u5236\u53f0\u52a0\u8f7d\u6210\u529f\u3002<\/p>\n<h3>\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5e76\u4fee\u6539root\u7528\u6237\u5bc6\u7801<\/h3>\n<div>\n<pre># gitlab-rails console production\nLoading production environment (Rails 4.2.8)\nirb(main):001:0&gt; user = User.where(id: 1).first\n=&gt; #&lt;User id: 1, email: \\\"admin@example.com\\\"......\nirb(main):009:0&gt; user.password = \\'12345678\\'\n=&gt; \\\"12345678\\\"\nirb(main):010:0&gt; user.password_confirmation = \\'12345678\\'\n=&gt; \\\"12345678\\\"\nirb(main):011:0&gt; user.save!\nEnqueued ActionMailer::DeliveryJob (Job ID: 510bb5be-a156-4522-9983-44d8a895e92a) to Sidekiq(mailers) with arguments: \\\"DeviseMailer\\\", \\\"password_change\\\", \\\"deliver_now\\\", gid:\/\/gitlab\/User\/1\n=&gt; true\nirb(main):011:0&gt; exit\n<\/pre>\n<\/div>\n<h1>\u4e09\u3001GitLab \u5e38\u7528\u547d\u4ee4<\/h1>\n<h2>\u8fd0\u7ef4\u7ba1\u7406\u6392\u67e5<\/h2>\n<div>\n<pre># \u67e5\u770b\u7248\u672c\ncat \/opt\/gitlab\/embedded\/service\/gitlab-rails\/VERSION\n# \u68c0\u67e5gitlab\ngitlab-rake gitlab:check SANITIZE=true --trace\n# \u5b9e\u65f6\u67e5\u770b\u65e5\u5fd7\ngitlab-ctl tail\n# \u6570\u636e\u5e93\u5173\u7cfb\u5347\u7ea7\ngitlab-rake db:migrate\n# \u6e05\u7406redis\u7f13\u5b58\ngitlab-rake cache:clear\n# \u5347\u7ea7GitLab-ce \u7248\u672c\nyum update gitlab-ce\n# \u5347\u7ea7PostgreSQL\u6700\u65b0\u7248\u672c\ngitlab-ctl pg-upgrade\n<\/pre>\n<\/div>\n<h2>\u670d\u52a1\u7ba1\u7406<\/h2>\n<div>\n<pre># \u542f\u52a8\u6240\u6709 gitlab \u7ec4\u4ef6\uff1a\ngitlab-ctl start\n# \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\ngitlab-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\n<\/pre>\n<\/div>\n<h2>\u65e5\u5fd7<\/h2>\n<div>\n<pre># \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<\/pre>\n<\/div>\n<h1>\u56db\u3001GitLab\u5907\u4efd\u548c\u6062\u590d<\/h1>\n<h2>\u5907\u4efd<\/h2>\n<p>GitLab\u4f5c\u4e3a\u516c\u53f8\u9879\u76ee\u4ee3\u7801\u7684\u7248\u672c\u7ba1\u7406\u7cfb\u7edf\uff0c\u6570\u636e\u975e\u5e38\u91cd\u8981\uff0c\u5fc5\u987b\u505a\u597d\u5907\u4efd\u3002<\/p>\n<h3>\u4fee\u6539\u5907\u4efd\u76ee\u5f55<\/h3>\n<p>GitLab\u5907\u4efd\u7684\u9ed8\u8ba4\u76ee\u5f55\u662f \/var\/opt\/gitlab\/backups \uff0c\u5982\u679c\u60f3\u6539\u5907\u4efd\u76ee\u5f55\uff0c\u53ef\u4fee\u6539\/etc\/gitlab\/gitlab.rb\uff1a<\/p>\n<div>\n<pre>gitlab_rails[\\'backup_path\\'] = \\'\/data\/backups\\'\n<\/pre>\n<\/div>\n<p>\u4fee\u6539\u914d\u7f6e\u540e\uff0c\u8bb0\u5f97\uff1a<\/p>\n<div>\n<pre>gitlab-ctl reconfigure\n<\/pre>\n<\/div>\n<h3>\u5907\u4efd\u547d\u4ee4<\/h3>\n<div>\n<pre>gitlab-rake gitlab:backup:create\n<\/pre>\n<\/div>\n<p>\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<h3>\u81ea\u52a8\u5907\u4efd<\/h3>\n<p>\u901a\u8fc7\u4efb\u52a1\u8ba1\u5212crontab \u5b9e\u73b0\u81ea\u52a8\u5907\u4efd<\/p>\n<div>\n<pre># \u6bcf\u59292\u70b9\u5907\u4efdgitlab\u6570\u636e\n0 2 * * * \/usr\/bin\/gitlab-rake gitlab:backup:create\n<\/pre>\n<\/div>\n<h3>\u5907\u4efd\u4fdd\u75597\u5929<\/h3>\n<p>\u53ef\u8bbe\u7f6e\u53ea\u4fdd\u7559\u6700\u8fd17\u5929\u7684\u5907\u4efd\uff0c\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6 \/etc\/gitlab\/gitlab.rb<\/p>\n<div>\n<pre># \u6570\u503c\u5355\u4f4d\uff1a\u79d2\ngitlab_rails[\\'backup_keep_time\\'] = 604800\n<\/pre>\n<\/div>\n<p>\u91cd\u65b0\u52a0\u8f7dgitlab\u914d\u7f6e\u6587\u4ef6<\/p>\n<div>\n<pre>gitlab-ctl reconfigure\n<\/pre>\n<\/div>\n<h2>\u6062\u590d<\/h2>\n<p>\u5907\u4efd\u6587\u4ef6\uff1a<\/p>\n<div>\n<pre>\/var\/opt\/gitlab\/backups\/1499244722_2017_07_05_9.2.6_gitlab_backup.tar\n<\/pre>\n<\/div>\n<p>\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<div>\n<pre># \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\u786e\u4fdd\u5907\u4efd\u76ee\u5f55\u4e2d\u6709\u8fd9\u4e2a\u6587\u4ef6\u3002\n# \u6307\u5b9a\u6587\u4ef6\u540d\u7684\u683c\u5f0f\u7c7b\u4f3c\uff1a1499242399_2017_07_05_9.2.6\uff0c\u7a0b\u5e8f\u4f1a\u81ea\u52a8\u5728\u6587\u4ef6\u540d\u540e\u8865\u4e0a\uff1a\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=1499242399_2017_07_05_9.2.6\n# \u542f\u52a8Gitlab\ngitlab-ctl start<\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u524d\u5e02\u9762\u4e0a\u6bd4\u8f83\u6709\u540d\u7684Git\u670d\u52a1\u63d0\u4f9b\u5546\uff0c\u56fd\u5916\u6709GitHub\u3001BitBucket\u3001GitLab\uff0c\u56fd\u5185\u6709Coding &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=1745\"> <span class=\"screen-reader-text\">GitLab\u642d\u5efa\u53ca\u914d\u7f6e<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"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":[132,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":2,"uagb_excerpt":"\u76ee\u524d\u5e02\u9762\u4e0a\u6bd4\u8f83\u6709\u540d\u7684Git\u670d\u52a1\u63d0\u4f9b\u5546\uff0c\u56fd\u5916\u6709GitHub\u3001BitBucket\u3001GitLab\uff0c\u56fd\u5185\u6709Coding&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1745"}],"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=1745"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1745\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1745"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}