diff --git a/docker/tinode/entrypoint.sh b/docker/tinode/entrypoint.sh index c2d98a0..5f59388 100644 --- a/docker/tinode/entrypoint.sh +++ b/docker/tinode/entrypoint.sh @@ -188,11 +188,12 @@ fi args=("--config=${CONFIG}" "--static_data=$STATIC_DIR" "--cluster_self=$CLUSTER_SELF" "--pprof_url=$PPROF_URL") -# Run the tinode server. Mirror the captured stderr to container logs on exit so -# CrashLoopBackOff pods expose the actual startup failure via kubectl logs. -./tinode "${args[@]}" 2>> /var/log/tinode.log -status=$? -if [ "$status" -ne 0 ] && [ -s /var/log/tinode.log ]; then - tail -200 /var/log/tinode.log >&2 -fi -exit "$status" +# Run the tinode server, mirroring output to both stdout (so kubectl logs/Promtail's +# standard container-log collection actually sees it -- confirmed live that the old +# file-only redirect meant Loki never received a single real tinode log line, only +# this script's own earlier init-db output) and the log file (kept for exec-based +# inspection, e.g. `kubectl exec ... -- cat /var/log/tinode.log`). PIPESTATUS[0] is +# required here: with output piped through tee, a bare $? would report tee's exit +# status (almost always 0) instead of tinode's. +./tinode "${args[@]}" 2>&1 | tee -a /var/log/tinode.log +exit "${PIPESTATUS[0]}"