-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yaml
123 lines (112 loc) · 3.15 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
version: '3.3'
networks:
# Services in this network will be accessible only by other services
mlpnet:
# Services in this network can be accessed by the world (via Traefik)
www:
external: true
services:
# Message broker: manager for the task queue
rabbitmq:
image: rabbitmq
# ports: 5672
networks:
- mlpnet
# NoSQL database for caching results
redis:
image: redis
# ports: 6379
networks:
- mlpnet
# Tracking and metric service
prometheus:
image: prom/prometheus
networks:
- mlpnet
- www
volumes:
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml
labels:
- "traefik.enable=true"
- "traefik.http.routers.mlprom.rule=Host(`mlprom.${DOMAIN}`)"
- "traefik.http.routers.mlprom.entrypoints=web"
- "traefik.http.services.mlprom.loadbalancer.server.port=9090"
# Storage for all data
database:
image: postgres
environment:
- POSTGRES_USER=${DATABASE_USER}
- POSTGRES_PASSWORD=${DATABASE_PASS}
- POSTGRES_DB=${DATABASE_SCHEMA}
networks:
- mlpnet
# ports: 5432
# Celery worker
worker:
image: cas.mlp.worker
build:
context: .
dockerfile: Dockerfile.worker
environment:
- CELERY_BACKEND_URL=${CELERY_BACKEND_URL}
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
- CELERY_QUEUE=${CELERY_QUEUE}
- DATABASE_URL=postgresql://${DATABASE_USER}:${DATABASE_PASS}@${DATABASE_HOST}/${DATABASE_SCHEMA}
volumes:
- ./models:/app/models
networks:
- mlpnet
depends_on:
- redis
- rabbitmq
- database
# Service that expose the API
api:
image: cas.mlp.api
build:
context: .
dockerfile: Dockerfile.api
environment:
- CELERY_BACKEND_URL=${CELERY_BACKEND_URL}
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
- DATABASE_URL=postgresql://${DATABASE_USER}:${DATABASE_PASS}@${DATABASE_HOST}/${DATABASE_SCHEMA}
# ports: 4789
networks:
- www
- mlpnet
depends_on:
- worker
- database
labels:
- "traefik.enable=true"
- "traefik.http.routers.mlpapi.rule=Host(`mlpapi.${DOMAIN}`)"
- "traefik.http.routers.mlpapi.entrypoints=web"
- "traefik.http.services.mlpapi.loadbalancer.server.port=4789"
# Dashboard
grafana:
image: grafana/grafana-oss
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASS}
- GF_USERS_ALLOW_SIGN_UP=false
- DS_PROMETHEUS_URL=prometheus
- DS_PROMETHEUS_PORT=9090
- DS_POSTGRES_URL=database
- DS_POSTGRES_PORT=5432
- DS_POSTGRES_USER=${DATABASE_USER}
- DS_POSTGRES_PASSWORD=${DATABASE_PASS}
- DS_POSTGRES_DB=${DATABASE_SCHEMA}
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning
- ./grafana/dashboards:/var/lib/grafana/dashboards
# ports: 3000
networks:
- mlpnet
- www
depends_on:
- database
- prometheus
labels:
- "traefik.enable=true"
- "traefik.http.routers.mlpgrafana.rule=Host(`grafana.${DOMAIN}`)"
- "traefik.http.routers.mlpgrafana.entrypoints=web"
- "traefik.http.services.mlpgrafana.loadbalancer.server.port=3000"