From abec82a08f26204bd2496dfe192f8148dd7c0af0 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 4 Jul 2026 17:14:34 -0400 Subject: [PATCH] Fix production deployment for public site routing - pass NEXT_PUBLIC_CARPLACE_URL into the production Docker build - keep NEXT_PUBLIC_STOREFRONT_URL as a fallback for existing secrets - run the production deploy script after building the image - allow deploys to reuse an existing VPS production env file - include homepage in production deploy, pull, and health checks - allow deploy to use a release image already built locally on the VPS --- .gitea/workflows/build-and-deploy.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/build-and-deploy.yml b/.gitea/workflows/build-and-deploy.yml index 3cff92e..c796321 100644 --- a/.gitea/workflows/build-and-deploy.yml +++ b/.gitea/workflows/build-and-deploy.yml @@ -316,18 +316,21 @@ jobs: echo "::error::VPS_IP secret or DEPLOY_SSH_HOST is required" exit 1 fi - if [ -z "$ENV_DOCKER_PRODUCTION_B64" ]; then - echo "::error::ENV_DOCKER_PRODUCTION_B64 is required to deploy the production stack" - exit 1 - fi SSH_OPTIONS="-i $HOME/.ssh/id_rsa -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=$HOME/.ssh/known_hosts" ENV_DOCKER_PRODUCTION_B64_CLEAN="$(printf '%s' "$ENV_DOCKER_PRODUCTION_B64" | tr -d '[:space:]')" REGISTRY_PASSWORD_B64="$(printf '%s' "$REGISTRY_PASSWORD" | base64 | tr -d '\n')" ssh $SSH_OPTIONS "${{ secrets.VPS_USER }}@$VPS_HOST" " set -e mkdir -p '$DEPLOY_ROOT' - printf '%s' '$ENV_DOCKER_PRODUCTION_B64_CLEAN' | base64 -d > '$DEPLOY_ROOT/.env.docker.production' - chmod 600 '$DEPLOY_ROOT/.env.docker.production' + if [ -n '$ENV_DOCKER_PRODUCTION_B64_CLEAN' ]; then + printf '%s' '$ENV_DOCKER_PRODUCTION_B64_CLEAN' | base64 -d > '$DEPLOY_ROOT/.env.docker.production' + chmod 600 '$DEPLOY_ROOT/.env.docker.production' + elif [ ! -f '$DEPLOY_ROOT/.env.docker.production' ]; then + echo 'ENV_DOCKER_PRODUCTION_B64 is not set and $DEPLOY_ROOT/.env.docker.production does not exist on the VPS' >&2 + exit 1 + else + echo 'Using existing $DEPLOY_ROOT/.env.docker.production on the VPS' + fi cd '$REMOTE_BUILD_DIR' export APP_IMAGE='$DEPLOY_REGISTRY_HOST/$IMAGE_REPOSITORY' export IMAGE_TAG='$IMAGE_TAG'