# One environment, five repositories, one PostgreSQL server. # # This is the environment owner's complete configuration: every member and every shared # definition in one document, reviewed and applied once. Each repository then submits only its # own member (`apps/*.yaml`) with `--scope application`. # # Placeholders: the PostgreSQL server `shared-postgres` must already be added under Services # (the guide's reviewed `environment service-add ... --name shared-postgres --confirm`), and # the environment's single bucket must already be bound. Neither identifier nor any credential # appears in this file. version: "1.18" applications: # Node: the public storefront. Reads the shared catalog database and the bound bucket. storefront: runtime: node runtimeVersion: "26" source: root: . build: install: [npm, ci] command: [npm, run, build] run: command: [node, dist/server.js] port: 3000 healthPath: /health env: NODE_ENV: production DATABASE_URL: {database: catalog, field: url} CATALOG_API_TOKEN: {secret: internal_api_token} ASSET_ENDPOINT: {storage: endpoint} ASSET_REGION: {storage: region} ASSET_BUCKET_NAME: {storage: bucket} ASSET_ACCESS_KEY_ID: {storage: access-key-id} ASSET_SECRET_ACCESS_KEY: {storage: secret-access-key} # Python: checkout and payment callbacks. Consumes the catalog database by grant, not by ownership. checkout: runtime: python runtimeVersion: "3.15" source: root: . build: install: [python, -m, pip, install, --no-cache-dir, --target, .hosting-deps, -r, requirements.txt] run: command: [.hosting-deps/bin/gunicorn, app:app] port: 8000 healthPath: /health env: CATALOG_URL: {database: catalog, field: url} CATALOG_API_TOKEN: {secret: internal_api_token} PAYMENTS_API_KEY: {secret: payments_api_key} PORT: "8000" # PHP/Laravel: the customer portal, with a queue worker and a pre-release migration. portal: runtime: laravel runtimeVersion: "8.5" source: root: . build: install: [composer, install, --no-dev, --no-interaction, --no-progress, --prefer-dist, --no-scripts] run: command: [hosting-laravel-web] port: 8090 healthPath: /up env: APP_ENV: production APP_DEBUG: "false" APP_KEY: {secret: app_key} DB_CONNECTION: pgsql DB_URL: {database: portal, field: url} CACHE_STORE: file SESSION_DRIVER: file QUEUE_CONNECTION: database workers: queue: command: [php, artisan, queue:work, database, --sleep=1, --tries=1, --timeout=60] env: APP_KEY: {secret: app_key} DB_CONNECTION: pgsql DB_URL: {database: portal, field: url} CACHE_STORE: file SESSION_DRIVER: file QUEUE_CONNECTION: database release: command: [php, artisan, migrate, --force] timeoutSeconds: 300 env: APP_KEY: {secret: app_key} DB_CONNECTION: pgsql DB_URL: {database: portal, field: url} CACHE_STORE: file SESSION_DRIVER: file QUEUE_CONNECTION: database # Go: the reporting service. One compiled binary, its own logical database. reports: runtime: go runtimeVersion: "1.27" source: root: . build: install: [go, mod, download] command: [go, build, -trimpath, -ldflags=-s, -o, bin/server, .] run: command: [./bin/server] port: 8091 healthPath: /health env: DATABASE_URL: {database: analytics, field: url} FEED_TOKEN: {secret: reporting_feed_token} PORT: "8091" # Rust: the internal admin, with a pre-release migration and the shared files volume. admin: runtime: rust runtimeVersion: "1.99" source: root: . build: install: [cargo, fetch, --locked] command: [cargo, install, --path, ., --root, ., --locked, --offline, --bin, admin] run: command: [./bin/admin] port: 3001 healthPath: /health env: RUST_LOG: info APP_SECRET: {secret: app_secret} DATABASE_URL: {database: admin, field: url} release: command: [./bin/admin, migrate] timeoutSeconds: 300 env: APP_SECRET: {secret: app_secret} DATABASE_URL: {database: admin, field: url} # Four logical databases on the one server named `shared-postgres`. Three have a single consumer; # `catalog` is deliberately granted to two applications, which is the advanced pattern. databases: catalog: engine: postgres server: shared-postgres bindings: [storefront, checkout] portal: engine: postgres server: shared-postgres application: portal analytics: engine: postgres server: shared-postgres application: reports admin: engine: postgres server: shared-postgres application: admin # Internal secrets are generated once, on apply. The payment key is provider-issued and is never # generated: it is written separately with `environment secret write`. secrets: internal_api_token: description: Shared token the storefront and checkout present to each other required: true generate: {format: base64url, bytes: 32} app_key: description: Laravel application encryption key required: true generate: {format: laravel-app-key} app_secret: description: Internal admin signing and encryption key required: true generate: {format: alphanumeric} reporting_feed_token: description: Internal token the reports service presents to the admin API required: true generate: {format: hex, bytes: 32} payments_api_key: description: Provider-issued payment key; Hosting never generates this one required: true