-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
125 lines (113 loc) · 3.22 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
x-db-host: &db-host postgres
x-db-name: &db-name bill_split
x-db-user: &db-user ${USER}
x-db-password: &db-password password
x-db-port: &db-port 5432
x-db-env: &db-env
DB_HOST: *db-host
DB_NAME: *db-name
DB_USER: *db-user
DB_PASSWORD: *db-password
DB_PORT: *db-port
x-aws-env: &aws-env
AWS_REGION: us-west-1
AWS_BILL_IMAGE_S3_BUCKET: bill-split-images
AWS_ACCESS_KEY: ${AWS_ACCESS_KEY}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
x-kafka-host: &kafka-host kafka
x-kafka-port: &kafka-port 9092
x-kafka-bill-processing-topic: &kafka-bill-processing-topic bills-to-process
x-bill-processor-url: &bill-processor-url http://bill-processor:8080/2015-03-31/functions/function/invocations
services:
postgres:
container_name: postgres
image: postgres:17
environment:
POSTGRES_DB: bill_split
POSTGRES_USER: ${USER}
POSTGRES_PASSWORD: password
ports:
- "5432:5432"
restart: always
volumes:
- postgres_data:/var/lib/postgresql/data
# This will run all sql migration scripts. In order to run the init scripts
# again you may need to delete the postgres volumes.
db-migrations:
build:
context: projects/db
target: dev
depends_on:
- postgres
environment:
<<: *db-env
init: true
kafka:
container_name: kafka
image: apache/kafka:3.9.0
ports:
- "29092:29092"
environment:
KAFKA_NODE_ID: 1
KAFKA_LISTENERS: INTERNAL://:9092,EXTERNAL_SAME_HOST://:29092,CONTROLLER://kafka:9093
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,EXTERNAL_SAME_HOST://localhost:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL_SAME_HOST:PLAINTEXT,CONTROLLER:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_PROCESS_ROLES: 'controller,broker'
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:9093'
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
kafka-init:
build:
context: projects/kafka
target: dev
depends_on:
- kafka
environment:
KAFKA_HOST: *kafka-host
KAFKA_PORT: *kafka-port
KAFKA_BILL_PROCESSING_TOPIC: *kafka-bill-processing-topic
gateway:
build:
context: projects/gateway
target: dev
container_name: gateway
depends_on:
- kafka-init
develop:
watch:
- action: sync
path: ./projects/gateway
target: /app
ignore:
- node_modules/
- action: rebuild
path: package.json
environment:
<<: [*db-env, *aws-env]
KAFKA_HOST: *kafka-host
KAFKA_PORT: *kafka-port
KAFKA_BILL_PROCESSING_TOPIC: *kafka-bill-processing-topic
BILL_PROCESSOR_URL: *bill-processor-url
ports:
- "8080:8080"
bill-processor:
build:
context: projects/bill-processor
container_name: bill-processor
develop:
watch:
- action: sync
path: ./projects/bill-processor
target: /usr/app
ignore:
- node_modules/
- action: rebuild
path: package.json
environment:
<<: *aws-env
KAFKA_BILL_PROCESSING_TOPIC: *kafka-bill-processing-topic
ports:
- "9000:8080"
volumes:
postgres_data: