313 lines
7.6 KiB
YAML
313 lines
7.6 KiB
YAML
services:
|
|
prometheus-targets:
|
|
image: busybox:latest
|
|
command:
|
|
- /bin/sh
|
|
- -ec
|
|
- |
|
|
target="$${ML_METRICS_TARGET}"
|
|
if [ -z "$$target" ]; then
|
|
printf '%s\n' '[]' > /targets/ml.yml
|
|
exit 0
|
|
fi
|
|
case "$$target" in
|
|
*[!A-Za-z0-9._:-]*|*:*:*)
|
|
printf '%s\n' 'ML_METRICS_TARGET must be a private hostname or IPv4 address followed by a port.' >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
host="$${target%:*}"
|
|
port="$${target##*:}"
|
|
case "$$host" in
|
|
''|.*|*..*|-*|*-) printf '%s\n' 'ML_METRICS_TARGET has an invalid host.' >&2; exit 1 ;;
|
|
esac
|
|
case "$$port" in
|
|
''|*[!0-9]*) printf '%s\n' 'ML_METRICS_TARGET must end with a numeric port.' >&2; exit 1 ;;
|
|
esac
|
|
if [ "$$port" -lt 1 ] || [ "$$port" -gt 65535 ]; then
|
|
printf '%s\n' 'ML_METRICS_TARGET port must be between 1 and 65535.' >&2
|
|
exit 1
|
|
fi
|
|
printf '%s\n' '- targets:' " - \"$$host:$$port\"" > /targets/ml.yml
|
|
environment:
|
|
ML_METRICS_TARGET: ${ML_METRICS_TARGET:-}
|
|
volumes:
|
|
- prometheus_targets:/targets
|
|
networks:
|
|
- observability
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
restart: "no"
|
|
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
command:
|
|
- --config.file=/etc/prometheus/prometheus.yml
|
|
- --storage.tsdb.path=/prometheus
|
|
- --storage.tsdb.retention.time=14d
|
|
- --storage.tsdb.retention.size=4GB
|
|
depends_on:
|
|
prometheus-targets:
|
|
condition: service_completed_successfully
|
|
volumes:
|
|
- ../../observability/prometheus:/etc/prometheus:ro
|
|
- prometheus_targets:/etc/prometheus/targets:ro
|
|
- prometheus_data:/prometheus
|
|
expose:
|
|
- "9090"
|
|
networks:
|
|
- observability
|
|
- app
|
|
# SeaweedFS metrics listen only on the storage network.
|
|
- storage
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: 10m
|
|
max-file: "3"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "1.0"
|
|
memory: 1G
|
|
|
|
postgres-exporter:
|
|
image: ghcr.io/prometheus-community/postgres-exporter:latest
|
|
environment:
|
|
DATA_SOURCE_URI: postgres:5432/${POSTGRES_DB:?Set POSTGRES_DB in the root .env file}?sslmode=disable
|
|
DATA_SOURCE_USER: ${POSTGRES_EXPORTER_USER:?Set POSTGRES_EXPORTER_USER in the root .env file}
|
|
DATA_SOURCE_PASS: ${POSTGRES_EXPORTER_PASSWORD:?Set POSTGRES_EXPORTER_PASSWORD in the root .env file}
|
|
expose:
|
|
- "9187"
|
|
networks:
|
|
- observability
|
|
- app
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: 10m
|
|
max-file: "3"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "0.25"
|
|
memory: 128M
|
|
|
|
redis-exporter:
|
|
image: oliver006/redis_exporter:latest
|
|
environment:
|
|
REDIS_ADDR: redis://redis:6379
|
|
REDIS_PASSWORD: ${REDIS_PASSWORD:?Set REDIS_PASSWORD in the root .env file}
|
|
REDIS_EXPORTER_CONNECTION_TIMEOUT: 2s
|
|
expose:
|
|
- "9121"
|
|
networks:
|
|
- observability
|
|
- app
|
|
read_only: true
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: 10m
|
|
max-file: "3"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "0.25"
|
|
memory: 128M
|
|
|
|
node-exporter:
|
|
image: prom/node-exporter:latest
|
|
command:
|
|
- --path.procfs=/host/proc
|
|
- --path.sysfs=/host/sys
|
|
- --path.rootfs=/host/root
|
|
- --collector.filesystem.mount-points-exclude=^/(dev|proc|sys|host|etc)($$|/)
|
|
volumes:
|
|
- /proc:/host/proc:ro
|
|
- /sys:/host/sys:ro
|
|
- /:/host/root:ro,rslave
|
|
expose:
|
|
- "9100"
|
|
networks:
|
|
- observability
|
|
read_only: true
|
|
user: "65534:65534"
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: 10m
|
|
max-file: "3"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "0.25"
|
|
memory: 128M
|
|
|
|
loki:
|
|
image: grafana/loki:latest
|
|
command:
|
|
- -config.file=/etc/loki/loki.yml
|
|
- -target=all
|
|
volumes:
|
|
- ../../observability/loki/loki.yml:/etc/loki/loki.yml:ro
|
|
- loki_data:/loki
|
|
expose:
|
|
- "3100"
|
|
networks:
|
|
- observability
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: 10m
|
|
max-file: "3"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "1.0"
|
|
memory: 1G
|
|
|
|
alloy:
|
|
image: grafana/alloy:latest
|
|
user: "473:473"
|
|
environment:
|
|
APP_PROJECT: ${APP_PROJECT:-app}
|
|
command:
|
|
- run
|
|
- --server.http.listen-addr=127.0.0.1:12345
|
|
- --storage.path=/var/lib/alloy/data
|
|
- /etc/alloy/app.alloy
|
|
depends_on:
|
|
- loki
|
|
- docker-socket-proxy
|
|
volumes:
|
|
- ../../observability/alloy/app.alloy:/etc/alloy/app.alloy:ro
|
|
- alloy_data:/var/lib/alloy/data
|
|
expose:
|
|
- "12347"
|
|
networks:
|
|
observability: {}
|
|
app:
|
|
aliases:
|
|
- faro-receiver
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: 10m
|
|
max-file: "3"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "0.5"
|
|
memory: 512M
|
|
|
|
docker-socket-proxy:
|
|
image: tecnativa/docker-socket-proxy:latest
|
|
environment:
|
|
CONTAINERS: "1"
|
|
EVENTS: "1"
|
|
IMAGES: "0"
|
|
INFO: "0"
|
|
NETWORKS: "0"
|
|
PING: "1"
|
|
POST: "0"
|
|
VERSION: "1"
|
|
volumes:
|
|
- type: bind
|
|
source: ${DOCKER_SOCKET_PATH:-/var/run/docker.sock}
|
|
target: /var/run/docker.sock
|
|
read_only: true
|
|
bind:
|
|
create_host_path: false
|
|
expose:
|
|
- "2375"
|
|
networks:
|
|
- observability
|
|
# The image entrypoint renders HAProxy configuration before starting.
|
|
tmpfs:
|
|
- /tmp
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: 10m
|
|
max-file: "3"
|
|
|
|
grafana:
|
|
image: grafana/grafana:latest
|
|
environment:
|
|
GF_SERVER_PROTOCOL: http
|
|
GF_SERVER_DOMAIN: localhost
|
|
GF_SERVER_ROOT_URL: http://localhost:${GRAFANA_PORT:-3000}/
|
|
GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USER:?Set GRAFANA_ADMIN_USER in the root .env file}
|
|
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:?Set GRAFANA_ADMIN_PASSWORD in the root .env file}
|
|
GF_USERS_ALLOW_SIGN_UP: "false"
|
|
GF_ANALYTICS_REPORTING_ENABLED: "false"
|
|
ports:
|
|
- "127.0.0.1:${GRAFANA_PORT:-3000}:3000"
|
|
volumes:
|
|
- grafana_data:/var/lib/grafana
|
|
- ../../observability/grafana/provisioning:/etc/grafana/provisioning:ro
|
|
- ../../observability/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
networks:
|
|
- observability
|
|
- app
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: 10m
|
|
max-file: "3"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "1.0"
|
|
memory: 768M
|
|
|
|
networks:
|
|
app:
|
|
name: ${APP_NETWORK:-app_default}
|
|
external: true
|
|
storage:
|
|
name: ${APP_STORAGE_NETWORK:-${APP_PROJECT:-app}_storage}
|
|
external: true
|
|
observability:
|
|
internal: true
|
|
|
|
volumes:
|
|
alloy_data:
|
|
grafana_data:
|
|
loki_data:
|
|
prometheus_data:
|
|
prometheus_targets:
|