From version to version, GitLab (like all software) needs to change the way its database looks. This means that if you’re planning on upgrading, some pre-work needs to be done to maintain your data, while keeping the application working. What I show here is how to upgrade your sameersbn/gitlab image.

Extract your variables

Go to your docker application on the synology, and select your currently operating GitLab container. Then select Settings, and choose ‘export’. Export only the settings, and download it to your local computer. The only variables I needed were:

  • GITLAB_SECRETS_DB_KEY_BASE

  • GITLAB_SECRETS_SECRET_KEY_BASE

  • GITLAB_SECRETS_OTP_KEY_BASE

You may need more, depending on how you access your GitLab instances connects to a database. Obtain the values from the .json file you downloaded.

Create the command

The template command is: docker run -it --rm --name=gitlab-migrate \ --link gitlab-postgresql:postgresql --link sameersbn-redis1:redisio \ -e 'GITLAB_SECRETS_DB_KEY_BASE=<change me>' \ -e 'GITLAB_SECRETS_SECRET_KEY_BASE=<change me>' \ -e 'GITLAB_SECRETS_OTP_KEY_BASE=<change me>' \ -v /volume1/docker/gitlab:/home/git/data \ sameersbn/gitlab:9.3.5 app:rake db:migrate

Add your values where appears, from the step above.

What this does is creates a new container called gitlab-migrate, with the usual startup parameters. Please make sure that the image names gitlab-postgresql and sameesbn-redis1 are correct for you. Also ensure that the version you are upgrade to is seen on the last line, sameersbn/gitlab:9.3.5.

Run this command. It may take a few minutes, and should output a lot of changes made to your database. You should now be able to run your new version of GitLab using reference to the old database, and have access to all of your old data!