{ "module": "txt-game", "version": "1", "capabilities": [ "container-runtime" ], "requires": [ "postgres-database", "route" ], "contributes": { "postgres-database": { "name": "txt-game" }, "route": { "label": "txt-game", "endpoint": "web" } }, "binds": { "postgres-database": "${dir:state}/database.json", "route": "${dir:state}/route.json" }, "secrets": { "postgres-database": "${dir:state}/database.secret" }, "listens": [ { "name": "web", "port": 3000, "protocol": "tcp", "from": "mesh", "why": "the game's pages and form posts over http; its public name is a route grant and the proxy reaches it here" } ], "resources": [ { "id": "state", "type": "directory", "mode": "0700", "place": "." }, { "id": "database-env", "type": "file", "path": "${dir:state}/database.env", "mode": "0644", "content": "TXT_GAME_DB_HOST=${bound:postgres-database:at}\nTXT_GAME_DB_PORT=${bound:postgres-database:port}\nTXT_GAME_DB_USER=${bound:postgres-database:as}\nTXT_GAME_DB_NAME=${bound:postgres-database:as}\n" }, { "id": "database-password", "type": "file", "path": "${dir:state}/database-password", "mode": "0600", "content": "${secret:postgres-database}" }, { "id": "server", "type": "container", "name": "txt-game", "artifact": "app", "ports": [ "3000" ], "env": { "TXT_GAME_DB_PASSWORD_FILE": "/run/secrets/database" }, "env-file": [ "${dir:state}/database.env" ], "volumes": [ "${dir:state}/database-password:/run/secrets/database:ro" ], "restart-on": [ "database-env", "database-password" ] } ], "build": { "on": [ { "arg": "NODE_BASE", "image": "node@sha256:b6f26b36c8ff49624cfdac716b8ea1138d606df02586a77d364bb5536a634f85" } ], "artifacts": [ { "name": "app", "kind": "image", "from": "Dockerfile" } ] } }