ADR 0021-0026 for the new course of 2 December 2026, roadmap of phases 10-24. The desktop application is gone: Docker is the only form, and outside a container the server runs only for development and tests with --data-dir, on this computer only. Lighter image (829 MB to 410 MB), rotating logs, backtest and learning as one-shot commands. refs #113 #114 #115 #78 #80 #81 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
50 lines
1.6 KiB
Bash
50 lines
1.6 KiB
Bash
#!/bin/sh
|
|
# Container start (SPEC 15.2, issue #16). As root: prepare /data for PUID:PGID (99:100 on Unraid), then drop to that
|
|
# user with setpriv, which is part of the base image (no gosu). Started as another user (docker run --user): go straight on.
|
|
# The process is the guard (SPEC 9.3, ADR 0012): it starts the engine, watches it and passes the stop on to it.
|
|
set -eu
|
|
|
|
# What the application writes (database, backups, logs) is readable only by its own user.
|
|
umask 077
|
|
|
|
app="/app/Anubis.Guard.dll"
|
|
|
|
# A command ("docker run <immagine> db import ...") runs once and ends: without the guard, which would start it again.
|
|
case "${1:-}" in
|
|
db|access|data|backtest|learning|diagnostics|soak)
|
|
app="/app/Anubis.Server.dll"
|
|
;;
|
|
esac
|
|
|
|
if [ "$(id -u)" != "0" ]; then
|
|
exec dotnet "$app" "$@"
|
|
fi
|
|
|
|
uid="${PUID:-99}"
|
|
gid="${PGID:-100}"
|
|
case "$uid$gid" in
|
|
*[!0-9]*|"")
|
|
echo "PUID e PGID devono essere numeri (adesso: PUID=$uid PGID=$gid)." >&2
|
|
exit 64
|
|
;;
|
|
esac
|
|
|
|
case "$uid" in
|
|
*[!0]*) ;;
|
|
*)
|
|
echo "PUID=0 farebbe girare Anubis come amministratore: usa un utente normale (99 su Unraid)." >&2
|
|
exit 64
|
|
;;
|
|
esac
|
|
|
|
mkdir -p /data
|
|
for folder in db models research import backups logs web-keys guard; do
|
|
mkdir -p "/data/$folder"
|
|
done
|
|
# Only what does not already belong to PUID:PGID, so a large data folder does not slow every start.
|
|
find /data -xdev \( ! -user "$uid" -o ! -group "$gid" \) -exec chown -h "$uid:$gid" {} +
|
|
chmod 700 /data
|
|
|
|
export HOME=/tmp
|
|
exec setpriv --reuid="$uid" --regid="$gid" --clear-groups --no-new-privs -- dotnet "$app" "$@"
|