原服務器備份gitlab
gitlab-rake gitlab:backup:create RAILS_ENV=production
獲取鏡像
1. docker pull sameersbn/gitlab
2. docker pull sameersbn/gitlab:8.5.5
3. docker pull sameersbn/postgresql
4. docker pull sameersbn/redis
在docker上搭建gitlab
1. docker run --name=postgresql -d -e 'DB_NAME=gitlabhq_production' -e 'DB_USER=gitlab' -e 'DB_PASS=xxxxxxxxxx' -v /data/postgresql/data:/var/lib/postgresql sameersbn/postgresql
2. docker run --name=redis -d sameersbn/redis
3. docker run -i -t --hostname git.xiandanjia.com -p 443:443 -p 80:80 -p 22:22 --name gitlab -v /data/gitlab/data:/home/git/data -v /data/gitlab/log:/var/log/gitlab -v /data/gitlab/backups:/home/git/data/backups --link postgresql:postgresql --link redis:redisio -e "DB_USER=gitlab" -e "DB_PASS=xxxxxxxxxx" -e "DB_NAME=gitlabhq_production" -e 'GITLAB_SECRETS_DB_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_SECRETS_SECRET_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_SECRETS_OTP_KEY_BASE=xxxxxxxxxx' sameersbn/gitlab:8.5.5 app:rake gitlab:setup
遷移數(shù)據(jù)
1. mv 1514197324_gitlab_backup.tar /data/gitlab/backups/
2. docker run -it --hostname git.xiandanjia.com -p 443:443 -p 80:80 -p 22:22 --name gitlab --rm -v /data/gitlab/data:/home/git/data -v /data/gitlab/log:/var/log/gitlab -v /data/gitlab/backups:/home/git/data/backups --link postgresql:postgresql --link redis:redisio -e "DB_USER=gitlab" -e "DB_PASS=xxxxxxxxxx" -e "DB_NAME=gitlabhq_production" -e 'GITLAB_SECRETS_DB_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_SECRETS_SECRET_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_SECRETS_OTP_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_TIMEZONE=Beijing' sameersbn/gitlab:8.5.5 app:rake gitlab:backup:restore BACKUP=1514197324
3. docker run -it --hostname git.xiandanjia.com -p 443:443 -p 80:80 -p 22:22 --name gitlab -v /data/gitlab/data:/home/git/data -v /data/gitlab/log:/var/log/gitlab -v /data/gitlab/backups:/home/git/data/backups --link postgresql:postgresql --link redis:redisio -e "DB_USER=gitlab" -e "DB_PASS=xxxxxxxxxx" -e "DB_NAME=gitlabhq_production" -e 'GITLAB_SECRETS_DB_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_SECRETS_SECRET_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_SECRETS_OTP_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_TIMEZONE=Beijing' sameersbn/gitlab:8.5.5
升級gitlab
docker run -d --hostname git.xiandanjia.com -p 443:443 -p 80:80 -p 22:22 --name gitlab -v /data/gitlab/data:/home/git/data -v /data/gitlab/log:/var/log/gitlab -v /data/gitlab/backups:/home/git/data/backups --link postgresql:postgresql --link redis:redisio -e "DB_USER=gitlab" -e "DB_PASS=xxxxxxxxxx" -e "DB_NAME=gitlabhq_production" -e 'GITLAB_SECRETS_DB_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_SECRETS_SECRET_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_SECRETS_OTP_KEY_BASE=xxxxxxxxxx' -e 'GITLAB_TIMEZONE=Beijing' sameersbn/gitlab