- Create a backup of the source gitlab server with
gitlab-rake gitlab:backup:create
- Create a seperate MySQL dump of the source database using
mysqldump [...] <gitlab-database-name> > database.sql
- Create a new directory to store the mysql-dump and the docker-compose-mysql.yml; database.sql belongs into the subfolder 'mysql' (as it is set in the docker-compose.yml) ./ ./mysql/database.sql ./docker-compose-mysql.yml
- Optional: edit docker-compose-mysql.yml to use the correct database images, mysql should be the same as your source mysql (or mariadb) version, postgres should match the version used in your gitlab-docker-image
- Start the two containers using
docker-compose -f docker-compose-mysql.yml up --build -d
- Start the gitlab container using docker-compose, adding the database related configration from docker-compose-gitlab.yml to your own configuration
- Link the two containers using
docker network connect <name-of-gitlab-network> <name-of-pgsql-server>
- Set the corret IP address for the pgsql server in the docker-compose.yml of the gitlab container and rebuilt it
- Wait a few seconds/minutes until the database migrations from the gitlab container are done
- Download or install 'pgloader' and basically follow the 'official' migration guide from here
- Be sure to use the correct IP addresses for the two database containers, use the addresses that are in the same network
- Your Database should now be copied to the postgres server
docker-compose exec gitlab bash
and create a new backup usinggitlab-rake gitlab:backup:create
- Untar the
db/database.sql.gz
from the newly created backup - Untar the backup from the old installation into a clean directory
- Replace the
db/databse.sql.gz
from the old backup with the one from the new backup tar
this updated directory up and copy the resulting file to the backup folder of the gitlab container, make sure that it is called _gitlab_backup.tar- Stop the gitlab container and the databse containers (you should not need them anymore)
- Edit the docker-compose-gitlab.yml and remove the postgres configuration you added previously
- Start the gitlab container, wait again until the configuration is done and the internal postgres server is prepared for gitlab
docker-compose exec gitlab bash
again and now usegitlab-rake gitlab:backup:restore BACKUP=<name-of-your-updated-backup-minus_gitlab_backup.tar>
- Follow the instructions and wait for the script to finish
- You should now have all your data back again