forked from mdawar/rq-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.custom.yml
81 lines (76 loc) · 2.07 KB
/
docker-compose.custom.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
version: '3.7'
services:
rq_exporter_custom_classes:
build:
context: .
dockerfile: Dockerfile
image: mdawar/rq-exporter:latest
# You can also configure the exporter using command line options
# command: --redis-host redis --redis-pass 123456
ports:
- target: 9726
published: 9727
protocol: tcp
mode: host
environment:
RQ_REDIS_HOST: "redis"
RQ_REDIS_PASS: "123456"
RQ_REDIS_DB: "1"
# Add the sample project's path to be able to import the classes
PYTHONPATH: "$${PYTHONPATH}:/home/project"
RQ_WORKER_CLASS: "custom.CustomWorker"
RQ_QUEUE_CLASS: "custom.CustomQueue"
volumes:
# Mount the package for development
- type: bind
source: ./rq_exporter
target: /app/rq_exporter
# Mount a sample project
- type: bind
source: ./docker-compose/project
target: /home/project
depends_on:
- redis
# RQ workers
# To run multiple replicas use:
# docker-compose --compatibility up
worker_custom_classes:
image: mdawar/rq-exporter:latest
entrypoint: []
command: |
rq worker
--worker-class 'custom.CustomWorker'
--job-class 'custom.CustomJob'
--queue-class 'custom.CustomQueue'
--url redis://:123456@redis:6379/1
high default low
working_dir: /home/worker
volumes:
# Mount a sample project
- type: bind
source: ./docker-compose/project
target: /home/worker
depends_on:
- redis
- rq_exporter
deploy:
replicas: 2
# Enqueue jobs for testing
enqueue_custom_classes:
image: mdawar/rq-exporter:latest
entrypoint: []
# Pass 'custom' argument to use the RQ custom classes
command: python -u enqueue.py custom
environment:
RQ_REDIS_HOST: "redis"
RQ_REDIS_PASS: "123456"
RQ_REDIS_DB: "1"
working_dir: /home/enqueue
volumes:
# Mount a sample project
- type: bind
source: ./docker-compose/project
target: /home/enqueue
depends_on:
- redis
- rq_exporter