Add your manifest to the gateway
You have written a manifest for your game (tutorial 2
shows how) and gwctl validate says it is fine. This page shows how to get that file into a
gateway: on your machine first, then in production, and how to change it later.
The commands on this page are checked in CI by
02-describe-your-actions.sh.
Two ways in
Section titled “Two ways in”| Way | When | How |
|---|---|---|
| Startup file | the first start of a gateway, and every local test | --manifest path/to/manifest.yaml |
| Upload | every change after that, in staging and production | PUT /v1/studio/manifest, signed with the admin key |
The one rule to remember
Section titled “The one rule to remember”The manifest store is the source of truth. --manifest only seeds an empty store.
On start the gateway looks for an active manifest version in its store. If there is none, it
stores the file from --manifest as version 1 (actor bootstrap) and serves it. If a version is
already active, the file is ignored and the stored version is served. The start log says which
one happened:
{"level":"INFO","msg":"manifest","version":1,"sha256":"...","seeded_from_file":true}seeded_from_file: false means the file was not used. With Postgres (--postgres-url) the store
survives restarts, so editing the file and restarting does not change the tools. The compose
stack in this repository uses Postgres. Without Postgres the store lives in memory and every
restart seeds again from the file.
The reason: in production a studio uploads and rolls back versions while the gateway runs. A restart with an old file on disk must not undo that. The decision is recorded in DECISIONS.md.
1. Check the file
Section titled “1. Check the file”Put your manifest in a folder of its own, for example mygame/manifest.yaml in the repository
folder, and validate it:
docker compose run --rm dev go run ./cmd/gwctl validate mygame/manifest.yamldocker compose run --rm dev go run ./cmd/gwctl tools mygame/manifest.yamlThe extension picks the format: .yaml or .yml is read as YAML, anything else as JSON. A YAML
manifest saved as manifest.txt fails as invalid JSON.
2. Run the gateway on it locally
Section titled “2. Run the gateway on it locally”The repository’s docker-compose.yml runs the gateway on the city demo. Do not edit it. Add a
small override file next to it instead, compose.mygame.yml:
# Runs the gateway on your manifest and your backend. Dev only: --dev-auth trusts X-Dev-Player.services: gateway: command: - --manifest=/etc/mygame/manifest.yaml - --backend-url=http://host.docker.internal:3000 - --backend-allow-private # your backend is on your machine; dev only - --addr=0.0.0.0:8080 - --redis-addr=redis:6379 - --ops-addr=0.0.0.0:9091 - --dev-auth volumes: - ./mygame:/etc/mygame:ro extra_hosts: - "host.docker.internal:host-gateway"What each part does:
commandreplaces the demo’s flag list.--manifestis the path inside the container.--backend-urlis where your game backend listens.host.docker.internalreaches a backend running on your machine (here on port 3000). If your backend runs in compose, use its service name instead, as inhttp://my-backend:9090.--backend-allow-privatelets the gateway call a private or loopback address. It is off by default so a manifest cannot make the gateway call internal hosts. Keep it for local work only.volumesmounts your folder read only. Mount the folder, not the single file, so an editor that replaces the file on save does not leave the container with the old copy.extra_hostsmakeshost.docker.internalwork on Linux. Docker Desktop has it already.
Stop the demo if it runs (it uses the same ports), then start your stack under its own project name. A separate name gives it its own Postgres volume, so the demo’s stored manifest is not picked up instead of yours:
docker compose downdocker compose -p mygame -f docker-compose.yml -f compose.mygame.yml up --build -ddocker compose -p mygame logs gateway | grep '"msg":"manifest"'curl -s -H 'X-Dev-Player: p1' http://127.0.0.1:8080/v1/toolsThe log line shows "seeded_from_file":true and /v1/tools lists your tools. The demo’s
city backend also starts, because the gateway service depends on it. It does nothing for you
and you can ignore it.
Calls now go to your backend, signed. Your backend should verify the signature
(tutorial 3). Every call is signed with
GAMEWARDEN_SIGNING_SECRET, dev-secret by default.
3. Change the manifest while you develop
Section titled “3. Change the manifest while you develop”Edit mygame/manifest.yaml, validate it again, then reset the store so the file seeds it again:
docker compose -p mygame -f docker-compose.yml -f compose.mygame.yml down -vdocker compose -p mygame -f docker-compose.yml -f compose.mygame.yml up -ddown -v deletes this project’s volumes: the stored manifest, but also its confirmations, grants
and audit. That is fine on your machine. A plain restart keeps the old tools, as explained in
the rule.
To change the tools without losing state, upload instead, as in the next section.
4. Change the manifest in production
Section titled “4. Change the manifest in production”In production you never restart to change tools. You upload a new version with the admin key
(GAMEWARDEN_ADMIN_SECRET), a different key from the one that signs player calls. The upload
takes the same file you validated:
| Call | What it does |
|---|---|
PUT /v1/studio/manifest |
validate and activate a new version. Content-Type: application/yaml for YAML. An invalid file gets 422 and changes nothing |
GET /v1/studio/manifest/versions |
list versions, with who uploaded each and which one is active |
POST /v1/studio/manifest/versions/{id}/activate |
roll back (or forward) to a stored version |
The request is signed like every studio call (protocol). Your deploy job can
sign it with pkg/agentsig, or with the repository’s
studiocall helper, which runs in the dev container:
docker compose run --rm -e GAMEWARDEN_ADMIN_SECRET dev go run ./examples/studiocall \ --url https://gateway.example.com --key-id admin-1 --secret-env GAMEWARDEN_ADMIN_SECRET \ --player ci --content-type application/yaml --body-file mygame/manifest.yaml \ --expect 201 PUT /v1/studio/manifestEvery replica serves the new version within --manifest-poll (15 seconds by default). Calls
already running finish with the tools they started with. Tutorial 6
runs the whole flow: upload, list, roll back, and a rejected upload. The endpoints are listed in
the studio and admin API.
A good habit: keep the manifest in Git next to your backend code, validate it in CI with
gwctl validate, and upload it from CI after a merge. The version list then lines up with your
commits, and a rollback is one call.
5. Where the startup file comes from in production
Section titled “5. Where the startup file comes from in production”The seed still matters for the first start of a new environment.
- Docker or Compose: mount the file and pass
--manifest, as above, without--dev-authand--backend-allow-private(unless your backend is on a private network you trust). Tutorial 6 has the full flag set. - Kubernetes: the Helm chart takes the file and stores it in a ConfigMap:
helm install ... --set-file manifest=mygame/manifest.yaml. For JSON also pass--set manifestFile=manifest.json. See tutorial 9 and the runbook.
When it does not work
Section titled “When it does not work”| What you see | Why | Fix |
|---|---|---|
| Old tools after editing the file and restarting | the store already has an active version, seeded_from_file: false |
down -v on your machine, upload in production |
The gateway exits with manifest bootstrap in the log |
the seed file is invalid | gwctl validate it and fix every listed problem |
The gateway exits with manifest and no such file |
the --manifest path is wrong inside the container |
check the volumes mount and the path in --manifest |
invalid character errors for a YAML file |
the extension is not .yaml or .yml, so it was read as JSON |
rename the file |
Every call returns backend_unavailable |
the backend is down, unreachable from the container, or private without --backend-allow-private |
check --backend-url from inside the container, see troubleshooting |
backend_rejected with a signature message |
your backend refuses the signature | use the same secret on both sides, see tutorial 3 |
- Best practices for designing tools, tiers and caps.
- Cookbook for manifest patterns you can paste.
- Manifest reference for every field.