gitlab 升级到5.0的严重注意事项

我这里只讨论从4.2到5.0升级过程,并且用的是Nginx和启用HTTPS配置。

第一,升级时开始运行的帐号和目录

sudo -s 进入root权限下

然后要cd /home/gitlab/gitlab下运行升级的脚本。


第二,使用正确的版本的gitlab-shell

参考升级文档https://github.com/gitlabhq/gitlabhq/wiki/From-4.2-to-5.0

注意其中第二步,git clone gitlab-shell之后要立刻让gitlab-shell切换到v1.1.0 tag.

先查看一下有几个tag

root@ubuntu1204-dell:/home/git/gitlab-shell# git tag
v1.0.3
v1.1.0
v1.2.0


然后查找v1.1.0的commit id

git log --oneline --decorate
e8d93d0 (HEAD, tag: v1.1.0, master) up to 1.1.0

然后用reset命令切到这个tag

git reset --hard e8d93d0

第三步,修改gitlab-shell中的配置文件

# Url to gitlab instance. Used for api calls                                                                                                  
gitlab_url: "https://your_git_server/"


这里要用https, 注意最后/结尾

第四步,让gitlab-shell访问本地gitlab server的REST API时禁止启用SSL证书

参考这个帖子:https://github.com/gitlabhq/gitlabhq/issues/3292

so i had to add string not to check certificate at /home/git/gitlab-shell/lib/gitlab_net.rb
from:

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = (url.port == 443)
request = Net::HTTP::Get.new(url.request_uri)
http.start {|http| http.request(request) }
to:
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = (url.port == 443)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl?
request = Net::HTTP::Get.new(url.request_uri)
http.start {|http| http.request(request) }


我这里不交代如何在Nginx中设置SSL证书。


第五步,Nginx中的gitlab配置, 也许对大家有用,仅供参考:

File Edit Options Buffers Tools Help                                                                                                          
# GITLAB
# Maintainer: @randx
# App Version: 4.0

upstream gitlab {
  server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}

server {
  listen *:443;         # e.g., listen 192.168.1.1:80;
  ssl                  on;
  ssl_certificate      /etc/nginx/sites-available/server.crt;
  ssl_certificate_key  /etc/nginx/sites-available/server.key;

  server_name localhost;
  #ubuntu1204-dell source.myserver.com;     # e.g., server_name source.example.com;
  root /home/git/gitlab/public;



  # individual nginx logs for this gitlab vhost
  access_log  /var/log/nginx/gitlab_access.log;
  error_log   /var/log/nginx/gitlab_error.log;

  location / {
    # serve static files from defined root folder;.
    # @gitlab is a named location for the upstream fallback, see below
    try_files $uri $uri/index.html $uri.html @gitlab;
  }

  # if a file, which is not found in the root folder is requested,
  # then the proxy pass the request to the upsteam (gitlab unicorn)
  location @gitlab {
    proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
    proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
    proxy_redirect     off;

    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   Host              $http_host;
    proxy_set_header   X-Real-IP         $remote_addr;

    proxy_pass http://gitlab;
  }
}


这样才能让

sudo -u git -H /home/git/gitlab-shell/bin/check

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
检查全部通过。

并且才能解决客户端git clone 不能访问的问题。





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值