Introduced in GitSwarm 2016.3.
GitSwarm allows you to define multiple repository storage paths to distribute the storage load between several mount points.
**Notes:**
default
.Warning: In order for backups to work correctly, the storage path must not be a mount point and the GitSwarm user should have correct permissions for the parent directory of the path. In GitSwarm EE this is taken care of automatically, but for source installations you should be extra careful.
The thing is that for compatibility reasons
gitlab.yml
has a different structure than Omnibus. Ingitlab.yml
you indicate the path for the repositories, for example/home/git/repositories
, while in Omnibus you indicategit_data_dirs
, which for the example above would be/home/git
. Then, Omnibus will create arepositories
directory under that path to use withgitlab.yml
.This little detail matters because while restoring a backup, the current contents of
/home/git/repositories
are moved to/home/git/repositories.old
, so if/home/git/repositories
is the mount point, thenmv
would be moving things between mount points, and bad things could happen. Ideally,/home/git
would be the mount point, so then things would be moving within the same mount point. This is guaranteed with package installations (because they don't specify the full repository path but the parent path), but not for source installations.
Now that you've read that big fat warning above, let's edit the configuration files and add the full paths of the alternative repository storage paths. In the example below, we add two more mountpoints that are named nfs
and cephfs
respectively.
For source installations
Edit gitlab.yml
and add the storage paths:
repositories:
# Paths where repositories can be stored. Give the canonicalized absolute pathname.
# NOTE: REPOS PATHS MUST NOT CONTAIN ANY SYMLINK!!!
storages: # You must have at least a 'default' storage path.
default: /home/git/repositories
nfs: /mnt/nfs/repositories
cephfs: /mnt/cephfs/repositories
[Restart GitSwarm] for the changes to take effect.
Note: The
gitlab_shell: repos_path
entry ingitlab.yml
will be deprecated and replaced byrepositories: storages
in the future, so if you are upgrading from a version prior to 8.10, make sure to add the configuration as described in the step above. After you make the changes and confirm they are working, you can remove therepos_path
line.
For package installations
Edit /etc/gitswarm/gitswarm.rb
by appending the rest of the paths to the default one:
git_data_dirs({
"default" => "/var/opt/gitswarm/git-data",
"nfs" => "/mnt/nfs/git-data",
"cephfs" => "/mnt/cephfs/git-data"
})
Note that Omnibus stores the repositories in a repositories
subdirectory of the git-data
directory.
Once you set the multiple storage paths, you can choose where new projects will be stored via the Application Settings in the Admin area.
Beginning with GitSwarm 2017.1, multiple paths can be chosen. New projects will be randomly placed on one of the selected paths.