Add configure_logging() (main.py): always logs to stderr, plus a rotating file when PIRATS_LOG_FILE is set; level from PIRATS_LOG_LEVEL (default INFO). Called from both the CLI entrypoint and the app lifespan (idempotent), which also logs startup/migration/shutdown. Targeted server-side events for ops/debugging (not every game event): game created, player joined, player removed (kick/leave), game ended. NixOS service: new logFile (/var/log/pirats/pirats.log) and logLevel options, wired to the env vars; LogsDirectory=pirats makes the path writable under the sandboxed DynamicUser. README documents the env vars/options. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
DevOps/Maintenance
- Logging: Add some logging to the backend. The Nix service should log to /var/log/pirats.log by default (but be configurable). At very least, stderr should go there, plus important server-side events, like:
- Purge old finished/inactive games: Add a periodic task (daily is good enough, but make the interval configurable through an env variable/the nix flake) to purge games that have finished more than two weeks ago, or have had no moves played within the last month. These time windows should also be configurable. Log all purges, including crew names/uuids and how much disk space they recovered.
- Defensive coding. While we trust our players, this app is exposed on the open internet. I'd like to take basic precautions like making sure we're safe against SQL injection (SQLModel should handle this?), doing some basic sanitizing of free inputs from players (valid unicode only + generous character limit should be enough), and making sure that every game action API call is specific and constrained enough that it can't just do arbitrary database updates.
Words Words Words (Waiting for Fable to come back)
- TLDR rules. A one page summary sheet of the rulebook, for the impatient
- Suggestions. Take a pass through all of the suggestions in suggestions.js, rewrite ones that are stiff, awkward, or don't fit the theme/setting as described in the rulebook. Move the suggestion pool from suggestions.js into a backend API endpoint.