diff --git a/create_topic.sh b/create_topic.sh new file mode 100644 index 00000000..79bc1de0 --- /dev/null +++ b/create_topic.sh @@ -0,0 +1,5 @@ +#/bin/bash + +/opt/bitnami/kafka/bin/kafka-topics.sh --create --topic mempool-tx-topic --bootstrap-server kafka:9092 +/opt/bitnami/kafka/bin/kafka-topics.sh --create --topic ledger-tx-topic --bootstrap-server kafka:9092 +/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server kafka:9092 --list diff --git a/docker-compose.yml b/docker-compose.yml index 4ab1fa1f..8f8dd42e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: image: bitnami/kafka:3.4.0 container_name: kafka restart: always + ports: + - "9092:9092" environment: KAFKA_ENABLE_KRAFT: "yes" KAFKA_CFG_PROCESS_ROLES: "broker,controller" @@ -15,7 +17,7 @@ services: KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: "1@kafka:9093" KAFKA_CFG_NODE_ID: "1" healthcheck: - test: ["CMD-SHELL", "kafka-topics.sh --bootstrap-server kafka:9092 --topic hc --create --if-not-exists && kafka-topics.sh --bootstrap-server kafka:9092 --topic hc --describe"] + test: [ "CMD-SHELL", "kafka-topics.sh --bootstrap-server kafka:9092 --topic hc --create --if-not-exists && kafka-topics.sh --bootstrap-server kafka:9092 --topic hc --describe" ] timeout: 10s interval: 15s retries: 5 @@ -23,6 +25,18 @@ services: - "kafka-data:/bitnami/kafka" networks: - spectrum-network + init-kafka: + image: bitnami/kafka:3.4.0 + container_name: init-kafka + working_dir: /opt/bitnami/kafka/bin + command: [ "/bin/bash", "/etc/create_topic.sh" ] + depends_on: + kafka: + condition: service_healthy + volumes: + - "./create_topic.sh:/etc/create_topic.sh:rw" + networks: + - spectrum-network redis: image: redis:7.0-alpine container_name: redis @@ -33,6 +47,7 @@ services: - spectrum-network utxo-tracker: image: spectrumlabs/ergo-utxo-tracker:latest + container_name: ergo-utxo-tracker volumes: - "log-data:/var/log/dex-backend" env_file: config.env @@ -43,6 +58,7 @@ services: - spectrum-network amm-executor: image: spectrumlabs/ergo-amm-executor:latest + container_name: ergo-amm-executor restart: always volumes: - "log-data:/var/log/dex-backend" @@ -65,6 +81,7 @@ services: - spectrum-network events-tracker: image: spectrumlabs/ergo-bots-tracker:latest + container_name: ergo-events-tracker volumes: - "log-data:/usr/src/events-streaming/log" - "${PWD}/rocks/tracker:/tmp/chain" @@ -75,6 +92,8 @@ services: condition: service_healthy utxo-tracker: condition: service_started + init-kafka: + condition: service_started networks: - spectrum-network