软创互联

Gitlab自动备份到aws s3存储桶


#1
  • gitlab.rb
gitlab_rails['backup_keep_time'] = 172800
gitlab_rails['backup_upload_connection'] = {
  'provider' => 'AWS',
  'region' => 'cn-north-1',
  'aws_access_key_id' => 'AKIAPFTO47JLDV7FPVAQ',
  'aws_secret_access_key' => 'XXXXXXXXXXXXXXX'
}
gitlab_rails['backup_upload_remote_directory'] = 'gugud-gitlab'
  • 重新启用配置, 可以选择重启, 重构容器, 也可直接在容器中执行gitlab reconfigure

  • 执行命令触发备份, 该命令为避免手工运行, 可直接放入crontab配置为定时任务

docker exec -it `docker ps|awk '/gitlab-ce-zh.*80->80\/tcp/{print $1}'` gitlab-rake gitlab:backup:create

FAQ

    1. 备份不会对证书和配置文件做备份, 如果需要备份配置文件, 建议使用脚本处理