From c9b8de1ee9fc30906750cd3d13393643dfd9b90b Mon Sep 17 00:00:00 2001 From: Levi Date: Fri, 7 Jun 2024 10:16:17 +0200 Subject: [PATCH] Add snowflake configuration to wand (#34) * Change url of wns server * Add snowflake submodule * Add snowflake docker deployment * Update submodule * Update submodule * Refactor snowflake compose * Fast-forward snowflake submodule * Add snowflake configuration to `.env` * Set force start for regular game to `False` * Add host & port configuration * Add wns url for language-specific sites * Add snowflake to submodule sync * Add snowflake configuration to install script --- .env | 47 +++++++++++++++++++ .github/workflows/submodule-sync.yml | 1 + .gitmodules | 5 +- docker-compose.yml | 26 ++++++++++ install.sh | 16 ++++++- snowflake | 1 + .../vanilla-media/play/es/index.html.template | 2 +- .../vanilla-media/play/fr/index.html.template | 2 +- .../vanilla-media/play/index.html.template | 2 +- .../vanilla-media/play/pt/index.html.template | 2 +- 10 files changed, 97 insertions(+), 7 deletions(-) create mode 160000 snowflake diff --git a/.env b/.env index de71e54..b6de755 100644 --- a/.env +++ b/.env @@ -113,3 +113,50 @@ WEB_SENDGRID_KEY= GAME_ADDRESS=127.0.0.1 GAME_LOGIN_PORT=6112 + +############################################## +# Snowflake (Card-Jitsu Snow) +############################################## +# +# SNOWFLAKE_HOST +# -------------- +# This is similar to the GAME_ADDRESS but for +# the Card-Jitsu Snow game server. +# +# SNOWFLAKE_PORT +# -------------- +# The port where the Card-Jitsu Snow server +# is running. Usually fine to leave this as +# default. +# +# APPLY_WINDOWMANAGER_OFFSET +# -------------------------- +# If you have issues with the game being in a +# wierd position, try setting this to True. +# +# ALLOW_FORCESTART_SNOW +# --------------------- +# Allows players to force-start a regular +# match. +# +# ALLOW_FORCESTART_TUSK +# --------------------- +# Allows players to force-start a tusk +# battle. +# +# MATCHMAKING_TIMEOUT +# ------------------- +# The amount of time in seconds for a +# force-start to happen +# +############################################## + +SNOWFLAKE_HOST=127.0.0.1 +SNOWFLAKE_PORT=7002 + +APPLY_WINDOWMANAGER_OFFSET=False + +ALLOW_FORCESTART_SNOW=False +ALLOW_FORCESTART_TUSK=True + +MATCHMAKING_TIMEOUT=30 diff --git a/.github/workflows/submodule-sync.yml b/.github/workflows/submodule-sync.yml index 19ad972..930ea48 100644 --- a/.github/workflows/submodule-sync.yml +++ b/.github/workflows/submodule-sync.yml @@ -25,6 +25,7 @@ jobs: git update-index --cacheinfo 160000,$(git ls-remote https://git.solero.me/solero/legacy-media.git/ HEAD | awk '{ print $1}'),legacy-media git update-index --cacheinfo 160000,$(git ls-remote https://github.com/solero/houdini.git/ HEAD | awk '{ print $1}'),houdini git update-index --cacheinfo 160000,$(git ls-remote https://github.com/solero/dash.git/ HEAD | awk '{ print $1}'),dash + git update-index --cacheinfo 160000,$(git ls-remote https://github.com/lekuruu/snowflake.git/ HEAD | awk '{ print $1}'),snowflake - name: Commit update run: | diff --git a/.gitmodules b/.gitmodules index 126cdbf..934fbdb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,4 +9,7 @@ url = https://git.solero.me/solero/legacy-media [submodule "vanilla-media"] path = vanilla-media - url = https://git.solero.me/solero/vanilla-media \ No newline at end of file + url = https://git.solero.me/solero/vanilla-media +[submodule "snowflake"] + path = snowflake + url = https://github.com/Lekuruu/snowflake.git diff --git a/docker-compose.yml b/docker-compose.yml index e71fc7b..6accccd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -204,6 +204,32 @@ services: "-template", "/usr/src/dash/config.py.template:/usr/src/dash/config.py", "python", "bootstrap.py"] command: ["-c", "config.py"] + snowflake: + build: ./snowflake + restart: always + networks: + - wand + ports: + - ${SNOWFLAKE_HOST}:${SNOWFLAKE_PORT}:${SNOWFLAKE_PORT} + env_file: + - .env + environment: + - POSTGRES_HOST=db + - REDIS_HOST=redis + - MEDIA_LOCATION=${WEB_VANILLA_MEDIA} + - PORT=${SNOWFLAKE_PORT} + volumes: + - ./snowflake:/usr/src/snowflake + - ./.env:/usr/src/snowflake/.env + depends_on: + - db + - redis + - dash + links: + - db:db + - redis:redis + - houdini_login:login + entrypoint: ["dockerize", "-wait", "tcp://login:${GAME_LOGIN_PORT}", "python", "./main.py"] networks: wand: diff --git a/install.sh b/install.sh index 912d2ec..39fa16c 100644 --- a/install.sh +++ b/install.sh @@ -59,9 +59,10 @@ git clone --recurse-submodules https://github.com/solero/wand && cd wand echo "Done Downloading the game files." sudo rm -r .env -echo "# database +echo "# Database POSTGRES_USER=postgres POSTGRES_PASSWORD=$dbpass + # Web WEB_PORT=80 WEB_HOSTNAME=$hostname @@ -79,7 +80,18 @@ WEB_SENDGRID_KEY= # Game GAME_ADDRESS=$ipadd -GAME_LOGIN_PORT=6112" > .env +GAME_LOGIN_PORT=6112 + +# Snowflake +SNOWFLAKE_HOST=$ipadd +SNOWFLAKE_PORT=7002 + +APPLY_WINDOWMANAGER_OFFSET=False + +ALLOW_FORCESTART_SNOW=False +ALLOW_FORCESTART_TUSK=True + +MATCHMAKING_TIMEOUT=30" > .env echo "Done!" diff --git a/snowflake b/snowflake new file mode 160000 index 0000000..648a618 --- /dev/null +++ b/snowflake @@ -0,0 +1 @@ +Subproject commit 648a6184e41311c49dfc66bbdba0e87c38efcf6e diff --git a/templates/vanilla-media/play/es/index.html.template b/templates/vanilla-media/play/es/index.html.template index f646b7b..980e851 100644 --- a/templates/vanilla-media/play/es/index.html.template +++ b/templates/vanilla-media/play/es/index.html.template @@ -130,7 +130,7 @@ window.CKEDITOR_BASEPATH = '/sites/all/libraries/ckeditor/' diff --git a/templates/vanilla-media/play/fr/index.html.template b/templates/vanilla-media/play/fr/index.html.template index b6d8a4b..6e3ac1b 100644 --- a/templates/vanilla-media/play/fr/index.html.template +++ b/templates/vanilla-media/play/fr/index.html.template @@ -129,7 +129,7 @@ window.CKEDITOR_BASEPATH = '/sites/all/libraries/ckeditor/' diff --git a/templates/vanilla-media/play/index.html.template b/templates/vanilla-media/play/index.html.template index 68715b8..cd65ebd 100644 --- a/templates/vanilla-media/play/index.html.template +++ b/templates/vanilla-media/play/index.html.template @@ -127,7 +127,7 @@ window.CKEDITOR_BASEPATH = '/sites/all/libraries/ckeditor/' diff --git a/templates/vanilla-media/play/pt/index.html.template b/templates/vanilla-media/play/pt/index.html.template index 7dc79a2..49f59c4 100644 --- a/templates/vanilla-media/play/pt/index.html.template +++ b/templates/vanilla-media/play/pt/index.html.template @@ -129,7 +129,7 @@ window.CKEDITOR_BASEPATH = '/sites/all/libraries/ckeditor/'