services:

  debezium:
    image: quay.io/debezium/server:3.0.7.Final
    container_name: debezium
    healthcheck:
      test: curl http://debezium:8080/q/health || exit 1
      interval: 5s
      timeout: 5s
      retries: 5
    depends_on:
      mysql:
        condition: service_healthy
      rabbitmq:
        condition: service_healthy
    ports:
      - "8888:8080"
      - "9404:9404"
    environment:
      - ENABLE_DEBEZIUM_SCRIPTING=true
    volumes:
      - ./debezium-config:/debezium/config:readonly
  
  mysql:
    image: mysql:8.0.41
    platform: linux/x86_64
    container_name: debezium-mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_PASSWORD: root
      MYSQL_TCP_PORT: 8779
      MYSQL_DATABASE: producer
    volumes:
      - mysql-data:/var/lib/mysql     
    expose:
      - 8779
    ports:
      - 8779:8779
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s
  
  rabbitmq:
    image: rabbitmq:3.13-management
    container_name: rabbitmq
    hostname: docker-rabbitmq
    ports:
      - "5671:5672"
      - "15671:15672"
      - "15691:15692"
    restart: always
    healthcheck:
      test: ["CMD", "rabbitmqctl", "status"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s

volumes:
  mysql-data:
