TiagoMSSantos/MobileRT

View on GitHub
deploy/docker-compose.yml

Summary

Maintainability
Test Coverage
###############################################################################
# README
###############################################################################
# This docker-compose file executes MobileRT in a docker container.
###############################################################################
###############################################################################

version: '3.5'

networks:
    cluster:
        driver: bridge

services:
    MobileRT:
        build: .
        image: ptpuscas/mobile_rt:ubuntu-24.04
        hostname: MobileRT
        networks:
            - cluster
        environment:
            DISPLAY: ${DISPLAY}
#        command: hostname -i
        volumes:
            - /tmp/.X11-unix:/tmp/.X11-unix

    zookeeper:
        image: confluentinc/cp-zookeeper:7.8.0
        hostname: zookeeper
        container_name: zookeeper
        ports:
            - "2181:2181"
        environment:
            ZOOKEEPER_CLIENT_PORT: 2181
            ZOOKEEPER_TICK_TIME: 2000

    broker:
        image: confluentinc/cp-kafka:7.8.0
        hostname: broker
        container_name: broker
        depends_on:
            - zookeeper
        ports:
            - "29092:29092"
            - "9092:9092"
            - "9101:9101"
        environment:
            KAFKA_BROKER_ID: 1
            KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
            KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
            KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
            KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
            KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
            KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
            KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
            KAFKA_JMX_PORT: 9101
            KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'

    schema-registry:
        image: confluentinc/cp-schema-registry:7.8.0
        hostname: schema-registry
        container_name: schema-registry
        depends_on:
            - zookeeper
            - broker
        ports:
            - "8081:8081"
        environment:
            SCHEMA_REGISTRY_HOST_NAME: schema-registry
            SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'zookeeper:2181'

    connect:
        image: cnfldemos/kafka-connect-datagen:0.6.4-7.6.0
        hostname: connect
        container_name: connect
        depends_on:
            - zookeeper
            - broker
            - schema-registry
        ports:
            - "8083:8083"
        environment:
            CONNECT_BOOTSTRAP_SERVERS: 'broker:29092'
            CONNECT_REST_ADVERTISED_HOST_NAME: connect
            CONNECT_REST_PORT: 8083
            CONNECT_GROUP_ID: compose-connect-group
            CONNECT_CONFIG_STORAGE_TOPIC: docker-connect-configs
            CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1
            CONNECT_OFFSET_FLUSH_INTERVAL_MS: 10000
            CONNECT_OFFSET_STORAGE_TOPIC: docker-connect-offsets
            CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1
            CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status
            CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1
            CONNECT_KEY_CONVERTER: org.apache.kafka.connect.storage.StringConverter
            CONNECT_VALUE_CONVERTER: org.apache.kafka.connect.storage.StringConverter
            CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: http://schema-registry:8081
            CONNECT_INTERNAL_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
            CONNECT_INTERNAL_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
            CONNECT_ZOOKEEPER_CONNECT: 'zookeeper:2181'
            CONNECT_PLUGIN_PATH: "/usr/share/java,/usr/share/confluent-hub-components"
            CONNECT_LOG4J_LOGGERS: org.apache.zookeeper=ERROR,org.I0Itec.zkclient=ERROR,org.reflections=ERROR

    ksqldb-server:
        image: confluentinc/cp-ksqldb-server:7.8.0
        hostname: ksqldb-server
        container_name: ksqldb-server
        depends_on:
            - broker
            - connect
        ports:
            - "8088:8088"
        environment:
            KSQL_CONFIG_DIR: "/etc/ksql"
            KSQL_BOOTSTRAP_SERVERS: "broker:29092"
            KSQL_HOST_NAME: ksqldb-server
            KSQL_LISTENERS: "http://0.0.0.0:8088"
            KSQL_CACHE_MAX_BYTES_BUFFERING: 0
            KSQL_KSQL_SCHEMA_REGISTRY_URL: "http://schema-registry:8081"
            KSQL_PRODUCER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor"
            KSQL_CONSUMER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor"
            KSQL_KSQL_CONNECT_URL: "http://connect:8083"

    ksqldb-cli:
        image: confluentinc/cp-ksqldb-cli:7.8.0
        container_name: ksqldb-cli
        depends_on:
            - broker
            - connect
            - ksqldb-server
        entrypoint: /bin/sh
        tty: true

    ksql-datagen:
        image: confluentinc/ksqldb-examples:7.8.0
        hostname: ksql-datagen
        container_name: ksql-datagen
        depends_on:
            - ksqldb-server
            - broker
            - schema-registry
            - connect
        command: "sh -c 'echo Waiting for Kafka to be ready... && \
                       cub kafka-ready -b broker:29092 1 40 && \
                       echo Waiting for Confluent Schema Registry to be ready... && \
                       cub sr-ready schema-registry 8081 40 && \
                       echo Waiting a few seconds for topic creation to finish... && \
                       sleep 11 && \
                       tail -f /dev/null'"
        environment:
            KSQL_CONFIG_DIR: "/etc/ksql"
            STREAMS_BOOTSTRAP_SERVERS: broker:29092
            STREAMS_SCHEMA_REGISTRY_HOST: schema-registry
            STREAMS_SCHEMA_REGISTRY_PORT: 8081

    rest-proxy:
        image: confluentinc/cp-kafka-rest:7.8.0
        depends_on:
            - zookeeper
            - broker
            - schema-registry
        ports:
            - 8082:8082
        hostname: rest-proxy
        container_name: rest-proxy
        environment:
            KAFKA_REST_HOST_NAME: rest-proxy
            KAFKA_REST_BOOTSTRAP_SERVERS: 'broker:29092'
            KAFKA_REST_LISTENERS: "http://0.0.0.0:8082"
            KAFKA_REST_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'