DIRECTORY only used for uploading backup to remote storage
Summary
Contrary to what is written in the doc (Specifying a custom directory for backups
is on the same level three as Uploading to locally mounted shares
, not under), the DIRECTORY
option when creating a backup is only used when uploading backup to a remote storage, not for the local backup folder.
This is confirmed by reading lib/backup/manager.rb. remote_target
is only used by the upload
method, not pack
.
Steps to reproduce
Create two backups with different DIRECTORY
environment variable:
# /opt/gitlab/bin/gitlab-rake gitlab:backup:create DIRECTORY=daily SKIP=repositories,artifacts,registry,builds,lfs
# /opt/gitlab/bin/gitlab-rake gitlab:backup:create DIRECTORY=weekly SKIP=db,uploads,builds,artifacts,registry,pages
Example Project
N/A
What is the current bug behavior?
All backups are stored in the /var/opt/gitlab/backups
folder, instead of /var/opt/gitlab/backups/daily/
and /var/opt/gitlab/backups/weekly/
What is the expected correct behavior?
Backups should be stored locally in the subfolder specified with DIRECTORY
Relevant logs and/or screenshots
N/A
Output of checks
N/A
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Debian 9.1 Current User: git Using RVM: no Ruby Version: 2.3.5p376 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.0.0 Redis Version: 3.2.5 Git Version: 2.13.5 Sidekiq Version:5.0.4 Go Version: unknown
GitLab information Version: 10.0.2 Revision: 06a5a33 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://hiddenforprivacy HTTP Clone URL: https://hiddenforprivacy/some-group/some-project.git SSH Clone URL: git@hiddenforprivacy:some-group/some-project.git Using LDAP: yes Using Omniauth: no
GitLab Shell Version: 5.9.0 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...
GitLab Shell version >= 5.9.0 ? ... OK (5.9.0) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 2/6 ... ok 10/13 ... ok 8/15 ... ok 10/16 ... ok 14/17 ... ok 8/18 ... ok 3/21 ... ok 10/25 ... ok 6/26 ... ok 6/28 ... ok 2/30 ... ok 10/31 ... ok 4/32 ... ok 6/33 ... ok 10/34 ... ok 6/37 ... ok 6/38 ... ok 4/40 ... ok 4/41 ... ok 10/42 ... ok 14/47 ... ok 14/48 ... ok 10/50 ... ok 10/51 ... ok 2/52 ... ok 14/54 ... ok 12/56 ... ok 14/57 ... ok 10/58 ... ok 4/59 ... ok 4/60 ... ok 4/61 ... ok 12/66 ... ok 12/68 ... ok 12/69 ... ok 12/70 ... ok 12/71 ... ok 12/73 ... ok 4/74 ... ok 8/75 ... ok 2/76 ... ok 4/78 ... ok 4/79 ... ok 4/80 ... ok 4/81 ... ok 4/82 ... ok 10/83 ... ok 10/84 ... ok 10/85 ... ok 6/86 ... ok 6/87 ... ok 18/88 ... ok 18/89 ... ok 18/92 ... ok 18/93 ... ok 18/94 ... ok 6/95 ... ok 18/96 ... ok 20/98 ... ok 10/99 ... ok 10/100 ... ok 21/102 ... ok 10/103 ... ok 4/104 ... ok 22/105 ... ok 23/106 ... ok 24/107 ... ok 8/108 ... ok 25/109 ... ok 26/110 ... ok 27/112 ... ok 18/114 ... ok 6/115 ... ok 6/117 ... ok 10/118 ... ok 33/120 ... ok 32/121 ... ok 35/122 ... ok 2/123 ... repository is empty 36/124 ... ok 10/125 ... ok 10/126 ... ok 8/127 ... ok 10/128 ... ok 37/129 ... ok 38/130 ... ok 10/131 ... ok 6/132 ... ok 40/133 ... ok 41/134 ... ok 10/135 ... ok 10/136 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) (Hidden for privacy)
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/6 ... yes 10/13 ... yes 8/15 ... yes 10/16 ... yes 14/17 ... yes 8/18 ... yes 3/21 ... yes 10/25 ... yes 6/26 ... yes 6/28 ... yes 2/30 ... yes 10/31 ... yes 4/32 ... yes 6/33 ... yes 10/34 ... yes 6/37 ... yes 6/38 ... yes 4/40 ... yes 4/41 ... yes 10/42 ... yes 14/47 ... yes 14/48 ... yes 10/50 ... yes 10/51 ... yes 2/52 ... yes 14/54 ... yes 12/56 ... yes 14/57 ... yes 10/58 ... yes 4/59 ... yes 4/60 ... yes 4/61 ... yes 12/66 ... yes 12/68 ... yes 12/69 ... yes 12/70 ... yes 12/71 ... yes 12/73 ... yes 4/74 ... yes 8/75 ... yes 2/76 ... yes 4/78 ... yes 4/79 ... yes 4/80 ... yes 4/81 ... yes 4/82 ... yes 10/83 ... yes 10/84 ... yes 10/85 ... yes 6/86 ... yes 6/87 ... yes 18/88 ... yes 18/89 ... yes 18/92 ... yes 18/93 ... yes 18/94 ... yes 6/95 ... yes 18/96 ... yes 20/98 ... yes 10/99 ... yes 10/100 ... yes 21/102 ... yes 10/103 ... yes 4/104 ... yes 22/105 ... yes 23/106 ... yes 24/107 ... yes 8/108 ... yes 25/109 ... yes 26/110 ... yes 27/112 ... yes 18/114 ... yes 6/115 ... yes 6/117 ... yes 10/118 ... yes 33/120 ... yes 32/121 ... yes 35/122 ... yes 2/123 ... yes 36/124 ... yes 10/125 ... yes 10/126 ... yes 8/127 ... yes 10/128 ... yes 37/129 ... yes 38/130 ... yes 10/131 ... yes 6/132 ... yes 40/133 ... yes 41/134 ... yes 10/135 ... yes 10/136 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... yes (2.3.5) Git version >= 2.7.3 ? ... yes (2.13.5) Git user has default SSH configuration? ... no Try fixing it: mkdir ~/gitlab-check-backup-1507619741 sudo mv /var/opt/gitlab/.ssh/authorized_keys.lock ~/gitlab-check-backup-1507619741 For more information see: doc/ssh/README.md in section "SSH on the GitLab server" Please fix the error above and rerun the checks. Active users: ... 10
Checking GitLab ... Finished
Possible fixes
lib/backup/manager.rb lines 19 and 42