Files
kurt-mcrae 4ec4a8b5dd
Build and Push Docker Images / build-frontend (push) Successful in 1m44s
Build and Push Docker Images / build-backend (push) Successful in 1m47s
Build and Push Docker Images / test-backend (push) Successful in 2m21s
Build and Push Docker Images / test-frontend (push) Successful in 2m48s
Build and Push Docker Images / e2e-frontend (push) Successful in 3m0s
Update compose.yaml
2026-10-07 19:59:11 +11:00

96 lines
4.2 KiB
YAML

networks:
app-network:
driver: bridge
ipam:
config:
- subnet: 172.100.0.0/16
services:
backend-prod:
image: backend-prod
build:
context: ./backend
dockerfile: Dockerfile
restart: unless-stopped
container_name: backend-prod
networks:
- app-network
depends_on:
timescaledb-prod:
condition: service_healthy
ports:
#adjust the port for the API here. For example, "6000:5000" would expose port 6000 instead
#Changing the exposed port requires updating API_BASE_URL in the root .env and rebuilding the frontend
- "5000:5000"
environment:
- ASPNETCORE_ENVIRONMENT=Production
#adjust the ports here if you change the exposed port on the frontend
- ALLOWED_ORIGINS=${ALLOWED_ORIGINS}
- RATE_LIMIT_EXEMPT_CIDRS=${RATE_LIMIT_EXEMPT_CIDRS:-172.100.0.0/16}
- FORWARDING_KNOWN_PROXIES=${FORWARDING_KNOWN_PROXIES:-}
- FORWARDING_KNOWN_NETWORKS=${FORWARDING_KNOWN_NETWORKS:-}
- TIMESCALE_DB_CONNECTION=Host=timescaledb-prod;Port=5432;Database=postgres;Username=${DB_USER};Password=${DB_PASSWORD}
- NSW_FUEL_API_BASE_URL=https://api.onegov.nsw.gov.au
- NSW_FUEL_API_KEY=${NSW_FUEL_API_KEY}
- NSW_FUEL_API_SECRET=${NSW_FUEL_API_SECRET}
- NSW_FUEL_API_AUTH_HEADER=${NSW_FUEL_API_AUTH_HEADER}
# Victoria (Service Victoria FairFuel). Server-side only — never expose the consumer ID
# to the browser. When empty, VIC jobs log a warning and skip.
- VIC_FUEL_API_CONSUMER_ID=${VIC_FUEL_API_CONSUMER_ID:-}
- VIC_FUEL_API_BASE_URL=${VIC_FUEL_API_BASE_URL:-https://api.fuel.service.vic.gov.au/open-data/v1}
# Western Australia (FuelWatch RSS, no auth). Set to false to disable WA ingest.
- WA_FUEL_FEED_ENABLED=${WA_FUEL_FEED_ENABLED:-true}
- WA_FUEL_FEED_BASE_URL=${WA_FUEL_FEED_BASE_URL:-https://www.fuelwatch.wa.gov.au/fuelwatch/fuelWatchRSS}
timescaledb-prod:
# Pinned exactly on purpose: a floating tag (was :pg17) let the image roll to
# ts 2.30.2 while pg_extension in the data volume stayed at 2.17.2 — Postgres
# runs the library its catalog names, and continuous-aggregate DDL then dies
# with "only immutable functions supported" (prod boot-loop 2026-10-06).
# On a MINOR bump here: docker compose pull, then
# docker exec -it timescaledb-prod psql -U <user> -d <db> -c "ALTER EXTENSION timescaledb UPDATE"
# (as the FIRST command of a fresh session), restart this container, restart
# backend-prod. On a MAJOR bump (new pgXX in the tag), the data volume cannot
# be reused: follow "Major database version upgrades (PG 17 → 18)" in README.md
# (scripts/pg18-upgrade/) — prod ran that cutover on 2026-10-07, landing on
# PG 18.6 / TS 2.30.2; the old PG17 volume was left untouched as the rollback.
# Keep in lockstep with backend/Database/Deployment/compose.yaml and the
# Testcontainers image in TimescaleDbFixture.cs.
image: timescale/timescaledb-ha:pg18.6-ts2.30.2
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_USER=${DB_USER}
restart: unless-stopped
container_name: timescaledb-prod
networks:
- app-network
#if you get a `initdb: error: could not change permissions of directory...` when starting this container for
#the first time, you may need to run: `sudo chown -R 1000:1000 volumes/` (or whatever UID:GID you'll be running the container as)
volumes:
- ./volumes/timescaledb-prod-pg18:/home/postgres/pgdata/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
interval: 10s
timeout: 5s
retries: 5
frontend-prod:
image: frontend-prod
build:
context: ./frontend
dockerfile: Dockerfile
args:
- NEXT_PUBLIC_API_BASE_URL=${API_BASE_URL:-}
restart: unless-stopped
container_name: frontend-prod
networks:
- app-network
ports:
#adjust the port for the frontend here. For example, "8080:3000" would expose port 8080 instead
- "3000:3000"
environment:
- INTERNAL_API_BASE_URL=${INTERNAL_API_BASE_URL:-http://backend-prod:5000}
- SITE_URL=${SITE_URL:-https://fuelwizard.au}