gpt4 book ai didi

cron - 如何在 docker gitlab-ce 中启用 cron 备份

转载 作者:IT老高 更新时间:2023-10-28 21:41:21 26 4
gpt4 key购买 nike

我正在使用 this要安装的 Docker 镜像 gitlab-ce
要配置它,您可以覆盖名为 gitlab.rb 的文件。通过将其作为卷安装在 ./gitlab.rb:/etc/gitlab/gitlab.rb:ro
你可以找到 gitlab.rb here

在备份部分,我目前有这个:

## For setting up backups
## see https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/README.md#backups

# gitlab_rails['manage_backup_path'] = true
# gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
gitlab_rails['backup_archive_permissions'] = 0644 # See: http://doc.gitlab.com/ce/raketasks/backup_restore.html#backup-archive-permissions
# gitlab_rails['backup_pg_schema'] = 'public'
gitlab_rails['backup_keep_time'] = 604800
# gitlab_rails['backup_upload_connection'] = {
# 'provider' => 'AWS',
# 'region' => 'eu-west-1',
# 'aws_access_key_id' => 'AKIAKIAKI',
# 'aws_secret_access_key' => 'secret123'
# }
# gitlab_rails['backup_upload_remote_directory'] = 'my.s3.bucket'
# gitlab_rails['backup_multipart_chunk_size'] = 104857600
# gitlab_rails['backup_encryption'] = 'AES256' # Turns on AWS Server-Side Encryption with Amazon S3-Managed Keys for backups

如果您看到代码中的推荐 link , 它说 :
# Scheduling a backup

To schedule a cron job that backs up your repositories and GitLab metadata, use the root user:
sudo su -
crontab -e
There, add the following line to schedule the backup for everyday at 2 AM:
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create

问题
  • 有没有办法在安装时执行此操作而不是手动执行此操作?
  • cron 任务是否已经在运行?我们不应该通过做 crontab -f 开始它吗? ?
  • 命令是什么文件crontab -e调整 ?
  • 要更改教程的手动配置部分,使用像 /etc/cron.d/my-backup-cron 这样的 cron 文件它会是相同的预期行为吗?
  • 最佳答案

    根据 Gitlab Doku,您也可以代替“docker run”方法,简单地发出:

    docker exec -t <your container name> gitlab-rake gitlab:backup:create

    关于cron - 如何在 docker gitlab-ce 中启用 cron 备份,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33961240/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com