以下是CentOS上GitLab的备份策略:
sudo cp /etc/gitlab/gitlab.rb /etc/gitlab/gitlab.rb.bak,备份gitlab-secrets.json和SSL证书。sudo gitlab-rake gitlab:backup:create,默认存至/var/opt/gitlab/backups,可通过修改/etc/gitlab/gitlab.rb中backup_path配置路径。pg_dump -U postgres gitlabhq_production | gzip > /backup/gitlabhq_production.gz。crontab -e,添加如0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create,实现每天凌晨2点备份。backup_gitlab.sh),通过Cron定期执行。find /var/opt/gitlab/backups -type f -mtime +30 -exec rm -rf {} \;删除30天前的备份。sudo gitlab-ctl stop unicorn、sudo gitlab-ctl stop sidekiq。sudo gitlab-rake gitlab:backup:restore BACKUP=<备份文件前缀>。gitlab.rb、gitlab-secrets.json和SSL证书到对应路径,执行sudo gitlab-ctl reconfigure和sudo gitlab-ctl start。