Point the stage checkout at Gitea and keep its host ports off prod Reverb.
CI / test (push) Successful in 34s
CI / build-and-push (push) Successful in 6s
CI / deploy-stage (push) Skipped
CI / deploy (push) Successful in 12s

Cloning from the prod directory made SHA fetches fail, and APP_HOST_PORT 18180 collided with production Reverb.
This commit is contained in:
ben
2026-08-13 18:40:06 +02:00
parent 3601ce8b6f
commit 1898be4def
4 changed files with 42 additions and 11 deletions
+8 -9
View File
@@ -8,8 +8,8 @@ GITEA_DIR="${GITEA_DIR:-${HOME}/gitea}"
REPO_OWNER="${REPO_OWNER:-ben}"
REPO_NAME="${REPO_NAME:-AndyTranscribe}"
REGISTRY_HOST="${REGISTRY_HOST:-gitea.z00.nu}"
PROD_PATH="${PROD_PATH:-${HOME}/andyTranscibe}"
STAGE_PATH="${STAGE_PATH:-${HOME}/andyTranscibe-stage}"
GITEA_REPO_URL="https://${REGISTRY_HOST}/${REPO_OWNER}/${REPO_NAME}.git"
STAGE_URL="${STAGE_URL:-https://stage.transcribe.z00.nu}"
REVERB_PUBLIC_HOST="${REVERB_PUBLIC_HOST:-reverb.stage.transcribe.z00.nu}"
CONTAINER_PREFIX="${CONTAINER_PREFIX:-andytranscribe-stage}"
@@ -59,15 +59,13 @@ fi
if [[ ! -d "${STAGE_PATH}/.git" ]]; then
mkdir -p "$(dirname "${STAGE_PATH}")"
if [[ -d "${PROD_PATH}/.git" ]]; then
git clone "${PROD_PATH}" "${STAGE_PATH}"
else
git clone "https://${REGISTRY_HOST}/${REPO_OWNER}/${REPO_NAME}.git" "${STAGE_PATH}"
fi
git clone "${GITEA_REPO_URL}" "${STAGE_PATH}"
fi
(
cd "${STAGE_PATH}"
# Never fetch from the prod checkout; CI deploys by SHA against this origin.
git remote set-url origin "${GITEA_REPO_URL}"
git fetch origin || true
if git rev-parse --verify origin/stage >/dev/null 2>&1; then
git checkout stage
@@ -103,9 +101,10 @@ if [[ ! -f "${STAGE_PATH}/.env" ]]; then
upsert_env "${STAGE_PATH}/.env" "APP_KEY" "base64:$(openssl rand -base64 32)"
upsert_env "${STAGE_PATH}/.env" "APP_URL" "${STAGE_URL}"
upsert_env "${STAGE_PATH}/.env" "PUBLIC_APP_URL" "${STAGE_URL}"
upsert_env "${STAGE_PATH}/.env" "APP_HOST_PORT" "18180"
upsert_env "${STAGE_PATH}/.env" "REVERB_HOST_PORT" "18181"
upsert_env "${STAGE_PATH}/.env" "WHISPER_HOST_PORT" "18190"
# Prod already binds 18080 (app), 18180 (reverb), and 18090 (whisper).
upsert_env "${STAGE_PATH}/.env" "APP_HOST_PORT" "18280"
upsert_env "${STAGE_PATH}/.env" "REVERB_HOST_PORT" "18281"
upsert_env "${STAGE_PATH}/.env" "WHISPER_HOST_PORT" "18290"
upsert_env "${STAGE_PATH}/.env" "REVERB_APP_ID" "$(openssl rand -hex 8)"
upsert_env "${STAGE_PATH}/.env" "REVERB_APP_KEY" "$(openssl rand -hex 16)"
upsert_env "${STAGE_PATH}/.env" "REVERB_APP_SECRET" "$(openssl rand -hex 20)"