created dev deployment

This commit is contained in:
evanpelle
2024-08-18 12:02:08 -07:00
parent 19c826d944
commit fde0f03df0
2 changed files with 33 additions and 4 deletions
+2
View File
@@ -27,11 +27,13 @@
* only send delta turns on connect/reconnect DONE 8/17/2024
* Create separate game config dev vs prod DONE 8/17/2024
* improve front page, only one game at a time every 30s DONE 8/17/2024
* create dev server DONE 8/18/2024
* BUG: boats not going to destination, coast not being recognized
* BUG: boats freeze game on path calculation
* better algorithm for name render placement
* make boats larger
* have boats not get close to shore
* Allow boats to attack TerraNullius
* make coasts look better
* add shader to dim border
* remove player.info()
+31 -4
View File
@@ -1,5 +1,29 @@
#!/bin/bash
# Check if the --env flag is provided
if [[ "$1" != "--env" ]]; then
echo "Usage: $0 --env [dev|prod]"
exit 1
fi
# Get the environment from the command line argument
ENV="$2"
# Validate the environment
if [[ "$ENV" != "dev" && "$ENV" != "prod" ]]; then
echo "Invalid environment. Use 'dev' or 'prod'."
exit 1
fi
# Set the instance name based on the environment
if [[ "$ENV" == "dev" ]]; then
INSTANCE_NAME="openfrontio-dev"
echo "[DEV] Deploying to openfront.dev"
else
INSTANCE_NAME="openfrontio-instance"
echo "[PROD] Deploying to openfront.io"
fi
# Ensure you're authenticated with Google Cloud
gcloud auth configure-docker us-central1-docker.pkg.dev
@@ -7,14 +31,17 @@ gcloud auth configure-docker us-central1-docker.pkg.dev
docker build -t openfrontio .
# Tag the new image (use a version number or 'latest')
docker tag openfrontio us-central1-docker.pkg.dev/openfrontio/openfrontio/game-server:latest
docker tag openfrontio us-central1-docker.pkg.dev/openfrontio/openfrontio/game-server:$ENV
# Push the new image to Google Container Registry
docker push us-central1-docker.pkg.dev/openfrontio/openfrontio/game-server:latest
docker push us-central1-docker.pkg.dev/openfrontio/openfrontio/game-server:$ENV
# Prune Docker system on the instance
gcloud compute ssh $INSTANCE_NAME --zone us-central1-a --command 'docker system prune -f -a'
# Update the GCE instance with the new container image
gcloud compute instances update-container openfrontio-instance \
gcloud compute instances update-container $INSTANCE_NAME \
--container-image us-central1-docker.pkg.dev/openfrontio/openfrontio/game-server:latest \
--zone=us-central1-a
echo "Deployment complete. New version should be live soon."
echo "Deployment to $ENV environment complete. New version should be live soon on $INSTANCE_NAME."