gitlab数据备份与恢复
gitlab定时自动备份
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
gitlab修改备份路径:
修改/etc/gitlab/gitlab.rb文件
gitlab_rails['backup_path'] = '/mnt/backups'
gitlab恢复
# 停止相关数据连接服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
# 从1393513186编号备份中恢复
gitlab-rake gitlab:backup:restore BACKUP=1393513186
# 启动Gitlab
sudo gitlab-ctl start
Gitlab迁移
把备份文件拷贝到gitlab的备份目录下,根据上面gitlab恢复步骤即可。
docker gitea
docker pull gitea/gitea:latest
docker run -d --name=gitea -p 10022:22 -p 10080:3000 -v /www/dockers/gitea_data:/data gitea/gitea:latest
docker for gitlab/gitlab-ce
docker pull gitlab/gitlab-ce:10.2.0-rc2.ce.0
docker run --detach \
--hostname 119.23.236.237 \
--publish 5443:443 --publish 5008:80 --publish 3022:22 \
--name gitlab \
--restart always \
--volume /www/dockers/gitlab_data/config:/etc/gitlab \
--volume /www/dockers/gitlab_data/logs:/var/log/gitlab \
--volume /www/dockers/gitlab_data/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
docker exec -it gitlab /bin/bash