services:
  db:
    image: postgres:17
    restart: unless-stopped
    environment:
      TZ: ${TZ}
      POSTGRES_USER: ${PD_DB_USER}
      POSTGRES_PASSWORD: ${PD_DB_PASSWORD}
      POSTGRES_DB: ${PD_DB_DATABASE}
    ports:
      - 5432:5432
    volumes:
      - db_data:/var/lib/postgresql/data

  apiproxy:
    image: manticorum67/paper-dynasty-apiproxy:dev
    restart: unless-stopped
    environment:
      TZ: ${TZ}
      PRODUCTION: False
      JWT_SECRET: ${PD_JWT_SECRET}
    ports:
      - 8000:8000
    volumes:
      - ./logs:/app/logs

  adminer:
    image: adminer
    restart: always
    environment:
      TZ: ${TZ}
    ports:
      - 8088:8080

  postgrest:
    image: postgrest/postgrest
    ports:
      - "3000:3000"
    environment:
      TZ: ${TZ}
      PGRST_DB_URI: "postgres://${PD_DB_USER}:${PD_DB_PASSWORD}@db:5432/${PD_DB_DATABASE}"
      PGRST_OPENAPI_SERVER_PROXY_URI: ${PD_API_URL}
      PGRST_DB_ANON_ROLE: web_anon
      PGRST_JWT_SECRET: ${PD_JWT_SECRET}
    depends_on:
      - db

  swagger:
    image: swaggerapi/swagger-ui
    ports:
      - "8080:8080"
    expose:
      - "8080"
    environment:
      TZ: ${TZ}
      PD_API_URL: ${PD_API_URL}
    depends_on:
      - db

  # pgadmin:
  #   image: dpage/pgadmin4
  #   ports:
  #     - "8082:80"
  #   environment:
  #     TZ: ${TZ}
  #     PGADMIN_DEFAULT_EMAIL: cal.corum@gmail.com
  #     PGADMIN_DEFAULT_PASSWORD: ${PD_DB_PASSWORD}
  #     POSTGRES_HOST: postgreshost
  #     POSTGRES_USER: ${PD_DB_USER}
  #     POSTGRES_PASSWORD: ${PD_DB_PASSWORD}
  #     POSTGRES_DB: db
  #     PGADMIN_CONFIG_SERVER_MODE: False
  #     PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: False
  #   volumes:
  #     - pgadmin-data:/var/lib/pgadmin


volumes:
  db_data:
  pgadmin-data: