~sircmpwn/sr.ht-discuss

5 2

permission denied when creating repo on selfhosted git.sr.ht instance

Details
Message ID
<0584012a-d25b-25a5-21d8-4496b11d48dd@slipfox.xyz>
DKIM signature
pass
Download raw message
TZAG,
I'm currently trying to deploy Sourcehut and I've run into an issue. Any 
time I to create a new repo, I experience the following error:
mkdir /var/lib/git/~slips: permission denied
This happens irregardless of the permissions the directory in question 
is set to, and the message strangely doesn't change even when the repo 
directory does, always pointing to /var/lib/git. For context, here's my 
config.ini (sensitive strings redacted):
https://null.slipfox.xyz/Ep.ini
No logs are written to either git.sr.ht.log or git.sr.ht-api.log when 
this occurs. Assistance would be appreciated.
Details
Message ID
<COBWXRW3P6Q1.2VZG2WUWBWRB9@ki>
In-Reply-To
<0584012a-d25b-25a5-21d8-4496b11d48dd@slipfox.xyz> (view parent)
DKIM signature
pass
Download raw message
On Mon Nov 14, 2022 at 5:45 AM GMT, Slips wrote:
> mkdir /var/lib/git/~slips: permission denied

The git.sr.ht API will create repos on the filesystem as whatever user
you're running it as. Are you perhaps running it using your own user?
When running `./api/api`, make sure to run it as the git user. You
could, for example, do `doas -u git ./api/api`.
Details
Message ID
<ab3157eb-dcbd-4825-61d9-71fdb9b3f630@slipfox.xyz>
In-Reply-To
<COBWXRW3P6Q1.2VZG2WUWBWRB9@ki> (view parent)
DKIM signature
pass
Download raw message
 > The git.sr.ht API will create repos on the filesystem as whatever user
 > you're running it as.It's running as git, as far as I can tell, since 
that's the default user
it runs as in the OpenRC service, and htop shows git as the process 
owner for both the regular and API processes.

 > You could, for example, do `doas -u git ./api/api`.
These instructions sound like they're for running directly from the 
repo, which I am not. I am using the Alpine packages.

P.S. My apologies for originally sending this email directly to you 
instead of over the ML, I'm not used to working in Mailing Lists.
Details
Message ID
<COCAFXFZC4UP.23HWRXL7J0TDU@usu>
In-Reply-To
<ab3157eb-dcbd-4825-61d9-71fdb9b3f630@slipfox.xyz> (view parent)
DKIM signature
pass
Download raw message
On Mon Nov 14, 2022 at 7:40 PM GMT, Slips wrote:
>  > The git.sr.ht API will create repos on the filesystem as whatever user
>  > you're running it as.It's running as git, as far as I can tell, since 
>  > that's the default user
> it runs as in the OpenRC service, and htop shows git as the process 
> owner for both the regular and API processes.

Ah, I see, I had misunderstood your issue. If you are getting a
permissions error, it would be quite surprising if the issue was not a
permissions issue. Just to confirm, do you still get the error if you
set the following?

```
doas chmod o+x /var /var/lib
doas chown -R git:git /var/lib/git
doas chmod -R 777 /var/lib/git
```

Can you replicate the permissions issue in any way if you
`doas -u git -s` then try to create the directory yourself?
Details
Message ID
<79e45844-758d-ca62-5c5e-0f402504db38@slipfox.xyz>
In-Reply-To
<COBWXRW3P6Q1.2VZG2WUWBWRB9@ki> (view parent)
DKIM signature
pass
Download raw message
doas chmod o+x /var /var/lib
doas chown -R git:git /var/lib/git
doas chmod -R 777 /var/lib/git

I do still experience this issue after running these commands. I cannot 
replicate this issue when running mkdir from the git user, it works 
perfectly fine there.

Just to confirm that the service users are running as git, here's a 
screenshot of my bpytop: https://null.slipfox.xyz/EA.png
Details
Message ID
<38aae0be-5b3a-364f-07ea-0f715205b9f9@slipfox.xyz>
In-Reply-To
<COBWXRW3P6Q1.2VZG2WUWBWRB9@ki> (view parent)
DKIM signature
pass
Download raw message
I solved the issue, it was PEBKAC.

You see, I've been running the Sourcehut services through an Alpine LXC 
(Linux Container) this whole time, and one of consequences of that is I 
have to pass the ports sourcehut uses through to the host server so I 
can proxy via nginx. I just checked and I had a separate instance of the 
API service running on the host machine which was taking all of the API 
requests I was making. I turned off that service and that error has been 
solved. This of course led to another error which I will discuss on 
either the IRC or a separate thread. Thank you for the help.
Reply to thread Export thread (mbox)