-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
108 lines (103 loc) · 2.76 KB
/
docker-compose.yml
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
version: '3.8'
services:
postgres:
image: postgres:16.3-alpine
container_name: ticket-db
ports:
- 5432:5432
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: ticket_db
networks:
- ticket-monster-network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U user -d ticket_db" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 10s
zookeeper:
image: confluentinc/cp-zookeeper:7.7.0
container_name: ticket-zk
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- "2181:2181"
networks:
- ticket-monster-network
kafka:
image: confluentinc/cp-kafka:7.7.0
depends_on:
- zookeeper
container_name: ticket-kafka
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
ports:
- "9092:9092"
volumes:
- ./kafka-data:/var/lib/kafka/data
networks:
- ticket-monster-network
healthcheck:
test: [ "CMD-SHELL", "kafka-broker-api-versions --bootstrap-server localhost:9092 | grep -q 'id:1'" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
# ticket-service:
# build: .
# container_name: ticket-service-1
# image: ticket-service
# restart: on-failure
# environment:
# SPRING_DATASOURCE_URL: jdbc:postgresql://ticket-db:5432/ticket_db
# SPRING_DATASOURCE_USERNAME: user
# SPRING_DATASOURCE_PASSWORD: password
# SPRING_APP_PORT: 8080
# KAFKA_BOOTSTRAP_SERVERS: ticket-kafka:9092
# ACTIVE_PROFILES_PROPERTY_NAME: production
# SPRING_PROFILES_ACTIVE: production
# env_file:
# - .env
# ports:
# - "8080:8080"
# depends_on:
# kafka:
# condition: service_started
# networks:
# - ticket-monster-network
ticket-service:
build: .
container_name: ticket-service-1
image: ticket-service
restart: on-failure
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://ticket-db:5432/ticket_db
SPRING_DATASOURCE_USERNAME: user
SPRING_DATASOURCE_PASSWORD: password
SPRING_APP_PORT: 8080
KAFKA_BOOTSTRAP_SERVERS: ticket-kafka:9092
ACTIVE_PROFILES_PROPERTY_NAME: production
SPRING_PROFILES_ACTIVE: production
env_file:
- .env
ports:
- "8080:8080"
volumes:
- ~/.m2:/root/.m2 # Mount the local Maven repository
- ./src:/opt/app/src
- ./target:/opt/app/target
depends_on:
kafka:
condition: service_started
networks:
- ticket-monster-network
command: ./mvnw spring-boot:run
networks:
ticket-monster-network:
driver: bridge