-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
201 lines (191 loc) · 7.08 KB
/
docker-compose.yml
File metadata and controls
201 lines (191 loc) · 7.08 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
services:
#----------------------------------------
# Backend services
#----------------------------------------
redis:
image: redis:7
container_name: correctomatic-redis
# Sets the password for the redis server and
# enables the appendonly mode
command: bash -c "redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}"
ports:
- "6379:6379"
db:
image: postgres:16.3
ports:
- "5432:5432"
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
volumes:
- postgres-data:/var/lib/postgresql/data
#----------------------------------------
# Monitoring services
#----------------------------------------
redis-insight:
image: redis/redisinsight
container_name: correctomatic-redisinsight
ports:
- "5540:5540"
# I don't know how to initialize the connection data
# You should enter the connection data manually in the web interface,
# so I've created a volume to persist the data
volumes:
- redisinsight:/data
bullmq-dashboard:
image: igrek8/bullmq-dashboard
container_name: correctomatic-dashboard
depends_on:
- redis
ports:
- "3030:3000"
# TO-DO: this image doesn't addmit setting a user
command: [
"--redis-host", "redis",
"--bullmq-prefix", "bull",
"--redis-password", "${REDIS_PASSWORD}"
]
# ---------------------------------------------------------
# ---------------------------------------------------------
# Correctomatic services
# ---------------------------------------------------------
# ---------------------------------------------------------
# ---------------------------------------------------------
# API service for sending works to the correction queue
# ---------------------------------------------------------
api:
image: correctomatic_api
build:
context: ./correctomatic/api
args:
SHARED_FOLDER: ${UPLOAD_DIRECTORY} # For creating the folder in the image
REPO_URL: ${API_REPO_URL:-https://github.com/correctomatic/correction-API.git}
BRANCH: ${API_BRANCH:-master}
DELAY_SECONDS: 5 # To give some time to DB to start
depends_on:
- redis
- db
ports:
- "3000:3000"
user: "node"
volumes:
# Shared folder MUST be binded to a host's folder, because docker runs in the host
- ${UPLOAD_DIRECTORY}:${UPLOAD_DIRECTORY}
# Use this for testing correction starter in local
# - /tmp/correctomatic-uploads:/tmp/correctomatic-uploads
environment:
PORT: 3000
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_USER: default
REDIS_PASSWORD: ${REDIS_PASSWORD}
DB_HOST: db
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
UPLOAD_DIRECTORY: ${UPLOAD_DIRECTORY}
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-30d}
# Variables for debugging
NODE_ENV: ${NODE_ENV:-development}
LOG_LEVEL: ${LOG_LEVEL:-info}
# This is the base image for the correction containers
# All the correction containers (starter, completer, notifier) will use this image
runner_base:
image: correctomatic_runner_base
build:
context: ./correctomatic/runner_base
args:
SHARED_FOLDER: /tmp/correctomatic-uploads
# This MUST match the group ID of the Docker group on your host
# Specify it in the .env file
DOCKER_GROUP_ID: ${DOCKER_GROUP_ID}
DELAY_SECONDS: 5 # To give some time to Redis to start
REPO_URL: ${RUNNER_REPO_URL:-https://github.com/correctomatic/correction-runner.git}
BRANCH: ${RUNNER_BRANCH:-master}
entrypoint: ["echo", "This is the base image for the correction containers"]
# ---------------------------------------------------------
# Process for launching in Docker the correction containers
# ---------------------------------------------------------
starter:
# Same image for all the correctomatic services
image: correctomatic_runner_base
depends_on:
- runner_base
- redis
user: "node"
entrypoint: ["/delayed_start.sh", "starter"]
volumes:
# Shared folder MUST be binded to a host's folder, because docker runs in the host
# It must be the same path in the container and in the host, because the container
# will bind mount the host's file
- ${UPLOAD_DIRECTORY}:${UPLOAD_DIRECTORY}
# This volume is needed to communicate with the Docker daemon on the host
- /var/run/docker.sock:/var/run/docker.sock
environment:
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_USER: default
REDIS_PASSWORD: ${REDIS_PASSWORD}
# Variables for debugging
NODE_ENV: ${NODE_ENV:-development}
LOG_LEVEL: ${LOG_LEVEL:-info}
DONT_START_CONTAINER: ${DONT_START_CONTAINER:-N}
# ----------------------------------------------------------------------------------
# Process for listening to finished containers and mark the corrections as completed
# ----------------------------------------------------------------------------------
completer:
# Same image for all the correctomatic services
image: correctomatic_runner_base
depends_on:
- runner_base
- redis
user: "node"
entrypoint: ["/delayed_start.sh", "completer"]
volumes:
# This volume is needed to communicate with the Docker daemon on the host
- /var/run/docker.sock:/var/run/docker.sock
environment:
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_USER: default
REDIS_PASSWORD: ${REDIS_PASSWORD}
# Variables for debugging
NODE_ENV: ${NODE_ENV:-development}
LOG_LEVEL: ${LOG_LEVEL:-info}
# ----------------------------------------------------------------------------------
# Process for notifying the user that the correction is completed
# ----------------------------------------------------------------------------------
notifier:
# Same image for all the correctomatic services
image: correctomatic_runner_base
depends_on:
- runner_base
- redis
user: "node"
entrypoint: ["/delayed_start.sh", "notifier"]
volumes:
# This volume is needed to communicate with the Docker daemon on the host
- /var/run/docker.sock:/var/run/docker.sock
# Take in account that notifications are sent from a container
# and localhost is the container, not the host
# the host is host.docker.internal
# You can add extra hosts for notification here
extra_hosts:
- host.docker.internal:host-gateway
# - notification.host.com:${NOTIFICATION_HOST_COM}
environment:
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_USER: default
REDIS_PASSWORD: ${REDIS_PASSWORD}
# Number of concurrent jobs sending notifications of completed tasks
CONCURRENT_NOTIFIERS: ${CONCURRENT_NOTIFIERS:-1}
# Variables for debugging
NODE_ENV: ${NODE_ENV:-development}
LOG_LEVEL: ${LOG_LEVEL:-info}
volumes:
redisinsight: # Connection data is saved here
redis_data: # For persisting bullmq data
postgres-data: # Database