Documentation
¶
Overview ¶
Command cloudsaved is experimental: its command-line interface may change in a minor release; see https://nsgo.games/docs/stability/.
Command cloudsaved runs the cloud save service as a standalone HTTP server, with slots in SQLite or Postgres.
cloudsaved init -config cloudsave.yaml cloudsaved serve -config cloudsave.yaml -keyset keys.yaml -sqlite saves.db -addr :8081 CLOUDSAVE_POSTGRES_DSN=postgres://... cloudsaved serve -config cloudsave.yaml -keyset keys.yaml -postgres
init writes a configuration with the default settings. serve runs the service until SIGINT or SIGTERM. It verifies players' tokens with the key set file of the account service (the one accountsd genkey keeps), which it reads once at start, so restart it after adding a key to that file. It accepts only tokens for the configuration's audience ("cloudsave" by default), which devices get from the account service's refresh, and refuses to start when that audience is the key set's, which names the game's servers. With metrics set in the configuration, serve also answers GET /healthz, GET /readyz (200 while the database answers a ping, else 503) and GET /metrics (Prometheus text: requests by route and status with latency, live slots and stored bytes, and dropped audit records when admin is set) on that address, a listener of its own.
When the configuration has an admin: block, serve also runs the admin listener it describes (package admin) on its own address, accepting operator sessions and the account service's "admin" bearer tokens, with the operator routes of cloudsave.Service.AdminRoutes to browse, download, restore and purge players' slots; without the block no admin route exists.
Put the server behind TLS and a rate limiter, as for accountsd.