docker安装的gitlab迁移 - xd21303/Notebook GitHub Wiki
步骤
1、将gitlab挂载的数据卷目录打包。
--gitlab
-config
-data
-logs
tar -cvf gitlab.tar gitlab
2、将压缩包传送到目标机器
scp gitlab.tar [email protected]:/target_path
3、解压缩gitlab.tar至目标目录
tar -xvf gitlab.tar
4、将docker-compose.yaml文件放到目标机器
version: "3"
services:
gitlab:
image: gitlab/gitlab-ce
container_name: gitlab
restart: always
ports:
- "2291:22"
- "44391:443"
- "8091:8091"
volumes:
- /data/docker/gitlab/config:/etc/gitlab
- /data/docker/gitlab/logs:/var/log/gitlab
- /data/docker/gitlab/data:/var/opt/gitlab
gitlab-runner:
image: gitlab/gitlab-runner
container_name: gitlab-runner
restart: always
volumes:
- ./config.toml:/etc/gitlab-runner/config.toml
- /var/run/docker.sock:/var/run/docker.sock
5、启动docker-compose即可
docker-compose up -d
6、启动后进入gitlab容器
docker exec -it gitlab /bin/bash
7、重新配置
gitlab-ctl reconfigure
prometheus没启动的处理
输入命令查看运行状态
gitlab-ctl status
发现prometheus是down
查看prometheus的日志
gitlab-ctl tail prometheus
报错
opening storage failed: get segment range: segments are not sequential
网上查找原因,是挂载卷的问题。
删除prometheus目录下的wal目录的所有文件
rm -rf gitlab/data/prometheus/data/wal
恢复正常。
参考https://github.com/prometheus/prometheus/issues/5342#issuecomment-472763014