-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into events_fixing
Trying out updated event emits`
- Loading branch information
Showing
29 changed files
with
15,612 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Runtime | ||
FROM nginx:1.27-alpine AS runtime | ||
|
||
## Copy Nginx config | ||
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf | ||
COPY ./nginx/confd-default.conf /etc/nginx/conf.d/default.conf | ||
|
||
## Copy Godot export html data | ||
COPY ./web_export/ /www/data/ | ||
RUN chmod a+r -R /www/data/ | ||
|
||
RUN mv /www/data/ArcaneReveal.html /www/data/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## Index Server Directive | ||
server { | ||
listen 80; | ||
absolute_redirect off; | ||
|
||
## Add Required Godot export header | ||
add_header Access-Control-Allow-Origin "*"; | ||
add_header Cross-Origin-Embedder-Policy "require-corp"; | ||
add_header Cross-Origin-Opener-Policy "same-origin"; | ||
|
||
root /www/data/; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Optimizing performance for serving content | ||
# See: https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content/#optimizing-performance-for-serving-content | ||
|
||
# Optimizing performance for proxy | ||
# See: https://www.tweaked.io/guide/nginx-proxying/ | ||
user nginx; | ||
worker_processes 2; | ||
events { | ||
worker_connections 8096; | ||
multi_accept on; | ||
use epoll; | ||
} | ||
worker_rlimit_nofile 40000; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
# Enable gzip encryption | ||
gzip on; | ||
|
||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 30; | ||
types_hash_max_size 2048; | ||
|
||
# Don't expose Nginx version | ||
server_tokens off; | ||
|
||
include /etc/nginx/conf.d/*.conf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
name: Deploy | ||
|
||
## workflow will need manual trigger from actions page | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
uses: ./.github/workflows/build.yaml | ||
permissions: | ||
contents: read | ||
id-token: write | ||
packages: write | ||
deploy: | ||
name: Deploy Railway | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Railway CLI | ||
run: | | ||
bash <(curl -fsSL cli.new) | ||
- name: Install Redis-CLI | ||
uses: shogo82148/actions-setup-redis@v1 | ||
with: | ||
redis-version: 7 | ||
auto-start: "false" | ||
- name: Install Postgresql client-only | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install --yes --no-install-recommends postgresql-client | ||
- name: Get Last Commit Short SHA | ||
id: commit_data | ||
run: | | ||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
- name: Cardinal - Shutdown Previous Deployment | ||
working-directory: world-engine/cardinal | ||
run: | | ||
## Get Cardinal Latest Deployment ID | ||
DEPLOYMENT_ID=$(curl --location 'https://backboard.railway.app/graphql/v2' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"query deployments($projectId: String!, $environmentId: String!, $serviceId: String!) {\n deployments(\n first: 1\n input: {\n projectId: $projectId\n environmentId: $environmentId\n serviceId: $serviceId\n }\n ) {\n edges {\n node {\n id\n staticUrl\n }\n }\n }\n}", | ||
"variables":{"projectId":"${{ vars.RAILWAY_PROJECT_ID }}","environmentId":"${{ vars.PROD_RAILWAY_ENVIRONMENT_ID }}","serviceId":"${{ vars.RAILWAY_CARDINAL_SERVICE_ID }}"}}' | jq -r '.data.deployments.edges[].node.id') | ||
## Remove Deployment | ||
curl --location 'https://backboard.railway.app/graphql/v2' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"mutation deploymentRemove($id: String!) {\n deploymentRemove(id: $id)\n}","variables":{"id":"'${DEPLOYMENT_ID}'"}}' | ||
- name: Clear Up Redis | ||
run: | | ||
sleep 10 | ||
redis-cli -h ${{ secrets.PROD_REDIS_HOST }} -p ${{ secrets.PROD_REDIS_PORT }} <<EOF | ||
AUTH ${{ secrets.PROD_REDIS_PASSWORD }} | ||
FLUSHALL | ||
keys * | ||
EOF | ||
- name: Cardinal - Up New Deployment | ||
env: | ||
RAILWAY_TOKEN: ${{ secrets.PROD_RAILWAY_TOKEN }} | ||
run: | | ||
## remove prev docker image | ||
curl --location 'https://backboard.railway.app/graphql/internal?q=stageEnvironmentChanges' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"mutation stageEnvironmentChanges($environmentId: String!, $payload: EnvironmentConfig!) {\n environmentStageChanges(environmentId: $environmentId, input: $payload) {\n id\n }\n}","variables":{"environmentId":"${{ vars.PROD_RAILWAY_ENVIRONMENT_ID }}","payload":{"services":{"${{ vars.RAILWAY_CARDINAL_SERVICE_ID }}":{"source":{"image":null}}}}}}' | ||
sleep 5 | ||
## commit changes | ||
curl --location 'https://backboard.railway.app/graphql/internal?q=environmentPatchCommitStaged' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"mutation environmentPatchCommitStaged($environmentId: String!, $message: String, $skipDeploys: Boolean) {\n environmentPatchCommitStaged(\n environmentId: $environmentId\n commitMessage: $message\n skipDeploys: $skipDeploys\n )\n}","variables":{"environmentId":"${{ vars.PROD_RAILWAY_ENVIRONMENT_ID }}","skipDeploys":false}}' | ||
sleep 5 | ||
## change new docker image | ||
curl --location 'https://backboard.railway.app/graphql/internal?q=stageEnvironmentChanges' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"mutation stageEnvironmentChanges($environmentId: String!, $payload: EnvironmentConfig!) {\n environmentStageChanges(environmentId: $environmentId, input: $payload) {\n id\n }\n}","variables":{"environmentId":"${{ vars.PROD_RAILWAY_ENVIRONMENT_ID }}","payload":{"services":{"${{ vars.RAILWAY_CARDINAL_SERVICE_ID }}":{"source":{"image":"ghcr.io/franklindao-dev-team/arcanereveal/cardinal:sha-${{ steps.commit_data.outputs.sha_short }}","repo":null,"branch":null,"upstreamUrl":null},"deploy":{"registryCredentials":{"username":"USERNAME","password":"${{ secrets.RAILWAY_GITHUB_REGISTRY_TOKEN }}"}}}}}}}' | ||
sleep 5 | ||
## commit changes | ||
curl --location 'https://backboard.railway.app/graphql/internal?q=environmentPatchCommitStaged' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"mutation environmentPatchCommitStaged($environmentId: String!, $message: String, $skipDeploys: Boolean) {\n environmentPatchCommitStaged(\n environmentId: $environmentId\n commitMessage: $message\n skipDeploys: $skipDeploys\n )\n}","variables":{"environmentId":"${{ vars.PROD_RAILWAY_ENVIRONMENT_ID }}","skipDeploys":false}}' | ||
- name: Godot Client - Up New Deployment | ||
env: | ||
RAILWAY_TOKEN: ${{ secrets.PROD_RAILWAY_TOKEN }} | ||
run: | | ||
## remove prev docker image | ||
curl --location 'https://backboard.railway.app/graphql/internal?q=stageEnvironmentChanges' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"mutation stageEnvironmentChanges($environmentId: String!, $payload: EnvironmentConfig!) {\n environmentStageChanges(environmentId: $environmentId, input: $payload) {\n id\n }\n}","variables":{"environmentId":"${{ vars.PROD_RAILWAY_ENVIRONMENT_ID }}","payload":{"services":{"${{ vars.RAILWAY_GODOT_SERVICE_ID }}":{"source":{"image":null}}}}}}' | ||
sleep 5 | ||
## commit changes | ||
curl --location 'https://backboard.railway.app/graphql/internal?q=environmentPatchCommitStaged' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"mutation environmentPatchCommitStaged($environmentId: String!, $message: String, $skipDeploys: Boolean) {\n environmentPatchCommitStaged(\n environmentId: $environmentId\n commitMessage: $message\n skipDeploys: $skipDeploys\n )\n}","variables":{"environmentId":"${{ vars.PROD_RAILWAY_ENVIRONMENT_ID }}","skipDeploys":false}}' | ||
sleep 5 | ||
## change new docker image | ||
curl --location 'https://backboard.railway.app/graphql/internal?q=stageEnvironmentChanges' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"mutation stageEnvironmentChanges($environmentId: String!, $payload: EnvironmentConfig!) {\n environmentStageChanges(environmentId: $environmentId, input: $payload) {\n id\n }\n}","variables":{"environmentId":"${{ vars.PROD_RAILWAY_ENVIRONMENT_ID }}","payload":{"services":{"${{ vars.RAILWAY_GODOT_SERVICE_ID }}":{"source":{"image":"ghcr.io/franklindao-dev-team/arcanereveal/godotexport:sha-${{ steps.commit_data.outputs.sha_short }}","repo":null,"branch":null,"upstreamUrl":null},"deploy":{"registryCredentials":{"username":"USERNAME","password":"${{ secrets.RAILWAY_GITHUB_REGISTRY_TOKEN }}"}}}}}}}' | ||
sleep 5 | ||
## commit changes | ||
curl --location 'https://backboard.railway.app/graphql/internal?q=environmentPatchCommitStaged' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"mutation environmentPatchCommitStaged($environmentId: String!, $message: String, $skipDeploys: Boolean) {\n environmentPatchCommitStaged(\n environmentId: $environmentId\n commitMessage: $message\n skipDeploys: $skipDeploys\n )\n}","variables":{"environmentId":"${{ vars.PROD_RAILWAY_ENVIRONMENT_ID }}","skipDeploys":false}}' | ||
- name: Cardinal Healthcheck | ||
run: | | ||
curl -X POST --max-time 10 --retry 20 --retry-delay 5 --retry-max-time 300 ${{ vars.PROD_CARDINAL_HEALTHCHECK }} -d "{}" | ||
- name: Remove Nakama Database (Railway) | ||
run: | | ||
PGPASSWORD=${{ secrets.PROD_RAILWAY_POSTGRES_PASSWORD }} psql -h ${{ secrets.PROD_RAILWAY_POSTGRES_HOST }} -U ${{ secrets.PROD_RAILWAY_POSTGRES_USER }} -p ${{ secrets.PROD_RAILWAY_POSTGRES_PORT }} -d railway -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;" | ||
- name: Restart Nakama Services (Railway) | ||
run: | | ||
## Get NAKAMA Latest Deployment ID | ||
DEPLOYMENT_ID=$(curl --location 'https://backboard.railway.app/graphql/v2' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"query deployments($projectId: String!, $environmentId: String!, $serviceId: String!) {\n deployments(\n first: 1\n input: {\n projectId: $projectId\n environmentId: $environmentId\n serviceId: $serviceId\n }\n ) {\n edges {\n node {\n id\n staticUrl\n }\n }\n }\n}", | ||
"variables":{"projectId":"${{ vars.RAILWAY_PROJECT_ID }}","environmentId":"${{ vars.PROD_RAILWAY_ENVIRONMENT_ID }}","serviceId":"${{ vars.RAILWAY_NAKAMA_SERVICE_ID }}"}}' | jq -r '.data.deployments.edges[].node.id') | ||
## RESTART Deployment | ||
curl --location 'https://backboard.railway.app/graphql/v2' \ | ||
--header 'Authorization: Bearer ${{ secrets.RAILWAY_API_TOKEN }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"query":"mutation deploymentRestart($id: String!) {\n deploymentRestart(id: $id)\n}","variables":{"id":"'${DEPLOYMENT_ID}'"}}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Deploy static content to Pages | ||
on: | ||
push: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
jobs: | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./ | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.