Coderabit suggestions

This commit is contained in:
Adam Outler
2025-10-18 14:07:27 -04:00
parent 028335c1a9
commit 62536e4bfb
13 changed files with 59 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
This is the default filesystem for NetAlertX. it contains
This is the default filesystem for NetAlertX. It contains
- `/app` - The main application location. This structure is where the source code (back, front and server directories) is copied and executed in read-only form. It also provides default structures for the working directories, such as: config, db, and log. All other directories are not required in the production image and are not tracked.
- `/build` - a place where services can be initialized during docker container build. This folder is copied in, executed near the end of the build before the system is locked down, and then deleted. It is only available during build time.

View File

@@ -21,7 +21,7 @@ set -u
# Run all checks at container startup.
for script in /services/check-*.sh; do
bash "$script"
sh "$script"
done

View File

@@ -1,7 +0,0 @@
#!/bin/sh
# app-check.sh - Ensures /app/api/table_settings.json exists
if [ ! -f /app/api/table_settings.json ]; then
# mkdir -p /app/api
# echo -ne '{}' > /app/api/table_settings.json
fi

View File

@@ -1,10 +1,15 @@
#!/bin/bash
cd "${NETALERTX_APP}" || exit 1
while $(ps ax | grep -v grep | grep python3 >/dev/null); do
killall python3 &>/dev/null
max_attempts=50 # 10 seconds total (50 * 0.2s)
attempt=0
while ps ax | grep -v grep | grep -q python3 && [ $attempt -lt $max_attempts ]; do
killall -TERM python3 &>/dev/null
sleep 0.2
((attempt++))
done
# Force kill if graceful shutdown failed
killall -KILL python3 &>/dev/null
echo "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)"
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)

View File

@@ -16,7 +16,7 @@ forward_signal() {
fi
}
while $(ps ax | grep -v -e grep -e '.sh' | grep crond >/dev/null); do
while ps ax | grep -v -e grep -e '.sh' | grep crond >/dev/null 2>&1; do
killall crond &>/dev/null
sleep 0.2
done

View File

@@ -16,7 +16,7 @@ forward_signal() {
fi
}
while $(ps ax | grep -v grep | grep php-fpm83 >/dev/null); do
while ps ax | grep -v grep | grep php-fpm83 >/dev/null; do
killall php-fpm83 &>/dev/null
sleep 0.2
done