Forum: 
Tags: 

Gitlab - external backup

PedyMaster's picture

Hi, Iam new here in forum, even though Iam using TKL for a while.

My question regards gitlab - I would like to have the git repo on my NAS so when my server dies and I lose the vmware with gitlub, I can still deployed new vmware and continue with work.

I notices that repos are in /home/git/repositories - I mounted NAS and tried to change the repo path in several configuration files to my NAS location but it did not work - when I tried to create new user it said "We are sorry, but something went wrong"

Then I tried to mount my NAS directly to /home/git/repositories but the same problem occured.

Is there a way of how to do this? Thanks for help in advance!

 

Note: I know that this should back up only repo and that there is a database too. I can backup database to NAS without problem. It is just the repo I dont know what to do with

Jeremy Davis's picture

Even though this is a TKL appliance the upstream software developers (and the community that supports them) are probably best placed to answer your specific questions. If they provide an answer perhaps you can post back...

In the meantime I suspect that it is a permissions issue (I guess you are mounting your external file system with root and GitLab uses a limted user account). Maybe you can use FUSE to mount your NAS with the GitLab user to acheive your desired results?

PedyMaster's picture

Hi, thanks for reply!

I have several other services working this way, working with nas without problem even if the service has its own user. Also, when i tried to create the project, folder was created on NAS (when ir was mounted as repo directory), so i dont think this will be the issue, but i will ask gitlab community and post back the answer when i get it.


PedyMaster's picture

Looks like it really was a permission problem, but kinda weird-one

First of all, I mounted NAS through SMB in fstab by //IP/backup/gitHome /mnt/repositories smbfs username=username,password=secret,dir_mode=0777,file_mode=0777 0 0

Then, when I created new project, all went well, project was created, files were in place, all looked OK

Error came when I tried to create a new user "Pedy", I got the server error with "something went wrong". In log I found:

Errno::EPERM (Operation not permitted - /mnt/repositories/Pedy):
  app/models/namespace.rb:57:in `ensure_dir_exist'
  app/observers/user_observer.rb:18:in `after_save'
  app/controllers/admin/users_controller.rb:62:in `block in create'
  app/controllers/admin/users_controller.rb:61:in `create'

But I found the directory! It was created and had correct access privilege!

So, now that the folder has been created, I tried to register the same user again and voila... all works well

So my workaround to this is, to create the user for second time.

Jeremy Davis's picture

But thanks for posting back the workaround... It certainly does seem strange though that it creates the folder on first attempt, but still errors...

PedyMaster's picture

I looked into it more with one of my friends and we noticed, that when you create the user, git wants to chmod the folder, which cannot be done, as the folder has set privileges from root in fstab. When folder already exist, gitlab thinks all is already set and does not care anymore. Also, it is not trying to change the permissions when creating folder for project

Jeremy Davis's picture

I guess that leaves you with the option of mounting as the git user or creating a sub folder (owned by the git user)... Or I guess just continuing with your workaround. Thanks again for posting back though... That's awesome info! :)

Post new comment