-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
185 lines (172 loc) · 5.71 KB
/
Copy pathdocker-compose.yml
File metadata and controls
185 lines (172 loc) · 5.71 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
services:
kafka:
image: confluentinc/cp-kafka:7.6.0
container_name: kafka
ports:
- "9092:9092"
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,CONTROLLER:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://0.0.0.0:9092,CONTROLLER://kafka:9093
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
CLUSTER_ID: MkU3OEVBNTcwNTJENDM2Qw
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: "false"
KAFKA_LOG_DIRS: /var/lib/kafka/data
volumes:
- kafka_data:/var/lib/kafka/data
healthcheck:
test: ["CMD", "kafka-broker-api-versions", "--bootstrap-server", "localhost:9092"]
interval: 15s
timeout: 10s
retries: 5
kafka-init:
image: confluentinc/cp-kafka:7.6.0
container_name: kafka-init
depends_on:
kafka:
condition: service_healthy
entrypoint: ["/bin/bash", "-c"]
command: |
"
kafka-topics --create --if-not-exists --bootstrap-server kafka:29092 --partitions 3 --replication-factor 1 --topic metrics.raw
kafka-topics --create --if-not-exists --bootstrap-server kafka:29092 --partitions 3 --replication-factor 1 --topic logs.raw
kafka-topics --create --if-not-exists --bootstrap-server kafka:29092 --partitions 3 --replication-factor 1 --topic features.processed
kafka-topics --create --if-not-exists --bootstrap-server kafka:29092 --partitions 3 --replication-factor 1 --topic anomalies.detected
kafka-topics --create --if-not-exists --bootstrap-server kafka:29092 --partitions 3 --replication-factor 1 --topic incidents.created
kafka-topics --create --if-not-exists --bootstrap-server kafka:29092 --partitions 3 --replication-factor 1 --topic k8s.pods
kafka-topics --create --if-not-exists --bootstrap-server kafka:29092 --partitions 3 --replication-factor 1 --topic k8s.deployments
kafka-topics --create --if-not-exists --bootstrap-server kafka:29092 --partitions 3 --replication-factor 1 --topic k8s.events
kafka-topics --create --if-not-exists --bootstrap-server kafka:29092 --partitions 3 --replication-factor 1 --topic k8s.nodes
echo 'Topics created.'
"
restart: on-failure
postgres:
image: postgres:16-alpine
container_name: postgres
ports:
- "5432:5432"
environment:
POSTGRES_DB: astraquant-db
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME} -d astraquant-db -h localhost -p 5432"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: backend
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/astraquant-db
SPRING_DATASOURCE_USERNAME: ${DB_USERNAME}
SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD}
SPRING_KAFKA_BOOTSTRAP_SERVERS: kafka:29092
SPRING_DATA_REDIS_HOST: redis
SPRING_DATA_REDIS_PORT: 6379
GEMINI_KEY: ${GEMINI_KEY}
JWT_SECRET: ${JWT_SECRET}
AGENT_SERVICE_URL: http://ai:8000
depends_on:
postgres:
condition: service_healthy
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
ai:
condition: service_started
ai:
build:
context: ./ai
dockerfile: Dockerfile
container_name: ai
ports:
- "8000:8000"
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:29092
REDIS_HOST: redis
REDIS_PORT: 6379
GOOGLE_API_KEY: ${GEMINI_KEY}
BACKEND_URL: http://backend:8080
depends_on:
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
redis:
condition: service_healthy
k8s-collector:
build:
context: ./ai
dockerfile: k8s-collector/Dockerfile
container_name: k8s-collector
network_mode: host
environment:
KAFKA_BOOTSTRAP_SERVERS: localhost:9092
K8S_POLL_INTERVAL: "30"
volumes:
- ${HOME}/.kube/config:/root/.kube/config:ro
depends_on:
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
anomaly-service:
build:
context: ./ai
dockerfile: anomaly-service/Dockerfile
container_name: anomaly-service
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:29092
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: astraquant-db
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
volumes:
- ./ai/anomaly-service/model:/app/model
depends_on:
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
postgres:
condition: service_healthy
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: frontend
ports:
- "3000:3000"
environment:
NEXT_PUBLIC_API_URL: http://localhost:8080
depends_on:
- backend
volumes:
postgres_data:
kafka_data: