服务器是 windows server 2012 r2,gitlab 跑在虚拟机里的 centOS7 的 docker 里,想要把 gitlab 备份到 window 的文件夹内,尝试了若干办法均不成功,目前的现象是执行备份不报错,但是只有容器内 /var/opt/gitlab/backups 文件夹内有备份文件,共享文件夹没有,还是来 v 站请教下各位大佬帮忙指点下
docker 的运行配置
docker run \
-itd \
-p 80:80 \
-p 443:443 \
-p 22:22 \
-v /usr/local/gitlab/etc:/etc/gitlab \
-v /usr/local/gitlab/log:/var/log/gitlab \
-v /usr/local/gitlab/opt:/var/opt/gitlab \
-v /mnt/gitlab-backups:/mnt/host/gitlab-backup\
--restart always \
--privileged=true \
--name gitlab \
gitlab-test
//linux 下挂载目录的命令(尝试过 hgfs 跟 cifs,现在用的是 cifs)
//192.168.1.220/gitlab-backup-share /mnt/gitlab-backups cifs auto,username=Administrator,passwd=admin@123,file_mode=0777,dir_mode=0700,uid=998,gid=998,iocharset=utf8 0 0
//这个 uid 跟 gid 是因为容器内 git 账户 uid 是 998,中间开启 manage_backup_path 选项的时候报错想到的歪主意
gitlab 的配置(省略了无关项)
#gitlab_rails['backup_path'] = "/mnt/host/gitlab-backup"
#直接把备份路径指向挂载的文件夹,备份最后的时候会报 file changed as we read it 错误
gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_upload_connection'] = {
:provider => 'Local',
:local_root => '/mnt/gitlab-backups'
}
gitlab_rails['backup_upload_remote_directory'] = 'gitlab_backups'
gitlab_rails['backup_archive_permissions'] = 0644
gitlab_rails['backup_keep_time'] = 604800
user['username'] = "root"
user['group'] = "root"
1
zypy333 OP 搞定了,我最后重开了个容器,把配置文件考过去,重新启动,就好了,应该是之前配置过程中出了什么纰漏
|