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

eduncan911 picture eduncan911 · Oct 18, 2013 · Viewed 131.9k times · Source

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 letter:

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

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

Apparently our URL is very long and we've come up with a new URL. I've edited a number of configuration files and the "Application Status Checks" report everything is OK. I've rebooted the server to ensure things are still working.

I can access Nginx just fine, over our original SSL. I can browse the GitLab site, create a repository, etc. I can fork and commit just fine.

It all seems to be OK; but, since this is not a native environment for me, I wanted to double check that I have done everything to rename a GitLab site.

The files I've edited are:

/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

Answer

Jonathon Reinhart picture Jonathon Reinhart · Jan 17, 2015

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`.