How do I create an nfs share for gitlab in TrueNAS 24.10?

I am installing GitLab CE and planning to use TrueNAS’s NFS as the storage for its repository. Here’s what I’ve done on the TrueNAS side:

  1. Created a user and group:
  • Created a user gitlab and a group code. UID and GID are both 3002.
  1. Set up a dataset:
  • Created a dataset named gitlab with Unix permissions set to:
    • User: gitlab
    • Group: code
    • Both user and group have read, write, and execute permissions, while others have no permissions.
  1. Configured NFS sharing:
  • Created an NFS share for the dataset and set the mapall user to gitlab and the mapall group to code in the advanced options.

On the client side (Ubuntu 22.04), I did the following:

  1. Mounted the NFS share:
sudo mount 172.20.10.76:/mnt/hpc01/gitlab /mnt/gitlab
  1. Verified the mount:
    The mount command output was:
172.20.10.76:/mnt/hpc01/gitlab on /mnt/gitlab type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.20.10.16,local_lock=none,addr=172.20.10.76)
  1. Configured GitLab:
  • Ran sudo gitlab-ctl reconfigure.
  • This step failed with an error indicating that no_root_squash was required.
  1. Modified NFS settings:
  • Manually edited the TrueNAS /etc/exports file to change all_squash to no_root_squash.
  • Restarted the NFS server.
  1. Reconfigured GitLab:
  • Ran sudo gitlab-ctl reconfigure again, and this time it succeeded.

Issues Encountered

  1. Permission Changes:
    After configuring GitLab, I noticed that the UID and GID of the gitlab dataset on TrueNAS had been changed to 997 and 998, respectively. These values match the UID and GID of the git user on the client system. I suspect that GitLab’s configuration process executed a sudo chmod -R git:git command.
  2. NFS Export Reset:
    Whenever the NFS server restarts, the manual change to no_root_squash in the /etc/exports file is reset to all_squash. This causes GitLab to stop functioning.

Questions

  1. How can I properly configure TrueNAS to install and run GitLab with NFS storage?
  2. How can I make the no_root_squash setting persistent on TrueNAS?

This is a big NO. ALL settings not made through the GUI will get overwritten by the system. Never ever make changes in the shell of files managed by Truenas. If Truenas GUI does not allow you to set this value you can’t do it. Period.

no_root_squash can be set by this:

1 Like