Skip to content

Commit 45c25aa

Browse files
committed
refactor godot-optimizer to use HTTP-based asset-server
Replace subprocess-based Godot execution with HTTP calls to godot-explorer asset-server. Key changes: - Add asset-server adapter for /process, /process-scene, /status APIs - Simplify godot-optimizer to use asset-server for all processing - Support scene (individual ZIPs), wearable, and emote entity types - Add parallel profile processing with --profile option - Remove old Godot project files and subprocess runner code - Use quay.io/decentraland/godot-explorer:next as base image
1 parent 90f8c13 commit 45c25aa

File tree

21 files changed

+985
-1910
lines changed

21 files changed

+985
-1910
lines changed

.env.godot-optimizer

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
HTTP_SERVER_PORT=8080
1+
HTTP_SERVER_PORT=3000
22
HTTP_SERVER_HOST=0.0.0.0
33

44
# reset metrics at 00:00UTC
55
WKC_METRICS_RESET_AT_NIGHT=
66

7-
PROCESS_METHOD=godot_optimizer
7+
PROCESS_METHOD=godot_optimizer
8+
9+
# Asset server runs on port 8080 inside the container
10+
ASSET_SERVER_URL=http://localhost:8080
11+
ASSET_SERVER_TIMEOUT_MS=600000
12+
ASSET_SERVER_CONCURRENT_BUNDLES=16

dependencies/godot-asset-optimizer-project/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 18 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,38 @@
1-
FROM ubuntu:25.04
1+
FROM quay.io/decentraland/godot-explorer:next
22

3-
# Install base packages and Node.js in combined layers
3+
USER root
4+
5+
# Xvfb already included in base image
6+
# Install Node.js 20.x
47
RUN apt-get update && \
58
apt-get install -y --no-install-recommends \
69
ca-certificates \
710
tini \
8-
unzip \
9-
curl \
10-
libfontconfig1 \
11-
zip && \
11+
curl && \
1212
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
1313
apt-get install -y --no-install-recommends nodejs && \
1414
rm -rf /var/lib/apt/lists/*
1515

16-
# Install Godot
17-
ARG GODOT_VERSION=4.5.1.stable
18-
ARG TARGETARCH
19-
ARG GODOT_FILENAME
20-
21-
# Set Godot filename based on architecture
22-
RUN if [ "$TARGETARCH" = "amd64" ]; then \
23-
# Use dclexplorer releases for amd64
24-
GODOT_FILENAME="godot.${GODOT_VERSION}.linux.editor.x86_64"; \
25-
GODOT_URL="https://godot-engine-releases.dclexplorer.com/${GODOT_VERSION}/editors/${GODOT_FILENAME}.zip"; \
26-
elif [ "$TARGETARCH" = "arm64" ]; then \
27-
# Use official Godot for arm64 as dclexplorer doesn't have arm64 builds
28-
GODOT_FILENAME="Godot_v4.5.1-stable_linux.arm64"; \
29-
GODOT_URL="https://github.com/godotengine/godot/releases/download/4.5.1-stable/${GODOT_FILENAME}.zip"; \
30-
else \
31-
echo "Unsupported architecture: $TARGETARCH" && exit 1; \
32-
fi && \
33-
echo "Using Godot from: $GODOT_URL" && \
34-
curl -fsSL "$GODOT_URL" -o /usr/local/bin/godot.zip && \
35-
unzip /usr/local/bin/godot.zip -d /usr/local/bin/ && \
36-
rm /usr/local/bin/godot.zip && \
37-
chmod +x /usr/local/bin/${GODOT_FILENAME} && \
38-
ln -s /usr/local/bin/${GODOT_FILENAME} /usr/local/bin/godot
39-
40-
ENV GODOT4_EDITOR=/usr/local/bin/godot
16+
# Godot executable at /app/decentraland.godot.client.x86_64 in base image
4117

4218
ARG COMMIT_HASH=local
4319
ARG CURRENT_VERSION=Unknown
4420

4521
ENV COMMIT_HASH=${COMMIT_HASH:-local}
4622
ENV CURRENT_VERSION=${CURRENT_VERSION:-Unknown}
23+
ENV ASSET_SERVER_PORT=8080
4724

48-
# build the app
49-
WORKDIR /app
50-
COPY . /app
51-
52-
# TEMP
53-
COPY dependencies/godot-asset-optimizer-project/entrypoint.sh /app/entrypoint.sh
54-
55-
RUN npm i --global yarn
56-
RUN yarn --frozen-lockfile
25+
# Use /service for node app to avoid conflict with /app (godot-explorer files)
26+
WORKDIR /service
27+
COPY package*.json yarn.lock ./
28+
RUN npm i --global yarn && yarn --frozen-lockfile
29+
COPY . .
5730
RUN yarn build
5831

32+
# Set production mode after build
5933
ENV NODE_ENV=production
6034

61-
# Please _DO NOT_ use a custom ENTRYPOINT because it may prevent signals
62-
# (i.e. SIGTERM) to reach the service
63-
# Read more here: https://aws.amazon.com/blogs/containers/graceful-shutdowns-with-ecs/
64-
# and: https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/
65-
#ENTRYPOINT ["/usr/bin/tini", "--"]
66-
# Run the program under Tini
67-
ENTRYPOINT ["/usr/bin/tini", "--", "/app/entrypoint.sh" ]
35+
COPY dependencies/godot-asset-optimizer-project/entrypoint.sh /entrypoint.sh
36+
RUN chmod +x /entrypoint.sh
37+
38+
ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint.sh"]
Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
#!/bin/bash
2-
3-
# turn on bash's job control
42
set -m
53

4+
# Start Xvfb
65
/usr/bin/Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
76
export DISPLAY=:99
8-
/usr/bin/node --enable-source-maps --trace-warnings --abort-on-uncaught-exception --unhandled-rejections=strict dist/index.js "$@"
7+
sleep 1
8+
9+
# Start asset-server in background
10+
cd /app
11+
./decentraland.godot.client.x86_64 --headless --asset-server --asset-server-port ${ASSET_SERVER_PORT:-8080} &
12+
GODOT_PID=$!
13+
14+
# Wait for server to be ready
15+
echo "Waiting for asset-server on port ${ASSET_SERVER_PORT:-8080}..."
16+
for i in {1..60}; do
17+
if curl -s http://localhost:${ASSET_SERVER_PORT:-8080}/health > /dev/null 2>&1; then
18+
echo "Asset-server ready"
19+
break
20+
fi
21+
sleep 1
22+
done
923

10-
fg %1
24+
# Start Node.js app
25+
cd /service
26+
exec /usr/bin/node \
27+
--enable-source-maps \
28+
--trace-warnings \
29+
--abort-on-uncaught-exception \
30+
--unhandled-rejections=strict \
31+
dist/index.js "$@"

dependencies/godot-asset-optimizer-project/export_presets.cfg

Lines changed: 0 additions & 208 deletions
This file was deleted.

0 commit comments

Comments
 (0)