# compose.yml
# Comose base 
name: ${COMPOSE_PROJECT_NAME:-suitecoffee}

services:

  manso:
    depends_on:
      db:
        condition: service_healthy
      tenants:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "curl -fsS http://localhost:${APP_DOCKER_PORT}/health || exit 1"]
      interval: 10s
      timeout: 3s
      retries: 10
      start_period: 20s
    restart: unless-stopped
  # app:
  #   depends_on:
  #     db:
  #       condition: service_healthy
  #     tenants:
  #       condition: service_healthy
  #   healthcheck:
  #     test: ["CMD-SHELL", "curl -fsS http://localhost:${APP_DOCKER_PORT}/health || exit 1"]
  #     interval: 10s
  #     timeout: 3s
  #     retries: 10
  #     start_period: 20s
  #   restart: unless-stopped

  # auth:
  #   depends_on:
  #     db:
  #       condition: service_healthy
  #   healthcheck:
  #     test: ["CMD-SHELL", "curl -fsS http://localhost:${AUTH_DOCKER_PORT}/health || exit 1"]
  #     interval: 10s
  #     timeout: 3s
  #     retries: 10
  #     start_period: 15s
  #   restart: unless-stopped

  db:
    image: postgres:16
    environment:
      TZ: America/Montevideo
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
      interval: 5s
      timeout: 3s
      retries: 20
      start_period: 10s
    restart: unless-stopped

  tenants:
    image: postgres:16
    environment:
      TZ: America/Montevideo
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${TENANTS_DB_USER} -d ${TENANTS_DB_NAME}"]
      interval: 5s
      timeout: 3s
      retries: 20
      start_period: 10s
    restart: unless-stopped