Skip to content

Instantly share code, notes, and snippets.

@alepez
Created July 25, 2018 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alepez/ac3a10cd70351e8cd4f06677d40cf533 to your computer and use it in GitHub Desktop.
Save alepez/ac3a10cd70351e8cd4f06677d40cf533 to your computer and use it in GitHub Desktop.
migrare gitlab docker

Nell'host di destinazione, avvio un nuovo container GitLab:

docker run --detach --hostname git.decktutor.net --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab  --restart always  --volume /srv/gitlab/config:/etc/gitlab  --volume /srv/gitlab/logs:/var/log/gitlab  --volume /srv/gitlab/data:/var/opt/gitlab  gitlab/gitlab-ce:10.8.4-ce.0

Copio gitlab.rb dalla sorgente alla destinazione /srv/gitlab/config/gitlab.rb

Nell'host di destinazione, riconfiguro gitlab con il nuovo gitlab.rb:

docker exec -ti gitlab gitlab-ctl reconfigure

Nell'host di sorgente, creo il backup.

sudo gitlab-rake gitlab:backup:create

Il backup viene creato in:

/var/opt/gitlab/backups/

Avrà un nome del tipo:

/var/opt/gitlab/backups/1532528621_2018_07_25_10.8.4_gitlab_backup.tar

Lo copio nell'host di destinazione nella cartella (non copiare tutto, ma solo il nuovo backup). Ho bisogno di permessi di root nella destinazione

sudo cat /var/opt/gitlab/backups/1532528621_2018_07_25_10.8.4_gitlab_backup.tar \
    | ssh destination "cat > /srv/gitlab/data/backups/1532528621_2018_07_25_10.8.4_gitlab_backup.tar"

Nell'host di destinazione, con container gitlab avviato:

docker exec -it gitlab gitlab-rake gitlab:backup:restore

GitLab trova automaticamente il backup e lo ripristina.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment