Files
archy/apps/qortal/start.sh
ssmithx 4cc625e4d1 fix(qortal): enforce settings and honour icon-grid prompt policy
Parse settings with jq and require explicit safe booleans before listeners start. Reject missing/malformed configuration and multiple JSON documents. Honour prompt_before_launch in the icon-grid flow and cover false, true and legacy absent flags.

Validation: 17 focused frontend tests, 4 Python guard tests, shell syntax checks, Qortal manifest preflight and diff check passed. Image rebuild and live-node lifecycle acceptance remain pending.
2026-10-21 13:48:23 +00:00

44 lines
1.4 KiB
Bash

#!/bin/bash
# Qortal Core entrypoint: materialise the API key, refuse unsafe settings,
# then run Core and the companion status UI (nginx) side by side. If either
# exits, stop the other and exit, so the orchestrator restarts the container.
set -eu
cd /qortal
if [ ! -w /qortal ]; then
echo "ERROR: /qortal is not writable by uid:gid $(id -u):$(id -g)" >&2
ls -ld /qortal >&2 || true
exit 70
fi
# The manifest seeds settings.json. Missing, malformed or unsafe settings
# must fail before either listener starts, not fall back to upstream defaults.
/usr/local/bin/qortal-validate-settings /qortal/settings.json
# API key from the orchestrator-generated secret. Core reads apikey.txt
# verbatim, so it must be written without a trailing newline.
if [ -n "${QORTAL_API_KEY:-}" ]; then
umask 077
printf '%s' "$QORTAL_API_KEY" > apikey.txt
umask 022
fi
mkdir -p /tmp/nginx
nginx -c /etc/qortal-ui/nginx.conf -e stderr -g 'daemon off;' &
ui_pid=$!
# shellcheck disable=SC2086
java ${QORTAL_JVM_ARGS:--XX:MaxRAMPercentage=50 -XX:+UseG1GC -Xss1024k} \
-Djava.net.preferIPv4Stack=false \
-jar /usr/local/qortal/qortal.jar /qortal/settings.json &
core_pid=$!
# Forward stop signals so Core shuts its database down cleanly.
trap 'kill -TERM "$core_pid" "$ui_pid" 2>/dev/null' TERM INT
set +e
wait -n "$core_pid" "$ui_pid"
status=$?
kill -TERM "$core_pid" "$ui_pid" 2>/dev/null
wait "$core_pid"
exit "$status"