首页 文章

我们如何更改工作GitLab安装的URL?

提问于
浏览
76

我已经设置好了,我们正在运行GitLab v6.0.1的默认安装(我们即将升级) . 这是一个“ 生产环境 ”设置,遵循本指南正好写到这封信:

https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md

Now, how do we safely change the URL of a working install?

显然我们的网址很长,我们想出了一个新网址 . 我编辑了许多配置文件,“应用程序状态检查”报告一切正常 . 我重新启动了服务器,以确保一切正常 .

我可以通过原始SSL访问Nginx . 我可以浏览GitLab站点,创建一个存储库等 . 我可以分叉并提交就好了 .

一切似乎都没问题;但是,由于这不是我的原生环境,我想仔细检查我是否已经完成了重命名GitLab网站的所有工作 .

我编辑的文件是:

/etc/hosts
  127.0.0.1  localhost
  10.0.0.10  wake.domain.com    wake
  10.0.0.10  git.domain.com     git

/home/git/gitlab/config/gitlab.yml
  production: &base
    gitlab:
      host: git.domain.com

/home/git/gitlab-shell/config.yml
  gitlab_url: "https://git.domain.com"
  ^- yes, we are on SSL and that is working, even on a new URL

/etc/nginx/sites-available/gitlab
  server {
    server_name git.domain.com

4 回答

  • 139

    你做的一切都正确!

    您还可以更改电子邮件配置,具体取决于电子邮件服务器是否也是同一服务器 . 电子邮件配置在gitlab.yml中,用于GitLab发送的邮件以及admin-email .

  • 1

    GitLab Omnibus

    对于Omnibus安装,它有点不同 .

    Omnibus安装中的 correct 位置是:

    /etc/gitlab/gitlab.rb
        external_url 'http://gitlab.example.com'
    

    最后,您需要执行 sudo gitlab-ctl reconfiguresudo gitlab-ctl restart 以便更改适用 .


    我在错误的地方做了改变,他们被吹走了 .

    incorrect 路径是:

    /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
    /var/opt/gitlab/.gitconfig
    /var/opt/gitlab/nginx/conf/gitlab-http.conf
    

    注意那些警告:

    # This file is managed by gitlab-ctl. Manual changes will be
    # erased! To change the contents below, edit /etc/gitlab/gitlab.rb
    # and run `sudo gitlab-ctl reconfigure`.
    
  • 25

    实际上,这并不完全正确 . 我到达了这个页面,尝试自己回答这个问题,因为我们正在将 生产环境 GitLab服务器从 http:// 过渡到 https:// 并且大部分内容正如上所述,但是当你登录 https://server 并且一切看起来都很好......除非你浏览到项目或存储库,它显示SSH和HTTP指令...它说"http",它显示的说明也说"http" .

    我发现了一些可以编辑的东西:

    /home/git/gitlab/config/gitlab.yml
      production: &base
        gitlab:
          host: git.domain.com
    
          # Also edit these:
          port: 443
          https: true
    ...
    

    /etc/nginx/sites-available/gitlab
      server {
        server_name git.domain.com;
    
        # Also edit these:
        listen 443 ssl;
        ssl_certificate     /etc/ssl/certs/somecert.crt;
        ssl_certificate_key /etc/ssl/private/somekey.key;
    
    ...
    
  • 7

    有关于此的详细说明完全帮助了我,located here .

    Jonathon Reinhart已经回答了关键位,编辑/etc/gitlab/gitlab.rb,改变external_url,然后运行 sudo gitlab-ctl reconfigure; sudo gitlab-ctl restart

    但是我需要更进一步,上面链接的文档解释了它 . 所以我最终得到的结果如下:

    external_url 'https://gitlab.toilethumor.com'
    nginx['ssl_certificate'] = "/www/ssl/star_toilethumor.com-chained.crt"
    nginx['ssl_certificate_key'] = "/www/ssl/star_toilethumor.com.key"
    nginx['proxy_set_headers'] = {
     "X-Forwarded-Proto" => "http",
     "CUSTOM_HEADER" => "VALUE"
    }
    

    上面,我已明确声明我的SSL好东西在这台服务器上 . 当然,接下来是

    sudo gitlab-ctl reconfigure
    sudo gitlab-ctl restart
    

    此外,当您将omnibus软件包切换为https时,捆绑的nginx将仅在端口443上提供服务 . 由于我的所有内容都通过反向代理到达,因此这部分可能很重要 .

    当我经历这个时,我搞砸了一些东西,它有助于找到实际的nginx日志,这引导我:

    sudo gitlab-ctl tail nginx
    

相关问题