Files
openlan-cgw/utils/docker/docker-compose.yml
Oleksandr Mazur abb99f544c Add proper all-in-one make job
This change makes it possibly to fire make all / make run
without any additional prerequisites required.
It instructs Makefile to launch docker compose for thirdparty
services, as well as instructs CGW container to communicate
with newly created containers.
Also generates self-signed certs, in case if these are missing.

- Tweak docker-compose files for thirdparty services to resign
  in a cgw-dedicated network, and use hostnames where needed;
- Change CGW app default network to cgw-dedicated network;
- Tweak PGSQL scripts to create tables in CGW DB, as well
  as change ownership to them.

Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
2024-10-02 14:37:13 +03:00

79 lines
2.2 KiB
YAML

version: '3.9'
services:
broker:
image: docker.io/bitnami/kafka:latest
ports:
- "9092:9092"
- "9094:9094"
environment:
- KAFKA_ENABLE_KRAFT=yes
- KAFKA_CFG_PROCESS_ROLES=broker,controller
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://docker-broker-1:9092,EXTERNAL://kafka_b:9094
- KAFKA_BROKER_ID=1
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@docker-broker-1:9093
- ALLOW_PLAINTEXT_LISTENER=yes
- KAFKA_CFG_NODE_ID=1
- KAFKA_AUTO_CREATE_TOPICS_ENABLE=true
- BITNAMI_DEBUG=yes
- KAFKA_CFG_NUM_PARTITIONS=2
healthcheck:
test: ["CMD-SHELL", "kafka-topics.sh --bootstrap-server localhost:9092 --list"]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s
networks:
- cgw_network
postgresql:
image: "postgres:latest"
ports:
- "5432:5432"
user: postgres
command:
- "postgres"
- "-c"
- "max_connections=400"
- "-c"
- "shared_buffers=20MB"
env_file:
- postgresql.env
restart: always
volumes:
- ./postgresql/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh
networks:
- cgw_network
redis:
image: 'bitnami/redis:latest'
ports:
- "6379:6379"
environment:
- ALLOW_EMPTY_PASSWORD=yes
networks:
- cgw_network
init-broker-container:
image: docker.io/bitnami/kafka:latest
depends_on:
- broker
entrypoint: [ '/bin/sh', '-c' ]
command: |
"
# rather than giving sleep 15 use this
# to block init container to wait for Kafka broker to be ready
kafka-topics --bootstrap-server broker:9092 --list
# create CnC and CnC_Res topics
kafka-topics.sh --create --partitions 2 --bootstrap-server broker:9092 --topic CnC
kafka-topics.sh --create --bootstrap-server broker:9092 --partitions 2 --topic CnC_Res
"
networks:
- cgw_network
networks:
cgw_network: