-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
135 lines (127 loc) · 3.44 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
services:
server:
container_name: nestjs-boilerplate-server
image: nestjs-boilerplate-server:latest
restart: unless-stopped
env_file:
- .env
environment:
- IS_WORKER=false
ports:
- '${APP_PORT}:${APP_PORT}'
- '${APP_WEBSOCKET_PORT}:${APP_WEBSOCKET_PORT}'
networks:
- nestjs-boilerplate-network
depends_on:
- redis
worker:
container_name: nestjs-boilerplate-worker
image: nestjs-boilerplate-worker:latest
restart: unless-stopped
env_file:
- .env
environment:
- IS_WORKER=true
ports:
- '${APP_WORKER_PORT}:${APP_WORKER_PORT}'
networks:
- nestjs-boilerplate-network
depends_on:
- redis
redis:
image: redis:7.0.1-alpine
container_name: nestjs-boilerplate-redis
restart: always
ports:
- '${DOCKER_REDIS_PORT}:6379'
environment:
REDIS_ARGS: '--requirepass ${REDIS_PASSWORD}'
volumes:
- ./.docker/redis_data:/data
healthcheck:
test: ['CMD', 'redis-cli', '--raw', 'incr', 'ping']
command: 'redis-server --save 120 1 --loglevel warning'
networks:
- nestjs-boilerplate-network
prometheus:
image: prom/prometheus:v3.0.1
container_name: nestjs-boilerplate-prometheus
restart: unless-stopped
ports:
- ${DOCKER_PROMETHEUS_PORT}:9090
command:
- '--config.file=/etc/prometheus/prometheus.yaml'
volumes:
- ./prometheus.config.yml:/etc/prometheus/prometheus.yaml:ro
networks:
- nestjs-boilerplate-network
profiles:
- monitoring
depends_on:
- setup_prometheus
grafana:
image: grafana/grafana-oss:11.3.1
container_name: nestjs-boilerplate-grafana
restart: unless-stopped
ports:
- '${DOCKER_GRAFANA_PORT}:3000'
environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_USERNAME}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning
- ./grafana/dashboards:/var/lib/grafana/dashboards
networks:
- nestjs-boilerplate-network
profiles:
- monitoring
depends_on:
- prometheus
- setup_grafana
postgres-exporter:
image: prometheuscommunity/postgres-exporter
container_name: nestjs-boilerplate-postgres-exporter
ports:
- ${DOCKER_PG_EXPORTER}:9187
environment:
DATA_SOURCE_NAME: 'postgresql://${DATABASE_USERNAME}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}?sslmode=${DATABASE_SSL_MODE:-disable}'
networks:
- nestjs-boilerplate-network
profiles:
- monitoring
depends_on:
- prometheus
# Solution to fix prometheus volume permission issue
setup_prometheus:
image: prom/prometheus:v3.0.1
container_name: nestjs-boilerplate-setup-prometheus
restart: no
user: root
entrypoint:
- /bin/sh
- -c
- |
chown -R 65534:65534 /prometheus
volumes:
- ./.docker/prometheus-data:/prometheus
profiles:
- monitoring
# Solution to fix grafana volume permission issue
setup_grafana:
image: grafana/grafana-oss:11.3.1
container_name: nestjs-boilerplate-setup-grafana
restart: no
user: root
entrypoint:
- /bin/sh
- -c
- |
chown -R 65534:65534 /var/lib/grafana
volumes:
- ./.docker/grafana-data:/var/lib/grafana
profiles:
- monitoring
networks:
nestjs-boilerplate-network:
name: nestjs-boilerplate-network
driver: bridge