最近公司要把在云服务器的代码仓库迁移到内网
云服务器的gitlab是直接运行的,在内网要求使用docker部署,两边的版本都是gitlab ce 16.6.2
首先:我在云服务器通过命令生成 了备份压缩包:
gitlab-rake gitlab:backup:create
接着把压缩包下载到内网服务器,使用docker-compose运行gitlab。
docker-compose.yml
version: '3'
services:
gitlab:
container_name: gitlab
image: gitlab/gitlab-ce:16.6.2-ce.0
restart: always
ports:
- "80:80"
environment:
- TZ=Asia/Shanghai
volumes:
- /data/gitlab/config:/etc/gitlab
- /data/gitlab/logs:/var/log/gitlab
- /data/gitlab/data:/var/opt/gitlab
networks:
- gitlab_network
networks:
gitlab_network:
driver: bridge
容器成功启动,并且可以正常访问
复制 gitlab-secrets.json和gitlab.rb文件到/data/gitlab/config,重启容器生效
然后复制备份文件压缩包1706197160_2024_01_25_16.6.2_gitlab_backup.tar到/data/gitlab/data/backups
进入容器查看git用户的uid,之后给压缩包赋所有权到git用户
之后执行
gitlab-rake gitlab:backup:restore BACKUP=1706197160_2024_01_25_16.6.2
提示如下:
2024-01-26 11:58:25 UTC -- Unpacking backup ...
tar: Skipping to next header
tar: Skipping to next header
tar: Skipping to next header
tar: A lone zero block at 6596142
tar: Exiting with failure status due to previous errors
2024-01-26 11:58:29 UTC -- Unpacking backup failed
2024-01-26 11:58:29 UTC -- Deleting backup and restore PID file ... done
查看/data/gitlab/logs/gitlab-rails下面的backup_json.log:
{"severity":"INFO","time":"2024-01-26T11:58:25.470Z","correlation_id":null,"message":"Unpacking backup ... "}
{"severity":"INFO","time":"2024-01-26T11:58:29.994Z","correlation_id":null,"message":"Unpacking backup failed"}
我不知道从哪里可以获取更多更详细的错误信息,请告诉我一下,我去获取更详细的错误信息。或者有遇见过相同问题的可以麻烦解答一下,感谢
https://blog.csdn.net/d_d1298/article/details/89672569
https://www.gnu.org/software/tar/manual/html_section/warnings...
https://www.ibm.com/support/pages/lone-zero-block