117 lines
2.5 KiB
YAML
117 lines
2.5 KiB
YAML
version: "3"
|
|
|
|
networks:
|
|
back-tier:
|
|
front-tier:
|
|
|
|
x-logging: &loki-logging
|
|
driver: json-file
|
|
options:
|
|
tag: "{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}"
|
|
|
|
services:
|
|
|
|
# Database
|
|
db:
|
|
image: postgres
|
|
restart: always
|
|
volumes:
|
|
- db_data:/var/lib/postgresql/data/pgdata
|
|
ports:
|
|
- "5432:5432"
|
|
environment:
|
|
PGDATA: /var/lib/postgresql/data/pgdata
|
|
POSTGRES_USER: serverctl
|
|
POSTGRES_PASSWORD: serverctlsecret
|
|
POSTGRES_DB: serverctl
|
|
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"
|
|
- "6060:6060" # Profiler optional
|
|
logging: *loki-logging
|
|
depends_on:
|
|
- db_migrator
|
|
|
|
# Logging
|
|
loki:
|
|
image: grafana/loki:2.7.0
|
|
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.7.0
|
|
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
|
|
|
|
|
|
volumes:
|
|
db_data: {}
|
|
prometheus_data: {}
|
|
grafana_data: {}
|