From ae29c0b5cef9f97fc6f4521f6a0e06bbcd0db29a Mon Sep 17 00:00:00 2001 From: Michael Steinert Date: Mon, 17 Nov 2014 10:54:31 -0600 Subject: [PATCH] init: add a weekly backup option --- README.md | 6 +++--- assets/init | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da47f0d0..809958d7 100644 --- a/README.md +++ b/README.md @@ -688,7 +688,7 @@ Below is the complete list of available options that can be used to customize yo - **GITLAB_WEBHOOK_TIMEOUT**: Sets the timeout for webhooks. Defaults to `10` seconds. - **GITLAB_GRAVATAR_ENABLED**: Enable or disable use of gravatar.com for user avatar. Defaults to `true` - **GITLAB_BACKUP_DIR**: The backup folder in the container. Defaults to `/home/git/data/backups` -- **GITLAB_BACKUPS**: Setup cron job to automatic backups. Possible values `disable`, `daily` or `monthly`. Disabled by default +- **GITLAB_BACKUPS**: Setup cron job to automatic backups. Possible values `disable`, `daily`, `weekly` or `monthly`. Disabled by default - **GITLAB_BACKUP_EXPIRY**: Configure how long (in seconds) to keep backups before they are deleted. By default when automated backups are disabled backups are kept forever (0 seconds), else the backups expire in 7 days (604800 seconds). - **GITLAB_SSH_HOST**: The ssh host. Defaults to **GITLAB_HOST**. - **GITLAB_SSH_PORT**: The ssh port number. Defaults to `22`. @@ -788,9 +788,9 @@ The restore operation will list all available backups in reverse chronological o ## Automated Backups -The image can be configured to automatically take backups on a daily or monthly basis. Adding `-e 'GITLAB_BACKUPS=daily'` to the docker run command will enable daily backups, while `-e 'GITLAB_BACKUPS=monthly'` will enable monthly backups. +The image can be configured to automatically take backups on a daily, weekly or monthly basis. Adding `-e 'GITLAB_BACKUPS=daily'` to the docker run command will enable daily backups. Adding `-e 'GITLAB_BACKUPS=weekly'` or `-e 'GITLAB_BACKUPS=monthly'` will enable weekly or monthly backups. -Daily backups are created at 4 am (UTC) everyday, while monthly backups are created on the 1st of every month at the same time as the daily backups. +Daily backups are created at 4 am (UTC) everyday. Weelkly backups are created every Sunday at the same time as the daily backups. Monthly backups are created on the 1st of every month at the same time as the daily backups. By default, when automated backups are enabled, backups are held for a period of 7 days. While when automated backups are disabled, the backups are held for an infinite period of time. This can behavior can be configured via the `GITLAB_BACKUP_EXPIRY` option. diff --git a/assets/init b/assets/init index cc1d1b8f..40a0178c 100755 --- a/assets/init +++ b/assets/init @@ -256,7 +256,7 @@ case "${GITLAB_HTTPS}" in esac case "${GITLAB_BACKUPS}" in - daily|monthly) GITLAB_BACKUP_EXPIRY=${GITLAB_BACKUP_EXPIRY:-604800} ;; + daily|weekly|monthly) GITLAB_BACKUP_EXPIRY=${GITLAB_BACKUP_EXPIRY:-604800} ;; disable|*) GITLAB_BACKUP_EXPIRY=${GITLAB_BACKUP_EXPIRY:-0} ;; esac @@ -689,6 +689,11 @@ appStart () { daily) sudo -u git -H cat > /tmp/cron.git < /tmp/cron.git <