mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-15 22:51:37 -07:00
Set container parameters
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
echo "Initializing nginx..."
|
||||
install -d -o netalertx -g netalertx -m 700 /app/run/tmp/client_body;
|
||||
install -d -o netalertx -g netalertx -m 700 ${SYSTEM_SERVICES_RUN_TMP}/client_body;
|
||||
echo "nginx initialized."
|
||||
@@ -3,6 +3,9 @@
|
||||
set -u
|
||||
|
||||
bash /services/capcheck.sh
|
||||
bash /services/ramdisk-check.sh
|
||||
|
||||
|
||||
|
||||
SERVICES=""
|
||||
FAILED_NAME=""
|
||||
|
||||
@@ -107,7 +107,7 @@ http {
|
||||
# Set Cache-Control header to prevent caching on the first load
|
||||
add_header Cache-Control "no-store";
|
||||
fastcgi_pass unix:/services/run/php.sock;
|
||||
include fastcgi_params;
|
||||
include /services/config/nginx/fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_connect_timeout 75;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# ramdisk-check.sh - Verify critical paths are backed by ramdisk and warn on fallback storage.
|
||||
|
||||
warn_if_not_ramdisk() {
|
||||
path="$1"
|
||||
|
||||
if cat /proc/mounts| grep ${path} | grep -qE 'tmpfs|ramfs'; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
cat >&2 <<EOF
|
||||
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
|
||||
ATTENTION: ${path} is not on a ramdisk.
|
||||
Mount this folder inside the container as tmpfs or ramfs.
|
||||
|
||||
NetAlertX expects this location to live in memory for fast reads and writes.
|
||||
Running it on disk will severely degrade performance for every user.
|
||||
|
||||
Fix: Please mount ${path} as tmpfs/ramfs.
|
||||
eg. --mount type=tmpfs,destination=${path}
|
||||
Restart the container after adding the ramdisk mount.
|
||||
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
warn_if_not_ramdisk "${NETALERTX_API}"
|
||||
warn_if_not_ramdisk "${NETALERTX_LOG}"
|
||||
|
||||
if [ ! -f "${SYSTEM_NGINIX_CONFIG}/conf.active" ]; then
|
||||
echo "Note: Using default listen address ${LISTEN_ADDR}:${PORT} (no ${SYSTEM_NGINIX_CONFIG}/conf.active override)."
|
||||
fi
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#! /bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
LOG_DIR=${NETALERTX_APP}
|
||||
@@ -34,10 +35,10 @@ done
|
||||
|
||||
TEMP_CONFIG_FILE=$(mktemp "${TMP_DIR}/netalertx.conf.XXXXXX")
|
||||
if envsubst '${LISTEN_ADDR} ${PORT}' < "${SYSTEM_NGINX_CONFIG_TEMPLATE}" > "${TEMP_CONFIG_FILE}" 2>/dev/null; then
|
||||
mv "${TEMP_CONFIG_FILE}" "${SYSTEM_NGINX_CONFIG_FILE}"
|
||||
mv "${TEMP_CONFIG_FILE}" "${SYSTEM_NGINX_CONFIG_FILE}" 2>/dev/null || true
|
||||
else
|
||||
echo "Note: Unable to write to ${SYSTEM_NGINX_CONFIG_FILE}. Using default configuration."
|
||||
rm -f "${TEMP_CONFIG_FILE}"
|
||||
rm -f "${TEMP_CONFIG_FILE}" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
Reference in New Issue
Block a user