This paper mainly talks about a relatively fast way for GitLab to switch to docker version and upgrade the larger version (9.x-10.x)

Gitlab backup

Viewing the existing version

sudo gitlab-rake gitlab:env:info ... GitLab Information Version: 9.2.5...Copy the code

The backup

Running on the original server

sudo gitlab-rake gitlab:backup:create RAILS_ENV=production

sudo sh -c 'umask 0077; tar -cf /var/opt/gitlab/backups/$(date "+etc-gitlab-%s_%Y_%m_%d.tar") -C /etc/gitlab'Copy the code

Via sudo ls – lah/var/opt/gitlab/backups | grep $(date “m_ Y_ + % % % d)” view

-rw------- 1 git git 172M November 7 11:07 1510024070_2017_11_07_x.xx_gitlab_backup. tar -rw------- 1 root root 150K November 7 11:28 etc-gitlab-1510025309_2017_11_07.tarCopy the code

Move to the target server

Copy the backup file to the target host using SCP

Username is the username and IP is the IP address of the source host

Log in to the target host,

sudo mkdir -p /data/gitlab/data/backups

scp username@ip:/var/opt/gitlab/backups/1510024070_2017_11_07_x.x.x_gitlab_backup.tar /data/gitlab/data/backups/1510024070_gitlab_backup.tar
scp username@ip:/var/opt/gitlab/backups/etc-gitlab-1510025309_2017_11_07.tar /data/gitlab/data/backups/

If you do not have permission for SSH, change the configuration, or use winscp, FTP, etcCopy the code

Gitlab recovery

docker-compose

version: '2'
services:
    gitlab:
      image: 'gitlab/gitlab-ce:x.x.x-ce.0' [gitlab] [gitlab] [gitlab] [gitlab
      restart: unless-stopped
      ports:
        - '80:80'
        - '443:443'
        - 'and'
      volumes:
        - config:/etc/gitlab
        - data:/var/opt/gitlab
        - logs:/var/log/gitlab
volumes:
    config:/data/gitlab/config
    data:/data/gitlab/data
    logs:/data/gitlab/logCopy the code

docker-compose up -d

Restore data

docker exec -it gitlab_gitlab_1 /bin/bash

gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1510024070 # 1510024070_gitlab_backup.tar
tar -xf /var/opt/gitlab/backups/etc-gitlab-1510025309_2017_11_07.tar -C /Copy the code

‘docker-compose Down’ is executed if the following http://ip/ is normal

Gitlab upgrade and Localization

version: '2'
services:
    gitlab:
      image: 'anjia0532 / gitlab - ce - useful: 10.1.1 - ce. 0' Chinese version 10.1.1
      restart: unless-stopped
      ports:
        - '80:80'
        - '443:443'
        - 'and'
      volumes:
        - config:/etc/gitlab
        - data:/var/opt/gitlab
        - logs:/var/log/gitlab
volumes:
    config:/data/gitlab/config
    data:/data/gitlab/data
    logs:/data/gitlab/logCopy the code

Reference connection:

  • Gitlab server migration — Ghosts in the Mountains
  • Upgrade/migrate to Gitlab CE 9.3.4 — Baowei
  • Backups — gitlab-ce-doc

Blog anjia. Ml / 2017/11/07 /… The nuggets juejin. Cn/post / 684490… Jane books www.jianshu.com/p/3ac4bd837…