-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yaml
147 lines (139 loc) · 4.52 KB
/
docker-compose.yaml
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
services:
backend:
image: ghcr.io/m0wer/rssfilter-backend:master
container_name: rssfilter-backend
build:
context: backend
environment:
API_BASE_URL: "https://rssfilter.sgn.space/"
ROOT_PATH: "/api/"
REDIS_URL: "redis://redis:6379/0"
DATABASE_URL: "sqlite:///data/db.sqlite"
MAX_WORKERS: ${MAX_WORKERS:-2}
LOGURU_LEVEL: ${LOGURU_LEVEL:-INFO}
CUDA_VISIBLE_DEVICES: ${CUDA_VISIBLE_DEVICES:-all}
FEED_FETCH_BATCH_SIZE: ${FEED_FETCH_BATCH_SIZE:-10}
labels:
traefik.http.routers.backend.entrypoints: web
traefik.http.routers.backend.rule: PathPrefix(`/api`)
traefik.http.routers.backend.service: backend
traefik.http.services.backend.loadbalancer.server.port: 80
volumes:
- ${SQLITE_PATH:-./data/}:/app/data/
- ${HUGGINGFACE_CACHE:-./huggingface/}:/root/.cache/huggingface/
depends_on:
- redis
- rq-worker
restart: unless-stopped
deploy:
resources:
limits:
cpus: "${BACKEND_CPUS:-4}"
memory: "${BACKEND_MEMORY:-8G}"
reservations: {devices: [{driver: nvidia, count: all, capabilities: [gpu]}]}
rq-worker:
image: ghcr.io/m0wer/rssfilter-backend:master
command: ["/app/worker.py", "high", "medium", "low"]
environment:
REDIS_URL: "redis://redis:6379/0"
DATABASE_URL: "sqlite:///data/db.sqlite"
LOGURU_LEVEL: ${LOGURU_LEVEL:-INFO}
CUDA_VISIBLE_DEVICES: ${CUDA_VISIBLE_DEVICES:-all}
volumes:
- ${SQLITE_PATH:-./data/}:/app/data/
- ${HUGGINGFACE_CACHE:-./huggingface/}:/root/.cache/huggingface/
depends_on:
- redis
restart: unless-stopped
deploy:
replicas: ${WORKER_REPLICAS:-2}
resources:
limits:
cpus: "${RQ_WORKER_CPUS:-2}"
memory: "${RQ_WORKER_MEMORY:-4G}"
rq-worker-gpu:
image: ghcr.io/m0wer/rssfilter-backend:master
command: ["/app/worker.py", "gpu"]
environment:
REDIS_URL: "redis://redis:6379/0"
DATABASE_URL: "sqlite:///data/db.sqlite"
LOGURU_LEVEL: ${LOGURU_LEVEL:-INFO}
CUDA_VISIBLE_DEVICES: ${CUDA_VISIBLE_DEVICES:-all}
volumes:
- ${SQLITE_PATH:-./data/}:/app/data/
- ${HUGGINGFACE_CACHE:-./huggingface/}:/root/.cache/huggingface/
depends_on:
- redis
restart: unless-stopped
deploy:
replicas: ${WORKER_GPU_REPLICAS:-1}
resources:
limits:
cpus: "${RQ_WORKER_CPUS:-2}"
memory: "${RQ_WORKER_MEMORY:-4G}"
reservations: {devices: [{driver: nvidia, count: all, capabilities: [gpu]}]}
rq-dashboard:
build: https://github.com/Parallels/rq-dashboard.git
container_name: rssfilter-rq-dashboard
command: ["--redis-url", "redis://redis:6379/0", "--url-prefix", "/rq", "--verbose", "--username", "admin", "--password", "${RQ_DASHBOARD_PASSWORD:-admin}"]
labels:
traefik.http.routers.rq-dashboard.entrypoints: web
traefik.http.routers.rq-dashboard.rule: PathPrefix(`/rq`)
traefik.http.routers.rq-dashboard.service: rq-dashboard
traefik.http.services.rq-dashboard.loadbalancer.server.port: 9181
ports:
- ${RQ_DASHBOARD_PORT:-9181}:9181
depends_on:
- redis
restart: unless-stopped
deploy:
resources:
limits:
cpus: ${RQ_DASHBOARD_CPUS:-1}
memory: ${RQ_DASHBOARD_MEMORY:-50M}
frontend:
image: ghcr.io/m0wer/rssfilter-frontend:master
container_name: rssfilter-frontend
build:
context: frontend
labels:
traefik.http.routers.frontend.entrypoints: web
traefik.http.routers.frontend.rule: PathPrefix(`/`)
traefik.http.routers.frontend.service: frontend
traefik.http.services.frontend.loadbalancer.server.port: 80
restart: unless-stopped
deploy:
resources:
limits:
cpus: ${FRONTEND_CPUS:-2}
memory: ${FRONTEND_MEMORY:-50M}
proxy:
image: traefik:v2.3
container_name: rssfilter-proxy
command:
- --providers.docker
- --entryPoints.web.address=:80
ports:
- ${PROXY_PORT:-80}:80
volumes:
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- backend
- frontend
restart: unless-stopped
deploy:
resources:
limits:
cpus: ${PROXY_CPUS:-2}
memory: ${PROXY_MEMORY:-100M}
redis:
image: redis:7-alpine
container_name: rssfilter-redis
volumes:
- ${REDIS_PATH:-./redis/}:/data
restart: unless-stopped
deploy:
resources:
limits:
cpus: ${REDIS_CPUS:-2}
memory: ${REDIS_MEMORY:-100M}