-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
61 lines (60 loc) · 2.58 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
version: '3'
services:
backend:
build:
context: .
dockerfile: dockerfiles/backend/Dockerfile
ports:
- "8080:8080"
environment:
# ⚠️ not a good production practice, because hacker can snoop the docker env within the docker container
# but we need it for our demonstration
DB_NAME: ${DB_NAME}
DB_PORT: ${DB_PORT}
DB_HOST: ${DB_HOST}
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
DB_PARAMS: ${DB_PARAMS}
JWT_SECRET: ${JWT_SECRET}
BCRYPT_SALT: ${BCRYPT_SALT}
S3_ID: ${S3_ID}
S3_SECRET_KEY: ${S3_SECRET_KEY}
S3_BUCKET_NAME: ${S3_BUCKET_NAME}
S3_REGION: ${S3_REGION}
ENV: ${ENV}
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
# • `./prometheus.yml` refers to `./prometheus.yml` that exists in current directory
# • `/etc/prometheus/prometheus.yml` refers to where `./prometheus.yml` will be placed inside the container
- prometheus_data:/prometheus
# • `prometheus_data` refers to `volumes.prometheus_data` used to make prometheus information presists each restart
# • `/prometheus` refers to where should `volumes.grafana_data` will be placed inside the grafana container
command:
# tell the prometheus to use `/etc/prometheus/prometheus.yml`
- '--config.file=/etc/prometheus/prometheus.yml'
# tell the prometheus to use `/prometheus` as the storage path
- '--storage.tsdb.path=/prometheus'
# tell prometheus to reload if we hit `http://localhost:9090/-/reload` to reload changes in `./prometheus.yml`
- '--web.enable-lifecycle'
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
volumes:
- grafana_data:/var/lib/grafana
# • `grafana_data` refers to `volumes.grafana_data` used to make grafana information presists each restart
# • `/var/lib/grafana` refers to where should `volumes.grafana_data` will be placed inside the grafana container
- ./grafana/datasources:/etc/grafana/provisioning/datasources
# • `./grafana/datasources` refers to `grafana` folder in host, push the folder in the repository
# to retain the config and keeping the panels that already created and deploy it everywhere
# • `/etc/grafana/provisioning/datasources` refers to where should `grafana` will be placed inside the grafana container
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
prometheus_data:
grafana_data: