Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.7 kB
2
Indexable
Never
version: "3.7"

networks:
  kafka-net:
    name: kafka-net
    driver: bridge

services:
  gateway:
    build:
      context: ../gateway
      dockerfile: ../gateway/Dockerfile
    ports:
      - "8080:8080"
    links:
      - library-web-service
      - auth-service
    restart: always
    depends_on:
      - kafka
    networks:
      - kafka-net

  auth-service:
    build:
      context: ../authentication-service
      dockerfile: ../authentication-service/Dockerfile
    environment:
      - EUREKA_SERVER=http://eureka-service:8761/eureka
      - SPRING_DATASOURCE_PASSWORD=root
      - SPRING_DATASOURCE_USERNAME=root
      - SPRING_DATASOURCE_URL=jdbc:mysql://mysql-auth-service:3306/auth_db

    depends_on:
      - mysql-auth-service
      - kafka
    restart: always
    networks:
      - kafka-net
 
  library-web-service:
    build:
      context: ../library-web-service
      dockerfile: ../library-web-service/Dockerfile
    environment:
      - EUREKA_SERVER=http://eureka-service:8761/eureka
      - SPRING_DATASOURCE_PASSWORD=root
      - SPRING_DATASOURCE_USERNAME=root
      - SPRING_DATASOURCE_URL=jdbc:mysql://mysql-library-web-service:3306/library_web_db
    depends_on:
      - mysql-library-web-service
      - kafka
    restart: always
    networks:
      - kafka-net

  library-service:
    build:
      context: ../library-service
      dockerfile: ../library-service/Dockerfile
    environment:
      - EUREKA_SERVER=http://eureka-service:8761/eureka
      - SPRING_DATASOURCE_PASSWORD=root
      - SPRING_DATASOURCE_USERNAME=root
      - SPRING_DATASOURCE_URL=jdbc:mysql://mysql-library-service:3306/library_db
    depends_on:
      - mysql-library-service
      - kafka
    restart: always
    networks:
      - kafka-net

  service-registry:
    build:
      context: ../service-registry
      dockerfile: ../service-registry/Dockerfile
    ports:
      - "8761:8761"
    restart: always
    networks:
      - kafka-net

  mysql-auth-service:
    image: mysql:latest
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=auth_db
    networks:
      - kafka-net

  mysql-library-web-service:
    image: mysql:latest
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=library_web_db
    networks:
      - kafka-net

  mysql-library-service:
    image: mysql:latest
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=library_db
    networks:
      - kafka-net

  zookeeper:
    image: zookeeper:3.7.0
    container_name: zookeeper
    restart: "no"
    networks:
      - kafka-net
    ports:
      - "2181:2181"

  kafka:
    image: obsidiandynamics/kafka
    container_name: kafka
    restart: "no"
    networks:
      - kafka-net
    ports:
      - "9092:9092"
    environment:
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER_INTERNAL:PLAINTEXT,DOCKER_EXTERNAL:PLAINTEXT
      KAFKA_LISTENERS: DOCKER_INTERNAL://:29092,DOCKER_EXTERNAL://:9092
      KAFKA_ADVERTISED_LISTENERS: DOCKER_INTERNAL://kafka:29092,DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
      KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER_INTERNAL
      KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
      KAFKA_BROKER_ID: 1
      KAFKA_CLUSTER_NAME: test
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
    depends_on:
      - zookeeper

  kafdrop:
    image: obsidiandynamics/kafdrop
    container_name: kafdrop
    restart: "no"
    networks:
      - kafka-net
    ports:
      - "9000:9000"
    environment:
      KAFKA_BROKERCONNECT: "kafka:29092"
    depends_on:
      - "kafka"