Repository navigation
Expand file tree
/
Copy pathdocker-compose-databases.yml
More file actions
118 lines (116 loc) · 3.65 KB
/
Copy pathdocker-compose-databases.yml
File metadata and controls
118 lines (116 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Freeze the Docker Compose project name so every checkout/worktree uses the
# same local database containers and Compose-managed resources.
# Local setup is single-instance by design.
name: macro
services:
postgres:
image: pgvector/pgvector:pg16
healthcheck:
test: ["CMD-SHELL", "pg_isready -U user"]
interval: 2s
timeout: 5s
retries: 15
ports:
- '5432:5432'
expose:
- '5432'
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=password
- PGPASSWORD=password
volumes:
- db:/var/lib/postgresql/data
networks:
- databases
redis:
image: 'redis/redis-stack:latest'
ports:
- '6379:6379' # Expose Redis on the default port
- '8001:8001' # Expose Redis Stack Server UI/tools
environment:
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- cache:/data
networks:
- databases
kafka:
# Local analog of the MSK cluster's `3.9.x.kraft` version: single-node
# KRaft where this node is both broker and controller.
image: apache/kafka:3.9.1
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:29093
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
# Dual listeners: `kafka:29092` for containers on the databases network,
# `localhost:9092` for processes on the host.
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:29092,PLAINTEXT_HOST://0.0.0.0:9092,CONTROLLER://0.0.0.0:29093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,CONTROLLER:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
# Single broker: internal topics can't replicate beyond 1.
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_LOG_DIRS: /var/lib/kafka/data
# Fixed cluster id (base64url UUID) so the persistent volume survives
# container recreation without a cluster-id mismatch on restart.
CLUSTER_ID: TWFjcm9Mb2NhbEthZmthMQ
healthcheck:
test: /opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server localhost:9092 > /dev/null 2>&1
interval: 5s
timeout: 10s
retries: 20
ports:
- '9092:9092'
volumes:
- kafka_data:/var/lib/kafka/data
networks:
- databases
search:
build:
context: ./infra/local/opensearch
image: macro-local-opensearch:dev
environment:
cluster.name: search
discovery.type: single-node
node.name: search
plugins.security.disabled: true
bootstrap.memory_lock: true
OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m" # Set min and max JVM heap sizes to at least 50% of system RAM
OPENSEARCH_INITIAL_ADMIN_PASSWORD: "yourStrongPassword123!"
healthcheck:
interval: 10s
retries: 80
test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:9200/
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
ports:
- 9200:9200 # REST API
- 9600:9600 # Performance Analyzer
networks:
- databases
volumes:
- opensearch_data:/usr/share/opensearch/data
networks:
databases:
external: true
volumes:
db:
name: macro_postgres_data
external: true
cache:
name: macro_redis_data
external: true
opensearch_data:
name: macro_opensearch_data
external: true
kafka_data:
name: macro_kafka_data
external: true