How to update runner url to new server

Hello team,

We are trying to migrate our production environment to new server. Currently our production Gitlab has around 167 pipeline jobs. Also we have dedicated server for runner. That will be used to pick up the jobs in production.

We need to change the url from old production to new one in runner configuration. I have tried to replace the new url in config.toml. But runners are not picking jobs in new server.

FYI, both production and new server having same data. Since we have taken entire backup gitlab instance and restored to new server.

Could someone please help here


Re-register the runner instead of attempting to hack the config files and attach it to the new server.

The easier alternative would have restored the new server with the same URL as the original server and then turn off the old server, since if this changes, then you really need to register the runner again as if it was new. I don’t know any quick hack fixes for that.

1 Like

Thanks for the response iwalker.

So as per your comments. There are two ways to done this.

  1. First way is to register the new runners for all the projects, groups which have cicd config from the scratch for the new server.

  2. Second way is to migrate to the new server with the same gitlab external url (old prod url). So that jobs can be picked up. But will that cause any issue.

Also I would like to have one more query regarding gitlab_rails [db_keybase], secretkeybase, OTP keybase. Because when I take the backup of our production instance and restored to new test server. The projects and group with cicd gives 500 error when I opened settings → CICD. Since I didn’t use the production gitlab-secrets.json in the new server.

Thn I have copied the production gitlab-secrets.json into the test environment and reconfigured. Also I have set the values of all runner_token_encrytpted for CICD projects to null in the test database. Thn the error is resolved.

Is this the correct way to do it. Will these production gitlab-secrets.json will cause any issue in future for testing environment.


You should always use gitlab-secrets.json when restoring a server. Otherwise you have to reset everything and then you lose all your runners as well anyway. Procedure:

  1. Install same gitlab version on new server.
  2. Copy /etc/gitlab/gitlab.rb and /etc/gitlab/gitlab-secrets.json to /etc/gitlab on new server.
  3. Run gitlab-ctl reconfigure
  4. Restore from backup.
  5. Run reconfigure and restart.

That’s pretty much it in a summarised way. If you don’t restore the secrets file, then it’s problem time.

Yes I got it. But in our case we are creating test environment. Thn taking the production backup and restoring to new server. So production data will be available in test server. In gitlab.rb we have made the changes to use test database and test redis for new test server. So it’s isolated.

Our version is 10.8.7. We have installed the same version on test server and restored it. First it createdthe automatic gitlab-secrets.json file in test environment. Because of the issues I have faced as I explained in my previous post. I have followed to restore the production gitlab-secrets.json on test server.

So it will not cause any issue in testing environment right. I just need this confirmation. Could you please clarify this thing.

Thanks for your time sir

You should make sure gitlab-secrets.json is in the directory before you start the restore. If you did this before you restored the second time then it should be OK.

This depends. If the test environment uses different URL, then I don’t see it conflicting with anything. If you want to use existing URL like old server, then old server needs to be shut down, so that runners talk with new server and not old one. Otherwise if different URL than old one, then you need to create and connect new runners to test environment. Old runners will then still work on old server with old URL.

You should make sure gitlab-secrets.json is in the directory before you start the restore. If you did this before you restored the second time then it should be OK.

Okay so can I remove the current installation and everything in test server and setup once again and restore with secrets.json file. Will the projects and groups attached comes with runners or we will lose the runners anyway.

Also this command not working in gitlab 10.8.7 and 11.11.8 version.
gitlab-rake gitlab:doctor:secrets RAILS_ENV=production.

May be because of the older version. Any command available for this ?

No it won’t work, because it was introduced in Gitlab version 13.1 as per the docs here: Integrity check Rake task | GitLab