#!/bin/sh set -e if [ "${SKIP_K3S:-0}" = "1" ]; then echo "[entrypoint] SKIP_K3S=1: starting neuron-web directly (no soul-demo)." exec /usr/local/bin/neuron-web fi # Soul-demo watchdog: start soul-demo and restart it automatically on crash. # Cloud Run gen2 doesn't reliably provide eth0 with a unicast IP, so k3s flannel # fails at startup. Running soul-demo directly is simpler, lighter, and fully # self-healing. Cloud Run handles horizontal scaling — no HPA needed. echo "[entrypoint] Starting soul-demo watchdog on :${NEURON_PORT:-7772}..." ( while true; do echo "[soul-watchdog] starting soul-demo (NEURON_HOME=${NEURON_HOME})" /usr/local/bin/soul-demo 2>&1 || true echo "[soul-watchdog] soul-demo exited, restarting in 3s..." sleep 3 done ) & # Start neuron-web immediately — do NOT block. # Cloud Run startup probe requires port 8080 to answer within the timeout. echo "[entrypoint] Starting neuron-web on port ${PORT:-8080}..." exec /usr/local/bin/neuron-web