git-ents.gitmain
⌘K
foforge
commit 5b6eb34
docker: serve the hosted repo at git-ents/git-ents.git, not /repo.git

The single-node hosted root named its one repository /repo.git — a bespoke, deployment-specific path unlike every other git remote the project touches (GitHub’s own git-ents/git-ents.git among them). nginx now serves it at the matching git-ents/git-ents.git path and 301-redirects the .git-less form to it, the way GitHub does; the bare repo itself moves to /data/git-ents/git-ents.git (git init creates the missing leading directory). Still exactly one repository — multi-repo routing stays out of scope until phase 8 — just named like a normal remote instead of a magic constant.

Joseph D. Carpinelli · 29 days ago

Reviews

No reviews of this commit yet — record a verdict below.

Start a review

verdict

docker/entrypoint.sh @@ -10,7 +10,7 @@ # upgrade path if either process starts crash-looping. set -eu -repo=/data/repo.git +repo=/data/git-ents/git-ents.git key=/data/hosted_signing_key public_host="${PUBLIC_HOST:-git.ents.cloud}"
docker/nginx.conf @@ -12,10 +12,13 @@ server { listen 8080; - # git smart-HTTP: any *.git path goes to stock git's own - # http-backend (`roots.single-node-hosted`: stock git stays the - # one git transport; the web process adds none of its own). - location ~ ^/[^/]+\.git(/.*)?$ { + # git smart-HTTP for the single hosted repository, addressed the + # same way any GitHub-style remote is (`git-ents/git-ents.git`) + # rather than a bespoke `/repo.git` — still exactly one + # repository (`roots.single-node-hosted`: stock git stays the + # one git transport; the web process adds none of its own), + # just no longer named like it might be more than one. + location ~ ^/git-ents/git-ents\.git(/.*)?$ { # git push can be large; never buffer it into a temp file. client_max_body_size 0; gzip off; @@ -33,6 +36,18 @@ fastcgi_param PATH "/usr/local/bin:/usr/bin:/bin"; } + # A clone URL without the trailing `.git` + # (`git clone https://git.ents.cloud/git-ents/git-ents`) redirects + # to the canonical `.git` path above. git's http client re-issues + # every request of the clone/fetch/push against the redirected + # base, not just this first one, so one redirect here is enough. + location = /git-ents/git-ents { + return 301 $scheme://$host/git-ents/git-ents.git; + } + location ~ ^/git-ents/git-ents/(.*)$ { + return 301 $scheme://$host/git-ents/git-ents.git/$1$is_args$args; + } + # The server key's public half (`git ents setup --hosted` writes # `<key>.pub`): served by nginx itself, not the web process, so # `git ents bootstrap` can discover the identity to vouch for