version: "3"
services:
  killbill:
    build: .
    container_name: killbill
    depends_on:
      - "db"
    links:
      - db
    command: bash -c 'while !</dev/tcp/db/3306; do sleep 5; done; bash run.sh'
    ports:
      - "8080:8080"
      - "8000:8000"
      - "12345:12345"
    environment:
      - KILLBILL_DAO_URL=jdbc:mysql://db:3306/killbill
      - KILLBILL_DAO_USER=root
      - KILLBILL_DAO_PASSWORD=killbill
      - JAVA_OPTS=${JAVA_OPTS:-"-Xms4096m -Xmx6124m"}
      - TRACER_ENABLE=${TRACER_ENABLE:-true}
      - TRACER_MINIMUM_EXECUTION_TIME=${TRACER_MINIMUM_EXECUTION_TIME:-1}
      - TRACER_SERIALISE_INTERNALS=false
      - TRACER_VERBOSE=true
      - TRACER_TRACES=/caching-approaches-comparison/applications/traces/killbill
      - TRACER_IGNORED_PACKAGES=/caching-approaches-comparison/applications/uncached/killbill/ignored
      - TRACER_WHITELIST=/caching-approaches-comparison/applications/uncached/killbill/whitelist
      - TRACER_LOG=/caching-approaches-comparison/applications/output/killbill-tracer.log
    volumes:
      - application:/application
      - /root/.m2:/root/.m2
      - ../../../:/caching-approaches-comparison
    restart: unless-stopped
    logging:
      options:
        max-size: "10m"
        max-file: "10"

  db:
    image: mariadb:10.4
    expose:
      - 3306
    volumes:
      - ../../dumps/killbill.sql:/docker-entrypoint-initdb.d/init.sql
      - database:/var/lib/mysql
    environment:
      MYSQL_USER: root
      MYSQL_ROOT_PASSWORD: killbill
      MYSQL_DATABASE: killbill
    restart: unless-stopped
    logging:
      options:
        max-size: "10m"
        max-file: "10"

volumes:
  application:
  database:
