ops/cloud/compose.billing.yaml
Rama main · réplica de lectura del repositorio original.
# Fonoster Cloud's billing (rating, credits, admission, Stripe). Not in the install archive:
# production's inventory writes it next to the release (fonoster_files) and names it in
# COMPOSE_FILE (ops/cloud/README.md). It needs STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET and
# NATS_BILLING_PASSWORD in .env, features.billing in config/fonoster.yaml and authz in
# config/appbridge.yaml, and the NATS user and Envoy route in ops/cloud/inserts.yml.
#
# Its tables live in its own database, billing (BILLING_DATABASE_URL, migrated at every start).
# Create it on the Postgres first.
services:
# NATS's billing user (config/nats.conf, from ops/cloud/inserts.yml) reads its password here.
nats:
environment:
NATS_BILLING_PASSWORD: ${NATS_BILLING_PASSWORD:?set NATS_BILLING_PASSWORD in .env}
billing:
image: fonoster/billing:${FONOSTER_VERSION:?set FONOSTER_VERSION}
restart: unless-stopped
# Never postgres: works with compose.external-db.yaml too.
depends_on:
apiserver: { condition: service_healthy }
nats: { condition: service_healthy }
# The ${NAME}s in config/billing.yaml.
environment:
BILLING_DATABASE_URL: ${BILLING_DATABASE_URL:-postgresql://postgres:${POSTGRES_PASSWORD:?run ./init.sh}@postgres:5432/billing}
ENCRYPTION_KEY: ${ENCRYPTION_KEY:?run ./init.sh}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?run ./init.sh}
NATS_BILLING_PASSWORD: ${NATS_BILLING_PASSWORD:?set NATS_BILLING_PASSWORD in .env}
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY:?set STRIPE_SECRET_KEY in .env}
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET:?set STRIPE_WEBHOOK_SECRET in .env}
volumes:
- ${CONFIG_DIR:-./config}/billing.yaml:/etc/fonoster/billing.yaml:ro
# Ready = the Authz server (50071) answers SERVING: migrations ran and admission is up.
healthcheck:
test: ["CMD", "node", "/work/mods/billing/dist/healthcheck.js"]
interval: 5s
timeout: 3s
retries: 30
start_period: 30s
# Authz for AppBridge (50071), Stripe's webhooks through Envoy (50072), the Billing API for the
# API server (50073). Not published.
expose: [50071, 50072, 50073]