diff options
-rw-r--r-- | doc/raketasks/backup_restore.md | 11 | ||||
-rw-r--r-- | lib/backup/manager.rb | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md index 57bc71d2903..4238685b54f 100644 --- a/doc/raketasks/backup_restore.md +++ b/doc/raketasks/backup_restore.md @@ -195,6 +195,17 @@ To use the `copy` strategy instead of the default streaming strategy, specify sudo gitlab-rake gitlab:backup:create STRATEGY=copy ``` +### Backup filename + +By default a backup file is created according to the specification in [the Backup timestamp](#backup-timestamp) section above. You can however override the `[TIMESTAMP]` part of the filename by setting the `BACKUP` environment variable. For example: + +```sh +sudo gitlab-rake gitlab:backup:create BACKUP=dump +``` + +The resulting file will then be `dump_gitlab_backup.tar`. This is useful for systems that make use of rsync and incremental backups, and will result in considerably faster transfer speeds. + + ### Excluding specific directories from the backup You can choose what should be exempt from the backup up by adding the environment variable `SKIP`. diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index a0434a66ef1..792a25422ee 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -234,7 +234,11 @@ module Backup end def tar_file - @tar_file ||= "#{backup_information[:backup_created_at].strftime('%s_%Y_%m_%d_')}#{backup_information[:gitlab_version]}#{FILE_NAME_SUFFIX}" + if ENV['BACKUP'] + @tar_file ||= ENV['BACKUP'] + "#{FILE_NAME_SUFFIX}" + else + @tar_file ||= "#{backup_information[:backup_created_at].strftime('%s_%Y_%m_%d_')}#{backup_information[:gitlab_version]}#{FILE_NAME_SUFFIX}" + end end def backup_information |