update deployment: add alt deployment (#223)

This commit is contained in:
evanpelle
2025-03-12 10:40:51 -07:00
committed by Evan
parent 316129b70b
commit 32e8d9f046
3 changed files with 8 additions and 42 deletions
-38
View File
@@ -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}"
+8 -3
View File
@@ -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
-1
View File
@@ -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} \