docker: serve the hosted repo at git-ents/git-ents.git, not /repo.git
commit
5b6eb34docker: 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.
Reviews
No reviews of this commit yet — record a verdict below.
Start a review
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