查看版本
sudo gitlab-rake gitlab:env:info
备份
sudo gitlab-rake gitlab:backup:create RAILS_ENV=production
移动到目标服务器
使用scp命令将备份文件复制到目标主机
scp username@ip:/var/opt/gitlab/backups/1728457011_2024_10_09_14.3.3_gitlab_backup.tar /data/gitlab/data/backups/1728457011_2024_10_09_14.3.3_gitlab_backup.tar
部署docker版本的GitLab
version: '3.6'
services:
gitlab:
image: gitlab/gitlab-ce:14.3.3-ce.0
container_name: gitlab
restart: unless-stopped
hostname: 'gitlab'
environment:
TZ: "Asia/Shanghai"
GITLAB_OMNIBUS_CONFIG: |
external_url "http://xxx.xx.xx.xx:8000"
postgresql['shared_buffers'] = "256MB"
gitlab_rails['time_zone'] = 'Asia/Shanghai'
sidekiq['concurrency'] = 4
prometheus_monitoring['enable'] = false
gitlab_rails['gitlab_shell_ssh_port'] = 2222
ports:
- '8000:8000'
- '2222:22'
volumes:
- './config:/etc/gitlab'
- './logs:/var/log/gitlab'
- './data:/var/opt/gitlab'
shm_size: '256m'
networks:
- net-public
networks:
net-public:
external: true
恢复数据
docker exec -it gitlab_gitlab_1 /bin/bash
gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1728457011_2024_10_09_14.3.3
评论区