-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
196 lines (183 loc) · 5.85 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
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
186
187
188
189
190
191
192
193
194
195
196
version: "3"
services:
resizer1:
image: ghcr.io/baklanov-soft/image-hosting-processing-resizer:master
container_name: resizer1
depends_on:
- kafka-init-new-images
- minio
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:9092
CONSUMER_GROUP_ID: resizer-local-test
MINIO_HOST: "http://minio:9000"
MINIO_USER: minioadmin
MINIO_PASSWORD: minioadmin
NEW_IMAGES_TOPIC: "new-images.v1"
resizer2:
image: ghcr.io/baklanov-soft/image-hosting-processing-resizer:master
container_name: resizer2
depends_on:
- kafka-init-new-images
- minio
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:9092
CONSUMER_GROUP_ID: resizer-local-test
MINIO_HOST: "http://minio:9000"
MINIO_USER: minioadmin
MINIO_PASSWORD: minioadmin
NEW_IMAGES_TOPIC: "new-images.v1"
recognizer1:
image: ghcr.io/baklanov-soft/image-hosting-processing-recognizer:master
container_name: recognizer1
depends_on:
- kafka-init-new-images
- kafka-init-categories
- minio
volumes:
- recognizer1-djl-cache:/root/.djl.ai
- "./recognizer/synset.txt:/opt/app/nsfw/synset.txt"
# download it from here https://huggingface.co/DenisNovac/nsfw_image_detection/
- "./recognizer/nsfw_model.pt:/opt/app/nsfw/nsfw_model.pt"
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:9092
CONSUMER_GROUP_ID: recognizer-local-test
NEW_IMAGES_TOPIC: "new-images.v1"
CATEGORIES_TOPIC: "categories.v1"
ENABLE_NSFW_DETECTION: true
NSFW_SYNSET_PATH: "nsfw/synset.txt"
NSFW_MODEL_PATH: "nsfw/nsfw_model.pt"
MINIO_HOST: "http://minio:9000"
MINIO_USER: minioadmin
MINIO_PASSWORD: minioadmin
DEBUG_CATEGORIES: true
recognizer2:
image: ghcr.io/baklanov-soft/image-hosting-processing-recognizer:master
container_name: recognizer2
depends_on:
- kafka-init-new-images
- kafka-init-categories
- minio
volumes:
- recognizer2-djl-cache:/root/.djl.ai
- "./recognizer/synset.txt:/opt/app/nsfw/synset.txt"
# download it from here https://huggingface.co/DenisNovac/nsfw_image_detection/
- "./recognizer/nsfw_model.pt:/opt/app/nsfw/nsfw_model.pt"
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:9092
CONSUMER_GROUP_ID: recognizer-local-test
NEW_IMAGES_TOPIC: "new-images.v1"
CATEGORIES_TOPIC: "categories.v1"
ENABLE_NSFW_DETECTION: true
NSFW_SYNSET_PATH: "nsfw/synset.txt"
NSFW_MODEL_PATH: "nsfw/nsfw_model.pt"
MINIO_HOST: "http://minio:9000"
MINIO_USER: minioadmin
MINIO_PASSWORD: minioadmin
DEBUG_CATEGORIES: true
kafka:
container_name: kafka
image: bitnami/kafka:3.8
ports:
- "9094:9094"
environment:
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_CFG_LISTENERS: INTERNAL://kafka:9092,CONTROLLER://kafka:9093,EXTERNAL://:9094
KAFKA_CFG_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,EXTERNAL://localhost:9094
KAFKA_CFG_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER
# cluster config
KAFKA_KRAFT_CLUSTER_ID: LelM2dIFQkiUFvXCEcqRWA
KAFKA_CFG_NODE_ID: 0
KAFKA_CFG_PROCESS_ROLES: controller,broker
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka:9093
minio:
container_name: minio
image: quay.io/minio/minio:RELEASE.2024-09-13T20-26-02Z
command: server --console-address ":9001" /data
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio-data:/data
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
postgres:
container_name: postgres
image: postgres:16.4-alpine3.20
volumes:
- db-data:/var/lib/postgresql/data
environment:
POSTGRES_DB: image_hosting
POSTGRES_USER: image_hosting
POSTGRES_PASSWORD: P@ssw0rd
ports:
- "5432:5432"
healthcheck:
test: [ "CMD", "pg_isready", "-d", "image_hosting", "-U", "image_hosting" ]
interval: 10s
timeout: 5s
retries: 3
command: [ "postgres", "-c", "log_statement=all" ]
image-hosting-webapi:
container_name: image-hosting-webapi
image: image-hosting-storage-webapi
environment:
Minio__Endpoint: minio:9000
Minio__AccessKey: minioadmin
Minio__SecretKey: minioadmin
Minio__Secure: false
ConnectionStrings__ImageHosting: "Host=postgres;Port=5432;Database=image_hosting;Username=image_hosting;Password=P@ssw0rd;Include Error Detail=true"
ASPNETCORE_ENVIRONMENT: Development
Kafka__BootstrapServers__0: kafka:9092
Kafka__NewImagesProducer__TopicName: new-images.v1
ports:
- "8080:8080"
depends_on:
minio:
condition: service_started
postgres:
condition: service_healthy
kafka-init-new-images:
container_name: kafka-init-new-images
image: bitnami/kafka:3.8
depends_on:
- kafka
entrypoint: "kafka-topics.sh"
command: [
"--bootstrap-server", "kafka:9092",
"--create",
"--replication-factor", "1",
"--partitions", "2",
"--topic", "new-images.v1"
]
kafka-init-categories:
container_name: kafka-init-categories
image: bitnami/kafka:3.8
depends_on:
- kafka
entrypoint: "kafka-topics.sh"
command: [
"--bootstrap-server", "kafka:9092",
"--create",
"--replication-factor", "1",
"--partitions", "2",
"--topic", "categories.v1"
]
kafka-ui:
image: provectuslabs/kafka-ui
container_name: kafka-ui
ports:
- "8000:8000"
environment:
SERVER_PORT: 8000
KAFKA_CLUSTERS_0_NAME: image-hosting
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092
KAFKA_CLUSTERS_0_READONLY: true
depends_on:
- kafka
volumes:
minio-data:
db-data:
recognizer1-djl-cache:
recognizer2-djl-cache: