# Include syntax requires Docker compose > 2.20.3
# https://docs.docker.com/compose/release-notes/#2203
include:
  # Creates the internal MongoDB replica set
  - path: ../../services/mongo.yaml

  # Demo NodeJS backend server and front-end web client
  - path: ./ps-nodejs-demo.yaml

services:
  # Extend PowerSync with Mongo and Postgres healthchecks
  powersync:
    extends:
      file: ../../services/powersync.yaml
      service: powersync
    depends_on:
      mongo-rs-init:
        condition: service_completed_successfully
      pg-db:
        condition: service_healthy

  # Extend pg-db to include init scripts
  # The NodeJS demo creates tables and publications in `setup.sql`
  pg-db:
    extends:
      file: ../../services/postgres.yaml
      service: pg-db
    volumes:
      - ./init-scripts:/docker-entrypoint-initdb.d

volumes:
  # Postgres data
  pg_data:
