serverctl/docker-compose.yml

117 lines
2.5 KiB
YAML
Raw Normal View History

2022-02-13 18:09:26 +01:00
version: "3"
2022-02-14 20:03:53 +01:00
networks:
back-tier:
front-tier:
x-logging: &loki-logging
driver: json-file
options:
tag: "{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}"
2022-02-13 18:09:26 +01:00
services:
2022-02-14 20:03:53 +01:00
# Database
2022-02-13 18:09:26 +01:00
db:
image: postgres
restart: always
volumes:
- db_data:/var/lib/postgresql/data/pgdata
ports:
2022-02-14 20:03:53 +01:00
- "5432:5432"
2022-02-13 18:09:26 +01:00
environment:
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_USER: serverctl
POSTGRES_PASSWORD: serverctlsecret
POSTGRES_DB: serverctl
2022-02-14 20:03:53 +01:00
networks:
- back-tier
db_migrator:
build:
context: services/db/migrations
networks:
- back-tier
depends_on:
- "db"
app:
build:
context: services/entry/
networks:
- back-tier
- front-tier
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./services/entry/:/app/
environment:
DATABASE_URL: "postgresql://serverctl:serverctlsecret@db/serverctl"
ports:
- "8080:8080"
logging: *loki-logging
depends_on:
- db_migrator
# Logging
loki:
image: grafana/loki:2.4.2
ports:
- 3100
networks:
- back-tier
volumes:
- './services/logs/loki/config.yaml:/mnt/config/loki-config.yaml'
command: -config.file=/mnt/config/loki-config.yaml
logging: *loki-logging
promtail:
image: grafana/promtail:2.4.2
volumes:
- ./services/logs/promtail/config.yaml:/mnt/config/promtail-config.yaml
- /var/lib/docker/containers:/host/containers
command: -config.file /mnt/config/promtail-config.yaml
networks:
- back-tier
logging: *loki-logging
depends_on:
- loki
#Metrics
prometheus:
image: prom/prometheus
volumes:
- ./services/metrics/prometheus/:/etc/prometheus
- prometheus_data:/prometheus
networks:
- back-tier
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
restart: always
grafana:
image: grafana/grafana
user: "472"
depends_on:
- prometheus
ports:
- "3000:3000"
volumes:
- grafana_data:/var/lib/grafana
- ./services/metrics/grafana/provisioning:/etc/grafana/provisioning
env_file:
- ./services/metrics/grafana/config.monitoring
networks:
- back-tier
- front-tier
restart: always
2022-02-13 18:09:26 +01:00
volumes:
db_data: {}
2022-02-14 20:03:53 +01:00
prometheus_data: {}
grafana_data: {}