Git manager: local clone and in home-dir

flexjoly

Verified User
Joined
Nov 2, 2016
Messages
89
Location
Apeldoorn, Netherlands
Hi,

On my new server I got the Pro-pack ?, so I tried the git-manager. It works nice, but it is not sufficient for our workflow yet ?.

As our git-repos are on a remote server, I only need need a clone of a remote git-repo, without the --bare option.
Is it possible that we get this option also?

And can you change the default dir that a repo is placed in? So that we can choose to put a repo ANYWHERE in a folder of the user, like in:
  • /home/user[/a/subdir]
  • /home/user/domains[/a/subdir]
  • /home/user/domains/domain.com[/a/subdir]

Thanks in advance!!
flexJoly
 
Hi @flexjoly,

You can have repository contents extracted in any directory by using deploy function. Click Modify action in the repository window and in the
Deploy Directory section enter the location of where you want repository contents to be placed.

1674125256315.png


in my example contents of the repository will be extracted to /home/user/domains/xxx. When you click action Deploy git repository contents from the selected deploy branch will be extracted to the specified directory. It can be anywhere inside user home directory.

Action Fetch will pull any changes from remote repository into DA bare repository and action Deploy will checkout the contents of local bare repository into the designated folder.

You can automate Fetch and Deploy by using webhook URL. Sending a POST request to it will automatically do Fetch+Deploy.

1674125731214.png

in my example running curl -X POST https://example.net:2222/api/git/user/john/uuid/692516a8c805671292c96025e61d0b7c/webhook would automatically pull latest changes from remote repo and would deploy it to domains/xxx.

By keeping bare git repository decoupled from the deploy directory (non bare repositories keeps them together) you are not exposing the internal git data.

For example if you want the repository contents to be deployed in your publicly accessible website. Just cloning your repo into domains/example.com/public_html would also include the .git subdirectory, which would give anyone access to the full history of you repo (as well as configuration). By using deploy feature you exposing only the repository contents while still keeping bare repository hidden in a non accessible location.
 
Hi @fln ,

Thanks for your kind answer.
But I think this is not working for me.

The company that hosts my server has their own gitlab-server with ci-deployment.
With gitlab-ci they have a secure way to deploy a repo to the local git on the production server.

What I need are coupled local repos as:
- /home/[user]/domains/.git
- or: /home/[user/domains/domain.com/.git
With remote set to a repo on the gitlab

We never put things like this in the public_html

At the moment we maintain this via the terminal.
But since DA has a git-manager, I would be so nice if this could be done also.
I think/hope it is a miner change, since it only depends on the --bare option.

Greetz, flexJoly
 
Thanks for explaining you use-case. At the moment state of DA git-manager is:
  • Git repositories location is fixed to `/home/{user}/domains/{domain}/{repo-name}.git`.
  • Git repositories are stored in bare format (only git metadata, not git metadata + check out version of some commit).
  • Git contents can be optionally checked out anywhere (inside user home directory) using deploy function.
To recreate the same structure you are using now (but would like git-manager to be aware of) we would not only need to allow non-bare repositories, but also allow repositories to be created in arbitrary locations (inside user home directory).

We do not expect the repositories to be externally managed via terminal (you can still do this if you use --git-dir and --work-tree parameters).

I think you could use existing git-manager without any changes but this requires a change in how you manage the git repository. If you would set deploy directory to /home/[user]/domains/ or /home/[user]/domains/[domain.com]/ and would replace ...a secure way to deploy a repo... with a call to deploy hook it would achieve the same result you have right now with git repo manavement via terminal.

We are slightly reluctant to add non bare git repositories (the problem is not bare/non-bare switch, real problem is arbitrary location of non bare repos). It might look easier to understand how they work, but it would open up a lot of problems as well, especially if we allow them to be created anywhere. Also same functionality can always be achieved with bare repo + deploy dir. A non bare repo is just deploy directory with bare repo contents inside .git subdirectory.

We will keep in mind your use-case when working on git feature, we might extend it in the future to support it.
 
Hi @fln,

Thank you for your explanation.

I found it very weird to see that a repo can only exist in a domain, but can deploy anywhere in the user account. I thought that the purpose was to have http-access to it.

On our older server without pro-pack. I have the following git-structure:
  • dedicated git-user, with all our bare repos in /home/git/repos/ (I had no remote git(lab) then)
  • each user has a none-bare repo inside: /home/[user]/domains/
  • .gitignore to ignore files/dirs that DA manages (this solves some problems)
  • default DA templates for user and domain to support the git-structure
  • DA-hooks on create-user and create-domain to init/make/change the corresponding git-repos, and keeping the DA files/dirs
  • git-hooks to auto-deploy-on-push the master branch to the live user-repo

That worked very well for us. There can be some problems, but experienced DA users ?? can overcome them.
And since DA is for technical people..... ?

So I do hope that you will consider this in the near future. ???

Greetz, flexJoly
 
Back
Top