How can I use GitLab on one server and store all o

2019-06-23 23:48发布

问题:

My team has a couple git repositories on a NAS server at /net/CM/repo.git and /net/CM/repo2.git. I have recently joined the team and told them about GitLab, they thought it would be a great tool to implement.

However, they want me to install GitLab on a different server, we'll call it the Super Server, and the other we'll call the NAS Server.

I've installed GitLab on the Super Server and it runs great, but I'm having difficulty getting it to detect my git repos on the NAS Server. Is that possible? I don't want the rest of the team to have to change their remote origin's on their git repos if possible. I'd like them to continue to push to the standard repo and GitLab should detect the change.

I tried to set the git_data_dir as mentioned in this Stack Overflow post:

git_data_dir "/net/CM/"

But when I run sudo gitlab-ctl reconfigure, I end up with permission errors. It says it can't create directories at /net/CM/.

I also tried making a /net/git-data/ directory, and I set the permissions to 777 just to see if it would work, but to no avail.

So to sum it up, How can I have GitLab's web software run on my Super Server, but have all of my repos on my NAS Server?

Update

Someone asked me how I mounted the NAS server. I followed instructions provided to me when I joined the team, but here they are:

# I pulled out the ip's and ports for security purposes.
sudo apt-get install nfs-common
sudo mkdir /net
sudo mount -t nfs -o proto=tcp,port=[port] [ip]:/net /net
sudo vim /etc/fstab
# Add the following lines to fstab:
[ip]:/net /net nfs auto 0 0
[ip]:/project_name /projectname nfs auto 0 0

回答1:

I went into our NAS configuration and added my Super Server ip address to the "Root privilege-enabled hosts" and all is good. I haven't tested to see if I can uncheck that box after I've reconfigured and see if things still work.



回答2:

NFS doesn't know by itself how to compare users from different hosts. So when you mount an NFS share, you get the user IDs from the server but the local NFS client doesn't know which local user they map to. After all, User 1000 could be Anton on the server and Ben locally.

To fix the issue, you have many options. The most simple one is to make sure that the same users are available on both computers and you can configure idmapd to let NFS know.

Related:

  • https://help.ubuntu.com/community/NFSv4Howto
  • Google "nfs idmapd"
  • https://serverfault.com/questions/520276/nfs-user-mapping


标签: git gitlab