# docker-compose-dev.yml: Enables port forwarding for local development in `make up`.
#
# To run directly from command-line:
#     docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d
services:
  product_staging-dev:
    ports:
      - 8888:5000

  mysql-db:
    image: 086679231553.dkr.ecr.us-east-1.amazonaws.com/docker-database-images:ows-product-staging
    pull_policy: always
    healthcheck:
      interval: 1s
      timeout: 5s
      retries: 120
    ports:
      - 33066:3306
    volumes:
      # volume for data (slower, persistent)
      - mysql_data_volume:/var/lib/mysql

  elasticmq:
    image: softwaremill/elasticmq-native:latest
    volumes:
      - ${PWD}/tests/elasticmq.conf:/opt/elasticmq.conf

  product_staging-deploy:
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/hello/"]
      interval: 5s
      timeout: 10s
      retries: 120
    depends_on:
      mysql-db:
        condition: service_healthy
      elasticmq:
        condition: service_started
    ports:
      - 8889:8080
    environment:
      - MYSQL_DB_HOST=mysql-db
      - MYSQL_DB_NAME=ows_product_staging
      - MYSQL_DB_PORT=3306
      - MYSQL_DB_USER=username
      - MYSQL_DB_PASSWORD=pass
      - SPLITIO_API_KEY=localhost
      - SPLIT_FILE_PATH=/.split
      - AWS_ENDPOINT_URL_SQS=http://elasticmq:9324
      - INGESTION_SQS_QUEUE_URL=http://elasticmq:9324/000000000000/local-bulk-session-ingest-execution-fifo-queue.fifo
    volumes:
      - ${PWD}/tests/.split:/.split

  integration-test:
    environment:
      - QA_BASE_URL=http://product_staging-deploy:8080
      - INTEGRATION_DB_HOST=mysql-db
      - INTEGRATION_DB_NAME=ows_product_staging
      - INTEGRATION_DB_PORT=3306
      - INTEGRATION_DB_USER=username
      - INTEGRATION_DB_PASSWORD=pass
    depends_on:
      product_staging-deploy:
        condition: service_healthy
      mysql-db:
        condition: service_healthy

volumes:
  mysql_data_volume:
