-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·43 lines (38 loc) · 1.79 KB
/
bootstrap.sh
File metadata and controls
executable file
·43 lines (38 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# Entrypoint wrapper for the render-tools image.
#
# Runs as root (PID-1 child of tini). On every boot it:
# 1. Ensures /opt/data exists and is owned by hermes:hermes.
# 2. Runs the config patcher as the hermes user. The patcher is
# idempotent: it only INSERTs the Render MCP server and the
# skills.external_dirs entry; it never overwrites user edits.
# 3. Exec's the upstream entrypoint chain with the original args
# (default CMD is `gateway run`).
#
# The upstream entrypoint also chowns /opt/data and drops to the hermes
# user via gosu for the gateway process. Our chown here is redundant in
# the happy path but harmless, and it lets the patcher run on a fresh
# disk that hasn't been chowned yet.
set -eu
DATA_DIR="${HERMES_HOME:-/opt/data}"
PATCHER="/opt/render-tools/patch-config.py"
# Make sure the data dir exists and the hermes user can write to it
# before we run the patcher. Idempotent — if /opt/data is already a
# mounted, chowned disk this is a no-op.
mkdir -p "${DATA_DIR}"
if ! chown -R hermes:hermes "${DATA_DIR}" 2>/dev/null; then
echo "[render-tools] warning: could not chown ${DATA_DIR}; continuing" >&2
fi
# Patch config.yaml. We never fail the boot on a patch error — the agent
# can still run without the Render MCP server registered, and the user
# can always add it manually from the dashboard.
if [ -x "${PATCHER}" ]; then
if ! gosu hermes "${PATCHER}" "${DATA_DIR}/config.yaml"; then
echo "[render-tools] warning: config patch failed; continuing with unmodified config" >&2
fi
else
echo "[render-tools] warning: ${PATCHER} not found or not executable; skipping" >&2
fi
# Hand off to the upstream entrypoint. The upstream script handles
# privilege drop, dashboard backgrounding, and the actual gateway exec.
exec /opt/hermes/docker/entrypoint.sh "$@"