[Unit] Description=0G Nova Adventure - game server After=network-online.target postgresql.service Wants=network-online.target Requires=postgresql.service [Service] Type=simple User=@USER@ Group=@USER@ WorkingDirectory=@TARGET@/server # Settings live in server.env beside the binary, not here: it holds the database password # and is 0600, where a unit file is world-readable. # # TO BE LISTED IN THE GAME, add a name and the server registers itself: # Environment="ZEROG_SERVER_NAME=My Server Name" # Environment=ZEROG_SERVER_TAGS=PVE,Creative # # Behind a hostname and TLS, say so - the rendezvous cannot discover a reverse proxy by # probing, and browser players need a wss:// address or they cannot connect at all: # Environment=ZEROG_SERVER_PUBLIC_URL=wss://your.domain/ws # Environment=ZEROG_GATEWAY_PORT=443 # Updates run before the server does, because this is the only moment the binaries are safe to # replace. It fetches a signed manifest, replaces only what differs, and applies any database # scripts that came with it. # # A FAILURE HERE IS ALLOWED TO STOP THE START, and that is the point: it exits non-zero only when # a database script failed, which means the binaries about to run expect a schema the database # does not have. Starting anyway gives a server that throws on the first read of the changed # table. Everything else - the service being unreachable, a signature that will not verify - # leaves the install untouched and exits 0, so a working server keeps working. ExecStartPre=@TARGET@/update.sh # 0.0.0.0 because players arrive from other machines. The Windows launcher keeps this on # loopback until a host opens the gates; here, running it at all is the decision. ExecStart=@TARGET@/server/ZeroGNovaAdventure.Server --listen --bind 0.0.0.0 --port 25312 --requireauth Restart=always RestartSec=10s NoNewPrivileges=true PrivateTmp=true ProtectSystem=strict ProtectHome=true # The single-file bundle unpacks its native libraries on first run, and writes the world # nowhere else. Everything outside this stays read-only. ReadWritePaths=@TARGET@ Environment=DOTNET_BUNDLE_EXTRACT_BASE_DIR=@TARGET@/.bundle [Install] WantedBy=multi-user.target