Debugging operational in vscode

This commit is contained in:
Adam Outler
2025-10-02 21:19:29 +00:00
parent 0cd1dc8987
commit 33aa8492bb
9 changed files with 34 additions and 56 deletions

View File

@@ -1,35 +1,5 @@
#!/bin/bash
set -euo pipefail
echo "Starting backend..."
cd "${NETALERTX_APP}" || exit 1
# Change user to netalertx
export PYTHONPATH="${NETALERTX_SERVER}:${NETALERTX_APP}"
EXTRA_PARAMS=""
if [ -f /services/config/python/backend-extra-launch-parameters ]; then
EXTRA_PARAMS=$(cat /services/config/python/backend-extra-launch-parameters)
fi
backend_pid=""
cleanup() {
status=$?
echo "Backend stopped! (exit ${status})"
}
forward_signal() {
if [[ -n "${backend_pid}" ]]; then
kill -TERM "${backend_pid}" 2>/dev/null || true
fi
}
trap cleanup EXIT
trap forward_signal INT TERM
# Start the backend, teeing stdout and stderr to log files and the container's console
python3 ${EXTRA_PARAMS} -m server > >(tee /app/log/stdout.log) 2> >(tee /app/log/stderr.log >&2) &
backend_pid=$!
wait "${backend_pid}"
exit $?
exec python3 $(cat /services/config/python/backend-extra-launch-parameters 2>/dev/null) -m server > >(tee /app/log/stdout.log) 2> >(tee /app/log/stderr.log >&2)