Gitlab备份与恢复[七]

时间:2023-03-08 16:14:11

标签(linux): git

笔者Q:972581034 交流群:605799367。有任何疑问可与笔者或加群交流

备份

  • 配置文件中加入

    gitlab_rails['bakup_path']='/data/backup/gitlab'

    gitlab_rails['backup_keep_time']=604800
  • 重启配置gitlab-ctl reconfigure
  • gitlab-ctl restart
  • 如果自定义备份目录需要赋予git权限
  • mkdir /data/backup/gitlab
  • chown -R git.git /data/backup/gitlab
  • 定时任务crontab中加入

    0 2 * * * /usr/bin/gitlab-rake gitlab:backup:create

策略建议:本地保留三到七天,在异地备份永久保存

恢复

  • 停止数据写入服务

  • gitlab-ctl stop unicorn

  • gitlab-ctl stop sidekiq

  • gitlab-rake gitlab:backup:restore BACKUP=1492296095

  • date -d @1492296095

邮件配置

gitlab_rails['time_zone']='Asia/Shanghai'
gitlab_rails['gitlab_email_enabled']=true
gitlab_rails['gitlab_email_from']='18171122505@126.com'
gitlab_rails['gitlab_email_display_name']='gitlab'
gitlab_rails['smtp_enable']=true
gitlab_rails['smtp_address']="smtp.126.com"
gitlab_rails['smtp_user_name']="chentiangang"
gitlab_rails['smtp_password']="your_password"
gitlab-rails['smtp_domain']="126.com"
gitlab_rails['smtp_authentication']="login"