Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into handle-diff-game-upda…
Browse files Browse the repository at this point in the history
…tes-v2
  • Loading branch information
Nico-Sanchez committed Aug 29, 2024
2 parents b5cd88f + d2fa42c commit d56b809
Show file tree
Hide file tree
Showing 10 changed files with 388 additions and 3 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/arena-argentina-testing-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: "[TESTING-ARGENTINA] Deploy to Argentina Office Arena Testing"
on:
workflow_dispatch:

jobs:
build-deploy:
name: Build and deploy to Argentina Office Testing
runs-on: ubuntu-latest
environment:
name: testing-argentina

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.MACMINI_SSH_KEY }}
SSH_HOST: ${{ vars.TS_ARENA_HOST_MACMINI }}
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: lambdaclass
SSH_HOST: ${{ vars.TS_ARENA_HOST_MACMINI }}
run: |
set -ex
rsync -avz devops/deploy-macos.sh ${SSH_USERNAME}@${SSH_HOST}:/Users/${SSH_USERNAME}/deploy-script/
- name: Execute deploy script
env:
SSH_HOST: ${{ vars.TS_ARENA_HOST_MACMINI }}
SSH_USERNAME: lambdaclass
MIX_ENV: ${{ vars.MIX_ENV }}
RELEASE: arena
PHX_SERVER: ${{ vars.PHX_SERVER }}
PHX_HOST: ${{ vars.HOST_MACMINI }}
PORT: ${{ vars.ARENA_PORT }}
GATEWAY_URL: ${{ vars.GATEWAY_URL }}
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} \
BOT_MANAGER_HOST=${BOT_MANAGER_HOST} \
PORT=${PORT} \
GATEWAY_URL=${GATEWAY_URL} \
BOT_MANAGER_PORT=${BOT_MANAGER_PORT} \
DATABASE_URL=${DATABASE_URL} \
SECRET_KEY_BASE=${SECRET_KEY_BASE} \
NEWRELIC_APP_NAME=${NEWRELIC_APP_NAME} \
NEWRELIC_KEY=${NEWRELIC_KEY} \
/Users/${SSH_USERNAME}/deploy-script/deploy-macos.sh
75 changes: 75 additions & 0 deletions .github/workflows/arena-chile-testing-1-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: "[TESTING-CHILE-1] Deploy to Chile Latitude Arena Testing"
on:
workflow_dispatch:

jobs:
build-deploy:
name: Build and deploy to Chile-1 Testing
runs-on: ubuntu-latest
environment:
name: testing-chile

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: Add host keys
env:
SSH_HOST: ${{ vars.TS_ARENA_HOST_LATITUDE }}
run: |
set -ex
mkdir -p ~/.ssh/
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_ARENA_HOST_LATITUDE }}
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_ARENA_HOST_LATITUDE }}
SSH_USERNAME: ${{ vars.SSH_USERNAME }}
MIX_ENV: ${{ vars.MIX_ENV }}
RELEASE: arena
PHX_SERVER: ${{ vars.PHX_SERVER }}
PHX_HOST: ${{ vars.HOST_LATITUDE }}
PORT: ${{ vars.ARENA_PORT }}
GATEWAY_URL: ${{ vars.GATEWAY_URL }}
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 }}
DBUS_SESSION_BUS_ADDRESS: ${{ vars.DBUS_SESSION_BUS_ADDRESS }}
XDG_RUNTIME_DIR: ${{ vars.XDG_RUNTIME_DIR }}
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} \
BOT_MANAGER_HOST=${BOT_MANAGER_HOST} \
PORT=${PORT} \
GATEWAY_URL=${GATEWAY_URL} \
BOT_MANAGER_PORT=${BOT_MANAGER_PORT} \
DATABASE_URL=${DATABASE_URL} \
SECRET_KEY_BASE=${SECRET_KEY_BASE} \
NEWRELIC_APP_NAME=${NEWRELIC_APP_NAME} \
NEWRELIC_KEY=${NEWRELIC_KEY} \
DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS} \
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} \
/home/${SSH_USERNAME}/deploy-script/deploy.sh
75 changes: 75 additions & 0 deletions .github/workflows/arena-chile-testing-2-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: "[TESTING-CHILE-2] Deploy to Chile Vultr Arena Testing"
on:
workflow_dispatch:

jobs:
build-deploy:
name: Build and deploy to Chile-2 Testing
runs-on: ubuntu-latest
environment:
name: testing-chile

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: Add host keys
env:
SSH_HOST: ${{ vars.TS_ARENA_HOST_VULTR }}
run: |
set -ex
mkdir -p ~/.ssh/
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_ARENA_HOST_VULTR }}
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_ARENA_HOST_VULTR }}
SSH_USERNAME: ${{ vars.SSH_USERNAME }}
MIX_ENV: ${{ vars.MIX_ENV }}
RELEASE: arena
PHX_SERVER: ${{ vars.PHX_SERVER }}
PHX_HOST: ${{ vars.HOST_VULTR }}
PORT: ${{ vars.ARENA_PORT }}
GATEWAY_URL: ${{ vars.GATEWAY_URL }}
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 }}
DBUS_SESSION_BUS_ADDRESS: ${{ vars.DBUS_SESSION_BUS_ADDRESS }}
XDG_RUNTIME_DIR: ${{ vars.XDG_RUNTIME_DIR }}
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} \
BOT_MANAGER_HOST=${BOT_MANAGER_HOST} \
PORT=${PORT} \
GATEWAY_URL=${GATEWAY_URL} \
BOT_MANAGER_PORT=${BOT_MANAGER_PORT} \
DATABASE_URL=${DATABASE_URL} \
SECRET_KEY_BASE=${SECRET_KEY_BASE} \
NEWRELIC_APP_NAME=${NEWRELIC_APP_NAME} \
NEWRELIC_KEY=${NEWRELIC_KEY} \
DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS} \
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} \
/home/${SSH_USERNAME}/deploy-script/deploy.sh
3 changes: 3 additions & 0 deletions .github/workflows/loadtest-brazil-client-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
options:
- Brazil
- Europe
- Chile

jobs:
build-deploy:
Expand Down Expand Up @@ -63,6 +64,7 @@ jobs:
TARGET_SERVER: ${{ inputs.target_server }}
LOADTEST_EUROPE_HOST: ${{ vars.LOADTEST_EUROPE_HOST }}
LOADTEST_BRAZIL_HOST: ${{ vars.LOADTEST_BRAZIL_HOST }}
LOADTEST_CHILE_HOST: ${{ vars.LOADTEST_CHILE_HOST }}
PHX_SERVER: ${{ vars.PHX_SERVER }}
PHX_HOST: ${{ vars.LOADTEST_CLIENT_HOST }}
PORT: ${{ vars.ARENA_PORT }}
Expand All @@ -83,6 +85,7 @@ jobs:
TARGET_SERVER=${TARGET_SERVER} \
LOADTEST_EUROPE_HOST=${LOADTEST_EUROPE_HOST} \
LOADTEST_BRAZIL_HOST=${LOADTEST_BRAZIL_HOST} \
LOADTEST_CHILE_HOST=${LOADTEST_CHILE_HOST} \
PHX_SERVER=${PHX_SERVER} \
PHX_HOST=${PHX_HOST} \
PORT=${PORT} \
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/loadtest-chile-client-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: "[LOADTEST-CLIENT-CHILE] Deploy to Chile Loadtest Client"
on:
workflow_dispatch:
inputs:
release:
type: choice
description: What release to deploy
options:
- bot_manager
- arena_load_test
required: true
target_server:
type: choice
description: Loadtest target server
options:
- Chile
- Brazil
- Europe

jobs:
build-deploy:
name: Build and deploy to Chile Loadtest Client
runs-on: ubuntu-latest
environment:
name: testing-chile
url: https://loadtest-chile-client.championsofmirra.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_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 $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_LOADTEST_CLIENT_HOST }}
run: |
set -ex
rsync -avz --mkpath devops/deploy.sh ${SSH_USERNAME}@${SSH_HOST}:/home/${SSH_USERNAME}/deploy-script/
- name: Execute deploy script
env:
XDG_RUNTIME_DIR: ${{ vars.XDG_RUNTIME_DIR }}
SSH_HOST: ${{ vars.TS_LOADTEST_CLIENT_HOST }}
SSH_USERNAME: ${{ vars.SSH_USERNAME }}
MIX_ENV: ${{ vars.MIX_ENV }}
RELEASE: ${{ inputs.release }}
TARGET_SERVER: ${{ inputs.target_server }}
LOADTEST_EUROPE_HOST: ${{ vars.LOADTEST_EUROPE_HOST }}
LOADTEST_BRAZIL_HOST: ${{ vars.LOADTEST_BRAZIL_HOST }}
LOADTEST_CHILE_HOST: ${{ vars.LOADTEST_CHILE_HOST }}
PHX_SERVER: ${{ vars.PHX_SERVER }}
PHX_HOST: ${{ vars.LOADTEST_CLIENT_HOST }}
PORT: ${{ vars.ARENA_PORT }}
BOT_MANAGER_PORT: ${{ vars.BOT_MANAGER_PORT }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
NEWRELIC_APP_NAME: ${{ vars.NEWRELIC_APP_NAME_LOADTEST }}
NEWRELIC_KEY: ${{ secrets.NEWRELIC_KEY }}
DBUS_SESSION_BUS_ADDRESS: ${{ vars.DBUS_SESSION_BUS_ADDRESS }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
set -ex
ssh ${SSH_USERNAME}@${SSH_HOST} \
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} \
BRANCH_NAME=${BRANCH_NAME} \
MIX_ENV=${MIX_ENV} \
RELEASE=${RELEASE} \
TARGET_SERVER=${TARGET_SERVER} \
LOADTEST_EUROPE_HOST=${LOADTEST_EUROPE_HOST} \
LOADTEST_BRAZIL_HOST=${LOADTEST_BRAZIL_HOST} \
LOADTEST_CHILE_HOST=${LOADTEST_CHILE_HOST} \
PHX_SERVER=${PHX_SERVER} \
PHX_HOST=${PHX_HOST} \
PORT=${PORT} \
BOT_MANAGER_PORT=${BOT_MANAGER_PORT} \
DATABASE_URL=${DATABASE_URL} \
SECRET_KEY_BASE=${SECRET_KEY_BASE} \
NEWRELIC_APP_NAME=${NEWRELIC_APP_NAME} \
NEWRELIC_KEY=${NEWRELIC_KEY} \
DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS} \
/home/${SSH_USERNAME}/deploy-script/deploy.sh
3 changes: 3 additions & 0 deletions .github/workflows/loadtest-europe-client-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
options:
- Europe
- Brazil
- Chile

jobs:
build-deploy:
Expand Down Expand Up @@ -62,6 +63,7 @@ jobs:
TARGET_SERVER: ${{ inputs.target_server }}
LOADTEST_EUROPE_HOST: ${{ vars.LOADTEST_EUROPE_HOST }}
LOADTEST_BRAZIL_HOST: ${{ vars.LOADTEST_BRAZIL_HOST }}
LOADTEST_CHILE_HOST: ${{ vars.LOADTEST_CHILE_HOST }}
PHX_SERVER: ${{ vars.PHX_SERVER }}
PHX_HOST: ${{ vars.LOADTEST_CLIENT_HOST }}
PORT: ${{ vars.ARENA_PORT }}
Expand All @@ -81,6 +83,7 @@ jobs:
TARGET_SERVER=${TARGET_SERVER} \
LOADTEST_EUROPE_HOST=${LOADTEST_EUROPE_HOST} \
LOADTEST_BRAZIL_HOST=${LOADTEST_BRAZIL_HOST} \
LOADTEST_CHILE_HOST=${LOADTEST_CHILE_HOST} \
PHX_SERVER=${PHX_SERVER} \
PHX_HOST=${PHX_HOST} \
PORT=${PORT} \
Expand Down
6 changes: 3 additions & 3 deletions apps/arena/lib/arena/game_updater.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1221,12 +1221,12 @@ defmodule Arena.GameUpdater do

collided_entity = decide_collided_entity(projectile, collides_with, external_wall.id, players_acc, crates_acc)

collsionable_entities =
Map.merge(players, crates)
collisionable_entities =
Map.merge(players_acc, crates_acc)

process_projectile_collision(
projectile,
Map.get(collsionable_entities, collided_entity),
Map.get(collisionable_entities, collided_entity),
Map.get(obstacles, collided_entity),
collided_entity == external_wall.id,
accs
Expand Down
1 change: 1 addition & 0 deletions apps/arena_load_test/lib/arena_load_test/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ defmodule ArenaLoadTest.Utils do

def get_server_ip("Europe"), do: System.get_env("LOADTEST_EUROPE_HOST")
def get_server_ip("Brazil"), do: System.get_env("LOADTEST_BRAZIL_HOST")
def get_server_ip("Chile"), do: System.get_env("LOADTEST_CHILE_HOST")
end
Loading

0 comments on commit d56b809

Please sign in to comment.