Skip to content

Commit 67c117a

Browse files
committed
add godot processing for minimap
1 parent 3bf9a8d commit 67c117a

File tree

18 files changed

+5791
-472
lines changed

18 files changed

+5791
-472
lines changed

.env

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,13 @@
33
# You may want to add this .env file to .gitignore to save development
44
# credentials
55

6-
HTTP_SERVER_PORT=5000
6+
HTTP_SERVER_PORT=7667
7+
HTTP_SERVER_HOST=0.0.0.0
8+
9+
# reset metrics at 00:00UTC
10+
WKC_METRICS_RESET_AT_NIGHT=false
11+
12+
AWS_REGION=us-east-1
13+
TASK_QUEUE=http://localstack:4566/000000000000/SceneEntitiesForCRDTSQS
14+
BUCKET=minimap
15+
AWS_ENDPOINT=http://localstack:4566

.env.default

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
# This file should be safe to commit and can act as documentation for all
2-
# the possible configurations of our server.
3-
4-
# This file contains the default environment variables, by default,
5-
# it is third in precedence:
6-
# 1. process environment variables
7-
# 2. `.env` file contents
8-
# 3. `.env.default` file contents.
9-
10-
HTTP_SERVER_PORT=3000
11-
HTTP_SERVER_HOST=0.0.0.0
1+
HTTP_SERVER_PORT=
2+
HTTP_SERVER_HOST=
123

134
# reset metrics at 00:00UTC
14-
WKC_METRICS_RESET_AT_NIGHT=false
5+
WKC_METRICS_RESET_AT_NIGHT=
156

7+
PROCESS_METHOD=
8+
AWS_REGION=
9+
TASK_QUEUE=
10+
BUCKET=
11+
AWS_ENDPOINT=

.godot.env

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# No secrets, local env
2+
3+
HTTP_SERVER_PORT=7667
4+
HTTP_SERVER_HOST=0.0.0.0
5+
6+
# reset metrics at 00:00UTC
7+
WKC_METRICS_RESET_AT_NIGHT=false
8+
9+
PROCESS_METHOD=godot_minimap
10+
AWS_REGION=us-east-1
11+
TASK_QUEUE=http://localstack:4566/000000000000/SceneEntitiesForMinimapSQS
12+
BUCKET=minimap
13+
AWS_ENDPOINT=http://localstack:4566

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RUN npm ci
2020

2121
# build the app
2222
COPY . /app
23+
COPY .godot.env /app/.env
2324
RUN npm run build
2425
RUN npm run test
2526

godot-entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# turn on bash's job control
4+
set -m
5+
6+
/usr/bin/Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
7+
export DISPLAY=:99
8+
/usr/bin/node --trace-warnings --abort-on-uncaught-exception --unhandled-rejections=strict dist/index.js
9+
10+
fg %1

godot-run.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Set variables
4+
DOCKERFILE="godot.Dockerfile"
5+
IMAGE_NAME="godot-runner"
6+
7+
# Check for --build flag
8+
if [[ "$1" == "--build" ]]; then
9+
# Build the Docker image
10+
echo "Building the Docker image: $IMAGE_NAME"
11+
docker build -f "$DOCKERFILE" -t "$IMAGE_NAME" .
12+
13+
# Check if the build succeeded
14+
if [ $? -ne 0 ]; then
15+
echo "Failed to build the Docker image."
16+
exit 1
17+
fi
18+
else
19+
echo "Skipping build step. Use --build to build the image."
20+
fi
21+
22+
# Run the Docker container interactively with automatic cleanup
23+
echo "Running the Docker container interactively..."
24+
docker run --rm -it \
25+
-e AWS_SDK_LOAD_CONFIG=1 \
26+
-e AWS_DEFAULT_REGION=us-east-1 \
27+
-v ~/.aws:/root/.aws:ro \
28+
--network localenv_app-network \
29+
$IMAGE_NAME
30+
31+
# Exit message
32+
if [ $? -eq 0 ]; then
33+
echo "Container exited successfully."
34+
else
35+
echo "Container encountered an error."
36+
fi

godot.Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM quay.io/decentraland/godot-explorer:4f93d5c591dea36da17d70721a7ae1524fbdd79a
2+
3+
RUN apt-get update && apt-get upgrade -y
4+
RUN apt-get install -y ca-certificates tini
5+
6+
# Install node
7+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get -y install nodejs
8+
9+
# Clean apt cache
10+
RUN rm -rf /var/lib/apt/lists/* /var/cache/apt/*
11+
12+
ARG COMMIT_HASH=local
13+
ARG CURRENT_VERSION=Unknown
14+
15+
ENV COMMIT_HASH=${COMMIT_HASH:-local}
16+
ENV CURRENT_VERSION=${CURRENT_VERSION:-Unknown}
17+
18+
# build the app
19+
WORKDIR /app
20+
COPY . /app
21+
22+
RUN npm i --global yarn
23+
RUN yarn --frozen-lockfile
24+
RUN yarn build
25+
26+
ENV NODE_ENV production
27+
28+
# Please _DO NOT_ use a custom ENTRYPOINT because it may prevent signals
29+
# (i.e. SIGTERM) to reach the service
30+
# Read more here: https://aws.amazon.com/blogs/containers/graceful-shutdowns-with-ecs/
31+
# and: https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/
32+
#ENTRYPOINT ["/usr/bin/tini", "--"]
33+
# Run the program under Tini
34+
ENTRYPOINT ["/usr/bin/tini", "--", "/app/godot-entrypoint.sh" ]

0 commit comments

Comments
 (0)