Some checks failed
ci / cargo test (abacus) (push) Has been cancelled
ci / cargo test (agent-runtime) (push) Has been cancelled
ci / cargo test (context-passport) (push) Has been cancelled
ci / cargo test (game-economy) (push) Has been cancelled
ci / cargo test (ledgerline) (push) Has been cancelled
ci / cargo test (mint) (push) Has been cancelled
ci / cargo test (rago) (push) Has been cancelled
ci / cargo test (relay) (push) Has been cancelled
ci / cargo test (toolgate) (push) Has been cancelled
ci / cargo test (turnstile) (push) Has been cancelled
ci / cargo test (vend) (push) Has been cancelled
ci / node suites (push) Has been cancelled
- Root cause of lead-reported "SSH push Internal Server Error" was NOT the day's gitea->rithub rename: 146 repos (incl. recoder.xyz, vcpeer) have been stuck at repository.status=1 (RepositoryBeingMigrated) since mid-November, which the engine's own internal serv-command permission API 500s on unconditionally for SSH (reads and writes), never for HTTPS. 144 verified complete on disk and flipped back to status=0 on rithub-server-postgres (box change, no repo file); 2 genuinely incomplete left untouched. - New apps/rithub-server/deploy/entrypoint-wrapper.sh, bind-mounted over the stock gitea/gitea image's own /usr/local/bin/gitea (docker-compose.yml): byte-identical passthrough for every subcommand except `serv`, where it rewrites the engine's hardcoded "Gitea:" stderr prefix to "Rithub:" -- stdout (the git pack-protocol bytes) is never touched. - New grey-cloud git.rithub.dev Caddy site + DNS record (box/Cloudflare-side, no repo file) bypasses Cloudflare's fixed ~100s proxy timeout for large pushes, same pattern as git-ssh.rithub.dev. footer.tmpl rewrites the clone box's HTTPS URL to the new host client-side, since the engine has no server-side domain split for HTTP the way it does for SSH_DOMAIN. Live-verified: SSH clone+push for caelum0x and a fresh QA account, a real ~85MB push over git.rithub.dev (succeeded, ~2min, well past Cloudflare's 100s cutoff), clone-box screenshot showing the rewritten host, full route regression clean. See plans/railyard.md RIT-OPS entry for full evidence. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
65 lines
3.0 KiB
Bash
Executable File
65 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
###############################################################################
|
|
# Rithub's drop-in replacement for the stock gitea/gitea image's own
|
|
# /usr/local/bin/gitea entrypoint wrapper.
|
|
#
|
|
# Why this exists (RIT-OPS, 2026-12-01): the engine's `serv` subcommand --
|
|
# the one `sshd`'s AuthorizedKeysCommand runs for every `git clone`/`git push`
|
|
# over SSH -- writes its own user-facing errors with a hardcoded "Gitea:"
|
|
# prefix (cmd/serv.go's fail() helper). That string is NOT driven by
|
|
# APP_NAME, any [server]/[other] ini key, or any env var -- it's a literal
|
|
# in the compiled Go binary -- so every SSH git error (even a plain "Gitea:
|
|
# Too few arguments" from a bare `ssh git@host`) leaked the underlying
|
|
# open-source engine's name to end users, including real Rithub customers.
|
|
# We don't control the Go source (official gitea/gitea image, no vendored
|
|
# fork), so we can't just patch and rebuild the binary; this wrapper is a
|
|
# stdio-safe mitigation instead: only `serv` invocations get their STDERR
|
|
# text-substituted ("Gitea" -> "Rithub") before it reaches the SSH client.
|
|
# STDOUT (the actual git pack-protocol bytes for git-upload-pack /
|
|
# git-receive-pack / git-upload-archive) is passed straight through via fd 3,
|
|
# completely untouched -- confirmed live (2026-12-01) that the engine writes
|
|
# these messages to stderr only, never stdout, so this can never corrupt a
|
|
# clone/push's binary payload. Every other subcommand (`web`, `admin`,
|
|
# `doctor`, the s6/docker-entrypoint healthchecks, etc.) hits the `else`
|
|
# branch below and is `exec`'d exactly as the stock script would have done --
|
|
# zero behavior change, same argv0-preserving `exec -a "$0"`.
|
|
#
|
|
# Mounted over the image's own /usr/local/bin/gitea via docker-compose.yml's
|
|
# `volumes:` (read-only bind mount) -- never baked into a custom image, so a
|
|
# plain `docker compose pull` + recreate still gets this for free.
|
|
###############################################################################
|
|
|
|
GITEA="/app/gitea/gitea"
|
|
WORK_DIR="/data/gitea"
|
|
CUSTOM_PATH="/data/gitea"
|
|
|
|
export GITEA_WORK_DIR="${GITEA_WORK_DIR:-$WORK_DIR}"
|
|
export GITEA_CUSTOM="${GITEA_CUSTOM:-$CUSTOM_PATH}"
|
|
|
|
is_serv=0
|
|
for a in "$@"; do
|
|
if [ "$a" = "serv" ]; then
|
|
is_serv=1
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [ "$is_serv" = "1" ]; then
|
|
# fd 3 = the real stdout (the ssh session's stdout -> git protocol bytes),
|
|
# saved before we touch stderr at all. Only stderr gets piped through sed;
|
|
# stdin is inherited normally (git pushes the pack data in over stdin).
|
|
# The image's /bin/sed is BusyBox sed, not GNU sed -- no -u (unbuffered)
|
|
# flag exists there. Not needed anyway: `serv` emits at most a couple of
|
|
# short lines then exits immediately, so BusyBox sed's default stdio
|
|
# buffering flushes on that same exit -- nothing is ever lost, just
|
|
# written at process end instead of mid-stream (irrelevant for a single
|
|
# short-lived command whose whole stderr is a line or two).
|
|
exec 3>&1
|
|
"$GITEA" $CONF_ARG "$@" 1>&3 2> >(sed 's/\bGitea\b/Rithub/g' >&2)
|
|
rc=$?
|
|
exec 3>&-
|
|
exit $rc
|
|
else
|
|
exec -a "$0" "$GITEA" $CONF_ARG "$@"
|
|
fi
|