version: "3" services: ####################################################### # Postgres ####################################################### postgres: profiles: [ postgres, postgres-all, all, all-no-ui, ci ] image: postgres:15.1-alpine container_name: postgres environment: - POSTGRES_DB=postgres - POSTGRES_PASSWORD=Password12! ports: - "5432:5432" networks: - postgres pgadmin: profiles: [ postgres-ui, postgres-all, all ] image: dpage/pgadmin4 container_name: pgadmin environment: PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-admin@pgadmin.org} PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin} ports: - "${PGADMIN_PORT:-5050}:80" networks: - postgres jaeger: profiles: [ otel, otel-all, all ] image: jaegertracing/all-in-one:latest ports: - "5775:5775/udp" - "6831:6831/udp" - "6832:6832/udp" - "5778:5778" - "16686:16686" - "14268:14268" - "9411:9411" ####################################################### # EventStoreDB ####################################################### eventstore.db: profiles: [ eventstoredb, eventstoredb-all, all, all-no-ui, ci ] image: eventstore/eventstore:23.10.0-bookworm-slim # use this image if you're running ARM-based proc like Apple M1 # image: eventstore/eventstore:23.10.0-alpha-arm64v8 environment: - EVENTSTORE_CLUSTER_SIZE=1 - EVENTSTORE_RUN_PROJECTIONS=All - EVENTSTORE_START_STANDARD_PROJECTIONS=true - EVENTSTORE_EXT_TCP_PORT=1113 - EVENTSTORE_HTTP_PORT=2113 - EVENTSTORE_INSECURE=true - EVENTSTORE_ENABLE_EXTERNAL_TCP=true - EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP=true ports: - '1113:1113' - '2113:2113' volumes: - type: volume source: eventstore-volume-data target: /var/lib/eventstore - type: volume source: eventstore-volume-logs target: /var/log/eventstore networks: - esdb_network ####################################################### # Elastic Search ####################################################### elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:8.13.2 profiles: [ elastic, elastic-all, all, all-no-ui, ci ] environment: - discovery.type=single-node - cluster.name=docker-cluster - node.name=docker-node - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - xpack.security.enabled=false - xpack.security.http.ssl.enabled=false - xpack.security.transport.ssl.enabled=false - network.host=0.0.0.0 - http.port=9200 - transport.host=localhost - bootstrap.memory_lock=true - cluster.routing.allocation.disk.threshold_enabled=false ulimits: memlock: soft: -1 hard: -1 volumes: - elastic-data:/usr/share/elasticsearch/data ports: - "9200:9200" - "9300:9300" networks: - es_network kibana: image: docker.elastic.co/kibana/kibana:8.13.2 profiles: [ elastic-ui, elastic-all, all ] environment: - ELASTICSEARCH_HOSTS=http://elastic_search:9200 ports: - "5601:5601" networks: - es_network depends_on: - elasticsearch ####################################################### # Kafka ####################################################### kafka: image: confluentinc/confluent-local:7.6.1 profiles: [kafka, kafka-all, all, all-no-ui] hostname: kafka container_name: kafka networks: - kafka_network ports: - "9092:9092" - "9091:9091" healthcheck: test: nc -z localhost 9092 || exit -1 interval: 5s timeout: 10s retries: 100 environment: KAFKA_NODE_ID: 1 KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT' KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092 KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 ADVERTISED_HOST_NAME: kafka KAFKA_ADVERTISED_HOSTNAME: 127.0.0.1 KAFKA_JMX_PORT: 9101 KAFKA_JMX_HOSTNAME: localhost KAFKA_PROCESS_ROLES: 'broker,controller' KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:29093' KAFKA_LISTENERS: 'PLAINTEXT://kafka:29092,CONTROLLER://kafka:29093,PLAINTEXT_HOST://0.0.0.0:9092' KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT' KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER' KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs' init-kafka: image: confluentinc/confluent-local:7.6.1 profiles: [ kafka, kafka-all, all, all-no-ui ] hostname: init-kafka container_name: init-kafka depends_on: - kafka entrypoint: [ '/bin/sh', '-c' ] networks: - kafka_network command: | " # blocks until kafka is reachable kafka-topics --bootstrap-server kafka:29092 --list echo -e 'Creating kafka topics' kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic Carts --replication-factor 1 --partitions 1 kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic Orders --replication-factor 1 --partitions 1 kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic Payments --replication-factor 1 --partitions 1 kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic Shipments --replication-factor 1 --partitions 1 echo -e 'Successfully created the following topics:' kafka-topics --bootstrap-server kafka:29092 --list " ####################################################### # Schema Registry ####################################################### schema_registry: image: confluentinc/cp-schema-registry:7.6.1 container_name: schema_registry hostname: schema_registry profiles: [ kafka-ui, kafka-all, all ] ports: - 8181:8181 - 8081:8081 depends_on: - kafka networks: - kafka_network environment: SCHEMA_REGISTRY_HOST_NAME: schema_registry SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'kafka:29092' SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_METHODS: 'GET,POST,PUT,OPTIONS' SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_ORIGIN: '*' SCHEMA_LOG4J_ROOT_LOGLEVEL: 'ERROR' SCHEMA_TOOLS_LOG4J_LOGLEVEL: 'ERROR' kafka_topics_ui: image: provectuslabs/kafka-ui:latest hostname: kafka-ui profiles: [ kafka-ui, kafka-all, all ] ports: - "8080:8080" environment: KAFKA_CLUSTERS_0_NAME: local KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:29092 networks: - kafka_network depends_on: - kafka ####################################################### # Test Backend Service ####################################################### backend: build: dockerfile: Dockerfile context: . container_name: event_sourcing_sample profiles: [sample] ports: - "5555:5000" depends_on: postgres: condition: service_healthy networks: - postgres networks: es_network: driver: bridge postgres: driver: bridge esdb_network: driver: bridge kafka_network: driver: bridge volumes: postgres: pgadmin: eventstore-volume-data: eventstore-volume-logs: elastic-data: