name: acquire-core-x

services:
  db:
    image: postgres:15
    environment:
      POSTGRES_DB: acq
      POSTGRES_USER: acq
      POSTGRES_PASSWORD: acq
    # XA / 2-phase commit needs prepared transactions enabled.
    command: ["-c", "max_prepared_transactions=100"]
    volumes:
      - ../db/schema.d:/docker-entrypoint-initdb.d:ro
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U acq -d acq"]
      interval: 3s
      timeout: 3s
      retries: 20
    networks:
      - acqnet

  app:
    image: acquire-x/endurox:7.0.12
    depends_on:
      db:
        condition: service_healthy
    # Enduro/X posix-mqueue runtime requirements (ndrxd won't boot otherwise).
    sysctls:
      fs.mqueue.msg_max: "512"
      fs.mqueue.msgsize_max: "65536"
      # ~330 서비스 = 330+ POSIX 큐. 기본 queues_max(256) 초과 → 11 모듈서버 부팅 실패하므로 상향.
      fs.mqueue.queues_max: "8192"
    ulimits:
      msgqueue: 2147483648
      nofile: 65536
    ports:
      - "8090:8090"   # 업무화면 게이트웨이 (브라우저 → tpcall)
    volumes:
      - ../app:/app
    working_dir: /app
    entrypoint: ["/bin/bash", "/app/entrypoint.sh"]
    networks:
      - acqnet

networks:
  acqnet:
    driver: bridge
