[Unit] Description=OptRL ReinforceLab Next.js (standalone) After=network.target [Service] Type=simple User=optrl Group=optrl # IMPORTANT: # Keep WorkingDirectory at the project root (not .next/standalone) so relative # content/public paths still resolve correctly if you use defaults. WorkingDirectory=/opt/optrl/reinforcelab-site Environment=NODE_ENV=production Environment=PORT=3000 Environment=HOSTNAME=0.0.0.0 # Put secrets/env vars here (ADMIN_SESSION_SECRET, SMTP_*, CONTACT_TO, etc). EnvironmentFile=/etc/optrl/reinforcelab-site.env # Next standalone server output (built from project root) ExecStart=/usr/bin/node .next/standalone/server.js Restart=always RestartSec=5 # Allow SQLite DB writes (WAL sidecar files are created next to the DB file) ReadWritePaths=/var/lib/optrl [Install] WantedBy=multi-user.target