Initial upload to Gitea

This commit is contained in:
antonn committed 2026-11-30 16:32:37 +00:00
1 parent 78193254ad
commit 8478998cae
1485 files changed
+461025 -42348

No files matched your search

+9 -4
View File
@@ -61,13 +61,16 @@ total_ram_mb() {
TOTAL_CORES="$(cpu_cores)"
TOTAL_RAM_MB="$(total_ram_mb)"
SAFE_RAM_MB=$((TOTAL_RAM_MB * 80 / 100))
AGENT_RAM_MB=512
SAFE_RAM_MB=$((TOTAL_RAM_MB * 75 / 100 - AGENT_RAM_MB))
if [ "$SAFE_RAM_MB" -lt 128 ]; then SAFE_RAM_MB=128; fi
if [ "$TOTAL_CORES" -le 2 ]; then
if [ "$TOTAL_CORES" -le 3 ]; then
INSTANCES=1
else
INSTANCES=$((TOTAL_CORES - 2))
INSTANCES=$((TOTAL_CORES - 3))
fi
if [ "$INSTANCES" -gt 12 ]; then INSTANCES=12; fi
# Keep at least 192 MB target per worker by reducing workers on low-RAM hosts.
MIN_WORKER_TARGET_MB=192
@@ -86,6 +89,7 @@ if [ "$INSTANCES" -lt 1 ]; then
fi
WORKER_RAM_MB=$((SAFE_RAM_MB / INSTANCES))
DB_CONNECTIONS_PER_WEB_WORKER=$((96 / INSTANCES))
if [ "$WORKER_RAM_MB" -lt 128 ]; then
WORKER_RAM_MB=128
fi
@@ -95,7 +99,7 @@ if [ "$MAX_OLD_SPACE_MB" -lt 96 ]; then
MAX_OLD_SPACE_MB=96
fi
APP_SCRIPT_PATH="${PANEL_DIR}/index.js"
APP_SCRIPT_PATH="${PANEL_DIR}/scripts/panel-update-recovery.cjs"
tmp_ecosystem="$(mktemp)"
sed \
@@ -104,6 +108,7 @@ sed \
-e "s|__INSTANCES__|${INSTANCES}|g" \
-e "s|__MAX_OLD_SPACE_MB__|${MAX_OLD_SPACE_MB}|g" \
-e "s|__WORKER_RAM_MB__|${WORKER_RAM_MB}|g" \
-e "s|__DB_CONNECTIONS_PER_WEB_WORKER__|${DB_CONNECTIONS_PER_WEB_WORKER}|g" \
"$TEMPLATE_FILE" > "$tmp_ecosystem"
mkdir -p "$(dirname "$STATE_FILE")"