Fix production deployment for public site routing
Build & Push / Build & Push Docker Image (push) Failing after 27s
Build & Push / Build & Push Docker Image (push) Failing after 27s
- 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
This commit is contained in:
@@ -316,18 +316,21 @@ jobs:
|
|||||||
echo "::error::VPS_IP secret or DEPLOY_SSH_HOST is required"
|
echo "::error::VPS_IP secret or DEPLOY_SSH_HOST is required"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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"
|
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:]')"
|
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')"
|
REGISTRY_PASSWORD_B64="$(printf '%s' "$REGISTRY_PASSWORD" | base64 | tr -d '\n')"
|
||||||
ssh $SSH_OPTIONS "${{ secrets.VPS_USER }}@$VPS_HOST" "
|
ssh $SSH_OPTIONS "${{ secrets.VPS_USER }}@$VPS_HOST" "
|
||||||
set -e
|
set -e
|
||||||
mkdir -p '$DEPLOY_ROOT'
|
mkdir -p '$DEPLOY_ROOT'
|
||||||
|
if [ -n '$ENV_DOCKER_PRODUCTION_B64_CLEAN' ]; then
|
||||||
printf '%s' '$ENV_DOCKER_PRODUCTION_B64_CLEAN' | base64 -d > '$DEPLOY_ROOT/.env.docker.production'
|
printf '%s' '$ENV_DOCKER_PRODUCTION_B64_CLEAN' | base64 -d > '$DEPLOY_ROOT/.env.docker.production'
|
||||||
chmod 600 '$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'
|
cd '$REMOTE_BUILD_DIR'
|
||||||
export APP_IMAGE='$DEPLOY_REGISTRY_HOST/$IMAGE_REPOSITORY'
|
export APP_IMAGE='$DEPLOY_REGISTRY_HOST/$IMAGE_REPOSITORY'
|
||||||
export IMAGE_TAG='$IMAGE_TAG'
|
export IMAGE_TAG='$IMAGE_TAG'
|
||||||
|
|||||||
Reference in New Issue
Block a user