From 32e8d9f046a8d3b664f718879424bb4d99241c8a Mon Sep 17 00:00:00 2001 From: evanpelle Date: Wed, 12 Mar 2025 10:40:51 -0700 Subject: [PATCH] update deployment: add alt deployment (#223) --- cloudbuild.yaml | 38 -------------------------------------- deploy.sh | 11 ++++++++--- update.sh | 1 - 3 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 cloudbuild.yaml diff --git a/cloudbuild.yaml b/cloudbuild.yaml deleted file mode 100644 index d5c109713..000000000 --- a/cloudbuild.yaml +++ /dev/null @@ -1,38 +0,0 @@ -steps: - # Build the Docker image - - name: "gcr.io/cloud-builders/docker" - args: - [ - "build", - "-t", - "us-central1-docker.pkg.dev/$PROJECT_ID/openfrontio/game-server:${TAG_NAME}-${SHORT_SHA}", - "--build-arg", - "GAME_ENV=${_GAME_ENV}", - ".", - ] - # Push the image to Artifact Registry - - name: "gcr.io/cloud-builders/docker" - args: - [ - "push", - "us-central1-docker.pkg.dev/$PROJECT_ID/openfrontio/game-server:${TAG_NAME}-${SHORT_SHA}", - ] - # Update the GCE instance with the new container image - - name: "gcr.io/cloud-builders/gcloud" - args: - - "compute" - - "instances" - - "update-container" - - "${_INSTANCE_NAME}" - - "--container-image" - - "us-central1-docker.pkg.dev/$PROJECT_ID/openfrontio/game-server:${TAG_NAME}-${SHORT_SHA}" - - "--zone=us-central1-a" -substitutions: - _INSTANCE_NAME: "openfrontio-dev-instance" - _GAME_ENV: "preprod" # Default to preprod - TAG_NAME: "dev" -options: - substitutionOption: "ALLOW_LOOSE" - logging: CLOUD_LOGGING_ONLY -images: - - "us-central1-docker.pkg.dev/$PROJECT_ID/openfrontio/game-server:${TAG_NAME}-${SHORT_SHA}" diff --git a/deploy.sh b/deploy.sh index dba9fffc1..f8deed9e9 100755 --- a/deploy.sh +++ b/deploy.sh @@ -21,9 +21,9 @@ if [ -f .env ]; then fi # Check command line argument -if [ $# -ne 1 ] || ([ "$1" != "staging" ] && [ "$1" != "prod" ]); then - echo "Error: Please specify environment (staging or prod)" - echo "Usage: $0 [staging|prod]" +if [ $# -ne 1 ] || ([ "$1" != "staging" ] && [ "$1" != "prod" ] && [ "$1" != "alt" ]); then + echo "Error: Please specify environment (staging, prod, or alt)" + echo "Usage: $0 [staging|prod|alt]" exit 1 fi @@ -39,6 +39,11 @@ if [ "$ENV" == "staging" ]; then print_header "DEPLOYING TO STAGING ENVIRONMENT" SERVER_HOST=$SERVER_HOST_STAGING DOCKER_REPO=$DOCKER_REPO_STAGING +elif [ "$ENV" == "alt" ]; then + print_header "DEPLOYING TO ALT ENVIRONMENT" + SERVER_HOST=$SERVER_HOST_ALT + DOCKER_REPO=$DOCKER_REPO_PROD # Uses prod Docker repo for alt environment + ENV="prod" else print_header "DEPLOYING TO PRODUCTION ENVIRONMENT" SERVER_HOST=$SERVER_HOST_PROD diff --git a/update.sh b/update.sh index 9df8191c1..dc8f514d9 100755 --- a/update.sh +++ b/update.sh @@ -85,7 +85,6 @@ echo "Starting new container for ${ENV} environment with Loki logging..." docker run -d -p 80:80 \ --restart=always \ $VOLUME_MOUNTS \ - $NETWORK_FLAGS \ --env GAME_ENV=${ENV} \ --env-file /root/.env \ --name ${CONTAINER_NAME} \