docker run --name gitlab \
-p 2022:22 -p 2080:80 -p 2443:443 -d \
-v /opt/gitlab/config:/etc/gitlab \
-v /opt/gitlab/gitlab/logs:/var/log/gitlab \
-v /opt/gitlab/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:16.2.1-ce.0
gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
# gitlab_rails['backup_gitaly_backup_path'] = "/opt/gitlab/embedded/bin/gitaly-backup"
###! Docs: https://docs.gitlab.com/ee/raketasks/backup_restore.html#backup-archive-permissions
gitlab_rails['backup_archive_permissions'] = 0644
# gitlab_rails['backup_pg_schema'] = 'public'
###! The duration in seconds to keep backups before they are allowed to be deleted
gitlab_rails['backup_keep_time'] = 604800
docker exec -t gitlab gitlab-ctl reconfigure
docker exec -t gitlab gitlab-backup create STRATEGY=copy
docker exec -t gitlab /bin/bash -c 'gitlab-ctl backup-etc'
docker run --name gitlab-bak1 \
-p 2022:22 -p 2080:80 -p 2443:443 -d \
-v /opt/gitlab_bak1/config:/etc/gitlab \
-v /opt/gitlab_bak1/logs:/var/log/gitlab \
-v /opt/gitlab_bak1/data:/var/opt/gitlab \
gitlab/gitlab-ce:16.2.1-ce.0
gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
# gitlab_rails['backup_gitaly_backup_path'] = "/opt/gitlab/embedded/bin/gitaly-backup"
###! Docs: https://docs.gitlab.com/ee/raketasks/backup_restore.html#backup-archive-permissions
gitlab_rails['backup_archive_permissions'] = 0644
# gitlab_rails['backup_pg_schema'] = 'public'
###! The duration in seconds to keep backups before they are allowed to be deleted
gitlab_rails['backup_keep_time'] = 604800
docker exec -t gitlab-bak1 gitlab-ctl reconfigure
cp /opt/gitlab/gitlab/data/backups/1705891184_2024_01_22_16.2.1_gitlab_backup.tar /opt/gitlab_bak1/data/backups/
docker exec -it gitlab-bak1 gitlab-ctl stop puma
docker exec -it gitlab-bak1 gitlab-ctl stop sidekiq
docker exec -it gitlab-bak1 gitlab-ctl status
docker exec -it gitlab-bak1 gitlab-backup restore BACKUP=1705891184_2024_01_22_16.2.1
tar -xf /opt/gitlab/config/config_backup/gitlab_config_1705891508_2024_01_22.tar -C /tmp/ && mv -f /tmp/etc/gitlab/gitlab-secrets.json /opt/gitlab_bak1/config/
docker restart gitlab-bak1
docker exec -it gitlab-bak1 gitlab-rake gitlab:check SANITIZE=true
官方文档: https://docs.gitlab.com/omnibus/settings/backups.html
gitlab数据及用户迁移: https://blog.csdn.net/IT_shinchan/article/details/130783545?utm_medium=distribute.pc_relevant.none-task-blog-2defaultbaidujs_baidulandingword~default-4-130783545-blog-122261961.235v40pc_relevant_anti_t3&spm=1001.2101.3001.4242.3&utm_relevant_index=5