ddbb568f1d
soul-demo now runs as a k3s Deployment with HPA (1–8 replicas, 60% CPU target) instead of a bare background process. k3s starts first in entrypoint.sh, imports the soul-demo:local OCI tar from /var/lib/rancher/k3s/agent/images, and auto-applies the Deployment, NodePort Service, and HPA from the server/manifests dir. neuron-web starts only after the soul-demo pod is Running. Cloud Run gen2 execution environment required for k3s (provides /dev/kmsg and Linux capabilities).
36 lines
1.1 KiB
Bash
36 lines
1.1 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
echo "[entrypoint] Starting k3s server (embedded soul-demo orchestrator)..."
|
|
|
|
# k3s server — single-node mode, disable unused components
|
|
# --disable traefik,servicelb: we don't need an ingress or LB
|
|
# --disable metrics-server: saves ~50MB RAM
|
|
# --write-kubeconfig-mode=644: allow non-root reads
|
|
# --data-dir: use the pre-chowned dir
|
|
k3s server \
|
|
--disable traefik \
|
|
--disable servicelb \
|
|
--disable metrics-server \
|
|
--write-kubeconfig-mode=644 \
|
|
--data-dir /var/lib/rancher/k3s \
|
|
--node-name soul-node &
|
|
|
|
K3S_PID=$!
|
|
|
|
echo "[entrypoint] Waiting for k3s to become ready..."
|
|
until k3s kubectl get nodes --no-headers 2>/dev/null | grep -q "Ready"; do
|
|
sleep 2
|
|
done
|
|
echo "[entrypoint] k3s ready. soul-demo Deployment will be applied automatically from manifests."
|
|
|
|
# Wait for soul-demo pod to be Running before starting neuron-web
|
|
echo "[entrypoint] Waiting for soul-demo pod..."
|
|
until k3s kubectl get pods -l app=soul-demo --no-headers 2>/dev/null | grep -q "Running"; do
|
|
sleep 3
|
|
done
|
|
echo "[entrypoint] soul-demo is running."
|
|
|
|
echo "[entrypoint] Starting neuron-web on port ${PORT:-8080}..."
|
|
exec /usr/local/bin/neuron-web
|