From 8993d40a84470012294ffe3d2f9b6735c39bdf0a Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Mon, 8 Apr 2024 12:58:28 -0300 Subject: [PATCH 1/8] Removed RELEASE workflow input on GitHub Actions. --- .github/workflows/arena-brazil-testing-deploy.yml | 12 +----------- .github/workflows/arena-europe-testing-deploy.yml | 12 +----------- .github/workflows/loadtest-brazil-client-deploy.yml | 7 ++----- .github/workflows/loadtest-brazil-server-deploy.yml | 12 +----------- .github/workflows/loadtest-europe-client-deploy.yml | 7 ++----- .github/workflows/loadtest-europe-server-deploy.yml | 12 +----------- devops/deploy.sh | 7 ------- 7 files changed, 8 insertions(+), 61 deletions(-) diff --git a/.github/workflows/arena-brazil-testing-deploy.yml b/.github/workflows/arena-brazil-testing-deploy.yml index 2df6338a6..1526ebb6c 100644 --- a/.github/workflows/arena-brazil-testing-deploy.yml +++ b/.github/workflows/arena-brazil-testing-deploy.yml @@ -1,16 +1,6 @@ name: Deploy to Brazil Arena testing on: workflow_dispatch: - inputs: - release: - type: choice - description: What release to deploy - options: - - game_backend - - arena - - arena_load_test - - game_client - required: true jobs: build-deploy: @@ -54,7 +44,7 @@ jobs: SSH_HOST: ${{ vars.TS_HOST }} SSH_USERNAME: ${{ vars.SSH_USERNAME }} MIX_ENV: ${{ vars.MIX_ENV }} - RELEASE: ${{ inputs.release }} + RELEASE: arena PHX_SERVER: ${{ vars.PHX_SERVER }} PHX_HOST: ${{ vars.HOST }} PORT: ${{ vars.ARENA_PORT }} diff --git a/.github/workflows/arena-europe-testing-deploy.yml b/.github/workflows/arena-europe-testing-deploy.yml index f76a1cc61..ee95a802a 100644 --- a/.github/workflows/arena-europe-testing-deploy.yml +++ b/.github/workflows/arena-europe-testing-deploy.yml @@ -1,16 +1,6 @@ name: Deploy to Europe Arena testing on: workflow_dispatch: - inputs: - release: - type: choice - description: What release to deploy - options: - - game_backend - - arena - - arena_load_test - - game_client - required: true jobs: build-deploy: @@ -54,7 +44,7 @@ jobs: SSH_HOST: ${{ vars.TS_HOST }} SSH_USERNAME: ${{ vars.SSH_USERNAME }} MIX_ENV: ${{ vars.MIX_ENV }} - RELEASE: ${{ inputs.release }} + RELEASE: arena PHX_SERVER: ${{ vars.PHX_SERVER }} PHX_HOST: ${{ vars.HOST }} PORT: ${{ vars.ARENA_PORT }} diff --git a/.github/workflows/loadtest-brazil-client-deploy.yml b/.github/workflows/loadtest-brazil-client-deploy.yml index dff7a3a14..ed54aa9ba 100644 --- a/.github/workflows/loadtest-brazil-client-deploy.yml +++ b/.github/workflows/loadtest-brazil-client-deploy.yml @@ -6,18 +6,15 @@ on: type: choice description: What release to deploy options: - - game_backend - - arena - arena_load_test - - game_client - bot_manager required: true target_server: type: choice description: Loadtest target server options: - - Brazil - - Europe + - loadtest-brazil-server.curseofmirra.com + - loadtest-europe-client.curseofmirra.com jobs: build-deploy: diff --git a/.github/workflows/loadtest-brazil-server-deploy.yml b/.github/workflows/loadtest-brazil-server-deploy.yml index 1ddc68e92..ab289e138 100644 --- a/.github/workflows/loadtest-brazil-server-deploy.yml +++ b/.github/workflows/loadtest-brazil-server-deploy.yml @@ -1,16 +1,6 @@ name: Deploy to Brazil Loadtest Server on: workflow_dispatch: - inputs: - release: - type: choice - description: What release to deploy - options: - - game_backend - - arena - - arena_load_test - - game_client - required: true jobs: build-deploy: @@ -54,7 +44,7 @@ jobs: SSH_HOST: ${{ vars.TS_LOADTEST_SERVER_HOST }} SSH_USERNAME: ${{ vars.SSH_USERNAME }} MIX_ENV: ${{ vars.MIX_ENV }} - RELEASE: ${{ inputs.release }} + RELEASE: arena PHX_SERVER: ${{ vars.PHX_SERVER }} PHX_HOST: ${{ vars.LOADTEST_SERVER_HOST }} PORT: ${{ vars.ARENA_PORT }} diff --git a/.github/workflows/loadtest-europe-client-deploy.yml b/.github/workflows/loadtest-europe-client-deploy.yml index 85ae93de1..132477727 100644 --- a/.github/workflows/loadtest-europe-client-deploy.yml +++ b/.github/workflows/loadtest-europe-client-deploy.yml @@ -6,18 +6,15 @@ on: type: choice description: What release to deploy options: - - game_backend - - arena - arena_load_test - - game_client - bot_manager required: true target_server: type: choice description: Loadtest target server options: - - Brazil - - Europe + - loadtest-brazil-server.curseofmirra.com + - loadtest-europe-server.curseofmirra.com jobs: build-deploy: diff --git a/.github/workflows/loadtest-europe-server-deploy.yml b/.github/workflows/loadtest-europe-server-deploy.yml index 645a3ba94..f67f04eb3 100644 --- a/.github/workflows/loadtest-europe-server-deploy.yml +++ b/.github/workflows/loadtest-europe-server-deploy.yml @@ -1,16 +1,6 @@ name: Deploy to Europe Loadtest Server on: workflow_dispatch: - inputs: - release: - type: choice - description: What release to deploy - options: - - game_backend - - arena - - arena_load_test - - game_client - required: true jobs: build-deploy: @@ -54,7 +44,7 @@ jobs: SSH_HOST: ${{ vars.TS_LOADTEST_SERVER_HOST }} SSH_USERNAME: ${{ vars.SSH_USERNAME }} MIX_ENV: ${{ vars.MIX_ENV }} - RELEASE: ${{ inputs.release }} + RELEASE: arena PHX_SERVER: ${{ vars.PHX_SERVER }} PHX_HOST: ${{ vars.LOADTEST_SERVER_HOST }} PORT: ${{ vars.ARENA_PORT }} diff --git a/devops/deploy.sh b/devops/deploy.sh index e1bda7cd7..43d4c4aee 100755 --- a/devops/deploy.sh +++ b/devops/deploy.sh @@ -26,13 +26,6 @@ mv /tmp/mirra_backend $HOME/ mkdir -p $HOME/.config/systemd/user/ -existing_service=$(ls $HOME/.config/systemd/user/*.service 2>/dev/null) - -if [[ $(wc -l <<<$existing_service) > 1 || "$(basename ${existing_service})" != "${RELEASE}.service" ]]; then - echo "The release you are trying to deploy is not the same as the installed" - exit 1 -fi - cat <$HOME/.config/systemd/user/${RELEASE}.service [Unit] Description=$RELEASE From 9214b0dfadf1959017e1a4050bd8c04b9db082dc Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Mon, 8 Apr 2024 15:00:31 -0300 Subject: [PATCH 2/8] Removed [Install] directive. --- devops/deploy.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/devops/deploy.sh b/devops/deploy.sh index 43d4c4aee..cd2d8a72b 100755 --- a/devops/deploy.sh +++ b/devops/deploy.sh @@ -38,9 +38,6 @@ ExecReload=/bin/kill -HUP KillSignal=SIGTERM EnvironmentFile=$HOME/.env LimitNOFILE=4000 - -[Install] -WantedBy=multi-user.target EOF systemctl --user enable $RELEASE From a9e5fdff06b02b9956cb3062c6e39045675ced8f Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Mon, 8 Apr 2024 15:17:27 -0300 Subject: [PATCH 3/8] Changed [Install] to default.target. --- devops/deploy.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devops/deploy.sh b/devops/deploy.sh index cd2d8a72b..190d23c72 100755 --- a/devops/deploy.sh +++ b/devops/deploy.sh @@ -38,6 +38,9 @@ ExecReload=/bin/kill -HUP KillSignal=SIGTERM EnvironmentFile=$HOME/.env LimitNOFILE=4000 + +[Install] +WantedBy=default.target EOF systemctl --user enable $RELEASE From 2e8f369f355f0261498bca7273266a493c108e3a Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Tue, 9 Apr 2024 12:09:04 -0300 Subject: [PATCH 4/8] Fully refactored workflows. --- .../workflows/arena-brazil-testing-deploy.yml | 8 +- .../workflows/arena-europe-testing-deploy.yml | 8 +- .../central-brazil-testing-deploy.yml | 73 +++++++++++++++++++ .../central-europe-testing-deploy.yml | 73 +++++++++++++++++++ .../loadtest-brazil-client-deploy.yml | 4 +- .../loadtest-brazil-server-deploy.yml | 4 +- .../loadtest-europe-client-deploy.yml | 4 +- .../loadtest-europe-server-deploy.yml | 4 +- 8 files changed, 162 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/central-brazil-testing-deploy.yml create mode 100644 .github/workflows/central-europe-testing-deploy.yml diff --git a/.github/workflows/arena-brazil-testing-deploy.yml b/.github/workflows/arena-brazil-testing-deploy.yml index 1526ebb6c..b4c8130ef 100644 --- a/.github/workflows/arena-brazil-testing-deploy.yml +++ b/.github/workflows/arena-brazil-testing-deploy.yml @@ -23,25 +23,25 @@ jobs: - name: Create ssh private key file from env var env: SSH_KEY: ${{ secrets.SSH_KEY }} - TS_HOST: ${{ vars.TS_HOST }} + SSH_HOST: ${{ vars.TS_ARENA_HOST }} run: | set -ex mkdir -p ~/.ssh/ sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519 chmod 400 ~/.ssh/id_ed25519 - retries=5; until ssh-keyscan $TS_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done + retries=5; until ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done - name: Copy deploy script env: SSH_USERNAME: ${{ vars.SSH_USERNAME }} - SSH_HOST: ${{ vars.TS_HOST }} + SSH_HOST: ${{ vars.TS_ARENA_HOST }} run: | set -ex rsync -avz --mkpath devops/deploy.sh ${SSH_USERNAME}@${SSH_HOST}:/home/${SSH_USERNAME}/deploy-script/ - name: Execute deploy script env: - SSH_HOST: ${{ vars.TS_HOST }} + SSH_HOST: ${{ vars.TS_ARENA_HOST }} SSH_USERNAME: ${{ vars.SSH_USERNAME }} MIX_ENV: ${{ vars.MIX_ENV }} RELEASE: arena diff --git a/.github/workflows/arena-europe-testing-deploy.yml b/.github/workflows/arena-europe-testing-deploy.yml index ee95a802a..e9763fcfd 100644 --- a/.github/workflows/arena-europe-testing-deploy.yml +++ b/.github/workflows/arena-europe-testing-deploy.yml @@ -23,25 +23,25 @@ jobs: - name: Create ssh private key file from env var env: SSH_KEY: ${{ secrets.SSH_KEY }} - TS_HOST: ${{ vars.TS_HOST }} + SSH_HOST: ${{ vars.TS_ARENA_HOST }} run: | set -ex mkdir -p ~/.ssh/ sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519 chmod 400 ~/.ssh/id_ed25519 - retries=5; until ssh-keyscan $TS_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done + retries=5; until ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done - name: Copy deploy script env: SSH_USERNAME: ${{ vars.SSH_USERNAME }} - SSH_HOST: ${{ vars.TS_HOST }} + SSH_HOST: ${{ vars.TS_ARENA_HOST }} run: | set -ex rsync -avz --mkpath devops/deploy.sh ${SSH_USERNAME}@${SSH_HOST}:/home/${SSH_USERNAME}/deploy-script/ - name: Execute deploy script env: - SSH_HOST: ${{ vars.TS_HOST }} + SSH_HOST: ${{ vars.TS_ARENA_HOST }} SSH_USERNAME: ${{ vars.SSH_USERNAME }} MIX_ENV: ${{ vars.MIX_ENV }} RELEASE: arena diff --git a/.github/workflows/central-brazil-testing-deploy.yml b/.github/workflows/central-brazil-testing-deploy.yml new file mode 100644 index 000000000..d4c1b6ba4 --- /dev/null +++ b/.github/workflows/central-brazil-testing-deploy.yml @@ -0,0 +1,73 @@ +name: Deploy to Brazil Central testing +on: + workflow_dispatch: + +jobs: + build-deploy: + name: Build and deploy to Brazil testing + runs-on: ubuntu-latest + environment: + name: testing-brazil + url: https://central-europe-testing.curseofmirra.com/ + + steps: + - uses: actions/checkout@v4 + + - name: Tailscale + uses: tailscale/github-action@v2 + with: + oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} + oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} + tags: tag:ci + + - name: Create ssh private key file from env var + env: + SSH_KEY: ${{ secrets.SSH_KEY }} + SSH_HOST: ${{ vars.TS_CENTRAL_HOST }} + run: | + set -ex + mkdir -p ~/.ssh/ + sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519 + chmod 400 ~/.ssh/id_ed25519 + retries=5; until ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done + + - name: Copy deploy script + env: + SSH_USERNAME: ${{ vars.SSH_USERNAME }} + SSH_HOST: ${{ vars.TS_CENTRAL_HOST }} + run: | + set -ex + rsync -avz --mkpath devops/deploy.sh ${SSH_USERNAME}@${SSH_HOST}:/home/${SSH_USERNAME}/deploy-script/ + + - name: Execute deploy script + env: + SSH_HOST: ${{ vars.TS_CENTRAL_HOST }} + SSH_USERNAME: ${{ vars.SSH_USERNAME }} + MIX_ENV: ${{ vars.MIX_ENV }} + RELEASE: game_backend # Change to central_backend in the future. + PHX_SERVER: ${{ vars.PHX_SERVER }} + PHX_HOST: ${{ vars.HOST }} + PORT: ${{ vars.ARENA_PORT }} + BOT_MANAGER_PORT: ${{ vars.BOT_MANAGER_PORT }} + BOT_MANAGER_HOST: ${{ vars.LOADTEST_CLIENT_HOST }} + DATABASE_URL: ${{ secrets.DATABASE_URL }} + SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} + NEWRELIC_APP_NAME: ${{ vars.NEWRELIC_APP_NAME }} + NEWRELIC_KEY: ${{ secrets.NEWRELIC_KEY }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + run: | + set -ex + ssh ${SSH_USERNAME}@${SSH_HOST} \ + BRANCH_NAME=${BRANCH_NAME} \ + MIX_ENV=${MIX_ENV} \ + RELEASE=${RELEASE} \ + PHX_SERVER=${PHX_SERVER} \ + PHX_HOST=${PHX_HOST} \ + PORT=${PORT} \ + BOT_MANAGER_PORT=${BOT_MANAGER_PORT} \ + BOT_MANAGER_HOST=${BOT_MANAGER_HOST} \ + DATABASE_URL=${DATABASE_URL} \ + SECRET_KEY_BASE=${SECRET_KEY_BASE} \ + NEWRELIC_APP_NAME=${NEWRELIC_APP_NAME} \ + NEWRELIC_KEY=${NEWRELIC_KEY} \ + /home/${SSH_USERNAME}/deploy-script/deploy.sh diff --git a/.github/workflows/central-europe-testing-deploy.yml b/.github/workflows/central-europe-testing-deploy.yml new file mode 100644 index 000000000..e598a66ea --- /dev/null +++ b/.github/workflows/central-europe-testing-deploy.yml @@ -0,0 +1,73 @@ +name: Deploy to Europe Central testing +on: + workflow_dispatch: + +jobs: + build-deploy: + name: Build and deploy to Europe testing + runs-on: ubuntu-latest + environment: + name: testing-europe + url: https://central-europe-testing.curseofmirra.com/ + + steps: + - uses: actions/checkout@v4 + + - name: Tailscale + uses: tailscale/github-action@v2 + with: + oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} + oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} + tags: tag:ci + + - name: Create ssh private key file from env var + env: + SSH_KEY: ${{ secrets.SSH_KEY }} + SSH_HOST: ${{ vars.TS_CENTRAL_HOST }} + run: | + set -ex + mkdir -p ~/.ssh/ + sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519 + chmod 400 ~/.ssh/id_ed25519 + retries=5; until ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done + + - name: Copy deploy script + env: + SSH_USERNAME: ${{ vars.SSH_USERNAME }} + SSH_HOST: ${{ vars.TS_CENTRAL_HOST }} + run: | + set -ex + rsync -avz --mkpath devops/deploy.sh ${SSH_USERNAME}@${SSH_HOST}:/home/${SSH_USERNAME}/deploy-script/ + + - name: Execute deploy script + env: + SSH_HOST: ${{ vars.TS_CENTRAL_HOST }} + SSH_USERNAME: ${{ vars.SSH_USERNAME }} + MIX_ENV: ${{ vars.MIX_ENV }} + RELEASE: game_backend # Change to central_backend in the future. + PHX_SERVER: ${{ vars.PHX_SERVER }} + PHX_HOST: ${{ vars.HOST }} + PORT: ${{ vars.ARENA_PORT }} + BOT_MANAGER_PORT: ${{ vars.BOT_MANAGER_PORT }} + BOT_MANAGER_HOST: ${{ vars.LOADTEST_CLIENT_HOST }} + DATABASE_URL: ${{ secrets.DATABASE_URL }} + SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} + NEWRELIC_APP_NAME: ${{ vars.NEWRELIC_APP_NAME }} + NEWRELIC_KEY: ${{ secrets.NEWRELIC_KEY }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + run: | + set -ex + ssh ${SSH_USERNAME}@${SSH_HOST} \ + BRANCH_NAME=${BRANCH_NAME} \ + MIX_ENV=${MIX_ENV} \ + RELEASE=${RELEASE} \ + PHX_SERVER=${PHX_SERVER} \ + PHX_HOST=${PHX_HOST} \ + PORT=${PORT} \ + BOT_MANAGER_PORT=${BOT_MANAGER_PORT} \ + BOT_MANAGER_HOST=${BOT_MANAGER_HOST} \ + DATABASE_URL=${DATABASE_URL} \ + SECRET_KEY_BASE=${SECRET_KEY_BASE} \ + NEWRELIC_APP_NAME=${NEWRELIC_APP_NAME} \ + NEWRELIC_KEY=${NEWRELIC_KEY} \ + /home/${SSH_USERNAME}/deploy-script/deploy.sh diff --git a/.github/workflows/loadtest-brazil-client-deploy.yml b/.github/workflows/loadtest-brazil-client-deploy.yml index 5a3995263..859a505ef 100644 --- a/.github/workflows/loadtest-brazil-client-deploy.yml +++ b/.github/workflows/loadtest-brazil-client-deploy.yml @@ -37,13 +37,13 @@ jobs: - name: Create ssh private key file from env var env: SSH_KEY: ${{ secrets.SSH_KEY }} - TS_HOST: ${{ vars.TS_LOADTEST_CLIENT_HOST }} + SSH_HOST: ${{ vars.TS_LOADTEST_CLIENT_HOST }} run: | set -ex mkdir -p ~/.ssh/ sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519 chmod 400 ~/.ssh/id_ed25519 - retries=5; until ssh-keyscan $TS_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done + retries=5; until ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done - name: Copy deploy script env: diff --git a/.github/workflows/loadtest-brazil-server-deploy.yml b/.github/workflows/loadtest-brazil-server-deploy.yml index ab289e138..eacc2fc10 100644 --- a/.github/workflows/loadtest-brazil-server-deploy.yml +++ b/.github/workflows/loadtest-brazil-server-deploy.yml @@ -23,13 +23,13 @@ jobs: - name: Create ssh private key file from env var env: SSH_KEY: ${{ secrets.SSH_KEY }} - TS_HOST: ${{ vars.TS_LOADTEST_SERVER_HOST }} + SSH_HOST: ${{ vars.TS_LOADTEST_SERVER_HOST }} run: | set -ex mkdir -p ~/.ssh/ sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519 chmod 400 ~/.ssh/id_ed25519 - retries=5; until ssh-keyscan $TS_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done + retries=5; until ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done - name: Copy deploy script env: diff --git a/.github/workflows/loadtest-europe-client-deploy.yml b/.github/workflows/loadtest-europe-client-deploy.yml index 649ac759a..e7e64dcf4 100644 --- a/.github/workflows/loadtest-europe-client-deploy.yml +++ b/.github/workflows/loadtest-europe-client-deploy.yml @@ -37,13 +37,13 @@ jobs: - name: Create ssh private key file from env var env: SSH_KEY: ${{ secrets.SSH_KEY }} - TS_HOST: ${{ vars.TS_LOADTEST_CLIENT_HOST }} + SSH_HOST: ${{ vars.TS_LOADTEST_CLIENT_HOST }} run: | set -ex mkdir -p ~/.ssh/ sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519 chmod 400 ~/.ssh/id_ed25519 - retries=5; until ssh-keyscan $TS_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done + retries=5; until ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done - name: Copy deploy script env: diff --git a/.github/workflows/loadtest-europe-server-deploy.yml b/.github/workflows/loadtest-europe-server-deploy.yml index f67f04eb3..808f3fc6f 100644 --- a/.github/workflows/loadtest-europe-server-deploy.yml +++ b/.github/workflows/loadtest-europe-server-deploy.yml @@ -23,13 +23,13 @@ jobs: - name: Create ssh private key file from env var env: SSH_KEY: ${{ secrets.SSH_KEY }} - TS_HOST: ${{ vars.TS_LOADTEST_SERVER_HOST }} + SSH_HOST: ${{ vars.TS_LOADTEST_SERVER_HOST }} run: | set -ex mkdir -p ~/.ssh/ sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519 chmod 400 ~/.ssh/id_ed25519 - retries=5; until ssh-keyscan $TS_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done + retries=5; until ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done - name: Copy deploy script env: From d0be85bc37fd8b73a006f5a47de678f56f35aa2c Mon Sep 17 00:00:00 2001 From: Lotu Date: Tue, 9 Apr 2024 12:47:07 -0300 Subject: [PATCH 5/8] Rename game_backend release to central_backend (#436) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Rename game_backend release to main_server * Make arena_load_test release only arena_load_test app * Remove comment * Rename main_server to central_backend * Restore unintended changes --------- Co-authored-by: Nicolas Sanchez Co-authored-by: Tomás Casagrande <53660242+samoht9277@users.noreply.github.com> --- devops/deploy.sh | 2 +- mix.exs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/devops/deploy.sh b/devops/deploy.sh index 190d23c72..70ff0cf65 100755 --- a/devops/deploy.sh +++ b/devops/deploy.sh @@ -17,7 +17,7 @@ mix deps.get --only $MIX_ENV mix deps.compile mix compile mix release ${RELEASE} --overwrite -if [ ${RELEASE} == "game_backend" ]; then +if [ ${RELEASE} == "central_backend" ]; then mix ecto.migrate fi diff --git a/mix.exs b/mix.exs index 88856650e..02d174251 100644 --- a/mix.exs +++ b/mix.exs @@ -45,8 +45,9 @@ defmodule MirraBackend.MixProject do [ arena: [applications: [arena: :permanent]], arena_load_test: [applications: [arena_load_test: :permanent]], + bot_manager: [applications: [bot_manager: :permanent]], game_client: [applications: [game_client: :permanent]], - game_backend: [ + central_backend: [ applications: [ champions: :permanent, game_backend: :permanent, From 25de0294ad3bc4db1d6533912e4ade5ac5120f0b Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Tue, 9 Apr 2024 12:47:44 -0300 Subject: [PATCH 6/8] Added central_backend. --- .github/workflows/central-brazil-testing-deploy.yml | 2 +- .github/workflows/central-europe-testing-deploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/central-brazil-testing-deploy.yml b/.github/workflows/central-brazil-testing-deploy.yml index d4c1b6ba4..847966c9b 100644 --- a/.github/workflows/central-brazil-testing-deploy.yml +++ b/.github/workflows/central-brazil-testing-deploy.yml @@ -44,7 +44,7 @@ jobs: SSH_HOST: ${{ vars.TS_CENTRAL_HOST }} SSH_USERNAME: ${{ vars.SSH_USERNAME }} MIX_ENV: ${{ vars.MIX_ENV }} - RELEASE: game_backend # Change to central_backend in the future. + RELEASE: central_backend PHX_SERVER: ${{ vars.PHX_SERVER }} PHX_HOST: ${{ vars.HOST }} PORT: ${{ vars.ARENA_PORT }} diff --git a/.github/workflows/central-europe-testing-deploy.yml b/.github/workflows/central-europe-testing-deploy.yml index e598a66ea..b4876c094 100644 --- a/.github/workflows/central-europe-testing-deploy.yml +++ b/.github/workflows/central-europe-testing-deploy.yml @@ -44,7 +44,7 @@ jobs: SSH_HOST: ${{ vars.TS_CENTRAL_HOST }} SSH_USERNAME: ${{ vars.SSH_USERNAME }} MIX_ENV: ${{ vars.MIX_ENV }} - RELEASE: game_backend # Change to central_backend in the future. + RELEASE: central_backend PHX_SERVER: ${{ vars.PHX_SERVER }} PHX_HOST: ${{ vars.HOST }} PORT: ${{ vars.ARENA_PORT }} From 84f5ffe9690dc0bc6805a34730dc0b605f6e3f2f Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Tue, 9 Apr 2024 12:52:09 -0300 Subject: [PATCH 7/8] Added temporary fix for systemd commands to be able to deploy loadtest-server brazil. --- .github/workflows/loadtest-brazil-server-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/loadtest-brazil-server-deploy.yml b/.github/workflows/loadtest-brazil-server-deploy.yml index eacc2fc10..c7d775fcf 100644 --- a/.github/workflows/loadtest-brazil-server-deploy.yml +++ b/.github/workflows/loadtest-brazil-server-deploy.yml @@ -41,6 +41,7 @@ jobs: - name: Execute deploy script env: + XDG_RUNTIME_DIR: /run/user/1001 # Temporary fix for systemd commands. SSH_HOST: ${{ vars.TS_LOADTEST_SERVER_HOST }} SSH_USERNAME: ${{ vars.SSH_USERNAME }} MIX_ENV: ${{ vars.MIX_ENV }} From e5f7efb48301b8c236d37bf888f5e8134a5e85a5 Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Tue, 9 Apr 2024 13:59:55 -0300 Subject: [PATCH 8/8] Added temporary fix for systemd commands to be able to deploy loadtest-server brazil. --- .github/workflows/loadtest-brazil-server-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/loadtest-brazil-server-deploy.yml b/.github/workflows/loadtest-brazil-server-deploy.yml index c7d775fcf..bd16dd12a 100644 --- a/.github/workflows/loadtest-brazil-server-deploy.yml +++ b/.github/workflows/loadtest-brazil-server-deploy.yml @@ -58,6 +58,7 @@ jobs: run: | set -ex ssh ${SSH_USERNAME}@${SSH_HOST} \ + XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} \ BRANCH_NAME=${BRANCH_NAME} \ MIX_ENV=${MIX_ENV} \ RELEASE=${RELEASE} \