How do we change the URL of a working GitLab install?

前端 未结 4 2055
时光说笑
时光说笑 2020-11-30 17:41

I have set up and we are running a default install of GitLab v6.0.1 (we\'re about to upgrade as well). It was a \"Production\" setup, following this guide precisely to the l

相关标签:
4条回答
  • 2020-11-30 18:09

    There are detailed notes on this that helped me completely, located here.

    Jonathon Reinhart has already answered with the key bit, to edit /etc/gitlab/gitlab.rb, alter the external_url and then run sudo gitlab-ctl reconfigure; sudo gitlab-ctl restart

    However I needed to go a bit further and docs I linked above explained it. So what I ended up with looks like:

    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"
    }
    

    Above, I've explicitly declared where my SSL goodies are on this server. And that's of course followed by

    sudo gitlab-ctl reconfigure
    sudo gitlab-ctl restart
    

    Also, when you switch the omnibus package to https, the bundled nginx will only serve on port 443. Since all my stuff is reached via reverse proxy, this part was potentially significant.

    As I went through this, I screwed something up and it helpful to find the actual nginx logs, this lead me there:

    sudo gitlab-ctl tail nginx
    
    0 讨论(0)
  • 2020-11-30 18:20

    You did everything correctly!

    You might also change the email configuration, depending on if the email server is also the same server. The email configuration is in gitlab.yml for the mails sent by GitLab and also the admin-email.

    0 讨论(0)
  • 2020-11-30 18:26

    GitLab Omnibus

    For an Omnibus install, it is a little different.

    The correct place in an Omnibus install is:

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

    Finally, you'll need to execute sudo gitlab-ctl reconfigure and sudo gitlab-ctl restart so the changes apply.


    I was making changes in the wrong places and they were getting blown away.

    The incorrect paths are:

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

    Pay attention to those warnings that read:

    # 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`.
    
    0 讨论(0)
  • 2020-11-30 18:29

    Actually, this is NOT totally correct. I arrived at this page, trying to answer this question myself, as we are transitioning production GitLab server from http:// to https:// and most stuff is working as described above, but when you login to https://server and everything looks fine ... except when you browse to a project or repository, and it displays the SSH and HTTP instructions... It says "http" and the instructions it displays also say "http".

    I found some more things to edit though:

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

    and

    /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;
    
    ...
    
    0 讨论(0)
提交回复
热议问题