166 lines
4.2 KiB
YAML
166 lines
4.2 KiB
YAML
networks:
|
|
loki:
|
|
name: loki-net # replace the default domain <service>.loki-net
|
|
|
|
services:
|
|
#------- init container to change permissions of the mounted directory.
|
|
init:
|
|
image: busybox
|
|
user: root
|
|
entrypoint: >
|
|
/bin/sh -c "
|
|
chown 472:root /var/lib/grafana;
|
|
chown 101:root /etc/nginx/conf.d/default.conf;
|
|
chown 10001:10001 /loki -R;
|
|
chown nobody:nobody /prometheus -R;
|
|
exit 0;
|
|
"
|
|
volumes:
|
|
- '${GF_VOLUME_DIR}:/var/lib/grafana'
|
|
- '${PRX_NGINX_CONF_DIR}/default.conf:/etc/nginx/conf.d/default.conf'
|
|
- '${PROM_DATA_DIR}:/prometheus'
|
|
- ${LOKI_DATA_DIR}:/loki
|
|
networks:
|
|
- loki
|
|
|
|
#------- container with tools dns (nslookup, tcptraceroute, etc). Use just for debug
|
|
# dns-tools:
|
|
# image: jonlabelle/network-tools
|
|
# command: tail -f /dev/null
|
|
# stdin_open: true
|
|
# tty: true
|
|
# networks:
|
|
# - loki
|
|
|
|
#-------proxy (nginx)
|
|
proxy:
|
|
image: nginxinc/nginx-unprivileged
|
|
volumes:
|
|
- ${PRX_NGINX_CONF_DIR}/default.conf:/etc/nginx/conf.d/default.conf
|
|
- ${PRX_CERTS_DIR}:/etc/nginx/certs
|
|
ports:
|
|
- "443:8443"
|
|
#- "80:8080"
|
|
networks:
|
|
- loki
|
|
restart: always
|
|
|
|
#------- minio server service
|
|
minio:
|
|
#image: minio/minio
|
|
image: minio/minio:RELEASE.2025-03-12T18-04-18Z
|
|
restart: always
|
|
volumes:
|
|
- ${MINIO_DATA_ROOT_DIR}:/data
|
|
ports:
|
|
- "9000:9000"
|
|
- "9001:9001"
|
|
environment:
|
|
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY}
|
|
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY}
|
|
MINIO_BROWSER_REDIRECT_URL: ${MINIO_REDIRECT_URL}
|
|
command: server /data --console-address ":9001"
|
|
networks:
|
|
- loki
|
|
|
|
#------- minio client
|
|
minio-cli:
|
|
image: minio/mc
|
|
# insure that the server container is running before building the client
|
|
depends_on:
|
|
- minio
|
|
entrypoint: >
|
|
/bin/sh -c "tail -f /dev/null"
|
|
#/usr/bin/mc admin info play;
|
|
#/usr/bin/mc alias set myminio http://minio:9000 ${MINIO_ACCESS_KEY} ${MINIO_SECRET_KEY};
|
|
#/usr/bin/mc admin prometheus generate myminio
|
|
##/usr/bin/mc mb myminio/test-bucket;
|
|
##/usr/bin/mc mb myminio/loki-1;
|
|
##echo 'my content' > myfile.txt;
|
|
##/usr/bin/mc cp myfile.txt myminio/test-bucket;
|
|
#exit 0;
|
|
#"
|
|
volumes:
|
|
- ${MINIO_CONF_CLI_DIR}/.mc:/root/.mc
|
|
restart: unless-stopped
|
|
networks:
|
|
- loki
|
|
|
|
#------- grafana
|
|
grafana:
|
|
image: grafana/grafana-enterprise
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- '${GF_VOLUME_DIR}:/var/lib/grafana'
|
|
environment:
|
|
- GF_SECURITY_ADMIN_USER=${GF_ADMIN_USER}
|
|
- GF_SECURITY_ADMIN_PASSWORD=${GF_ADMIN_PASS}
|
|
- GF_SERVER_ROOT_URL=${GF_ROOT_URL}
|
|
#- GF_SERVER_SERVE_FROM_SUB_PATH=true
|
|
restart: unless-stopped
|
|
networks:
|
|
- loki
|
|
|
|
#------- prometheus
|
|
prometheus:
|
|
image: prom/prometheus
|
|
volumes:
|
|
- ${PROM_CONF_DIR}/prometheus.yml:/etc/prometheus/prometheus.yml
|
|
- ${PROM_DATA_DIR}:/prometheus
|
|
ports:
|
|
- 9090:9090
|
|
restart: unless-stopped
|
|
networks:
|
|
- loki
|
|
|
|
#------- node-exporter
|
|
node-exporter:
|
|
image: prom/node-exporter
|
|
networks:
|
|
- loki
|
|
ports:
|
|
- 9100:9100
|
|
restart: unless-stopped
|
|
|
|
#------- loki
|
|
loki:
|
|
image: grafana/loki:latest
|
|
ports:
|
|
- 3100:3100
|
|
volumes:
|
|
- ${LOKI_CONF_DIR}/local-config.yaml:/etc/loki/local-config.yaml
|
|
- ${LOKI_DATA_DIR}:/loki
|
|
restart: unless-stopped
|
|
networks:
|
|
- loki
|
|
|
|
#------- promtail
|
|
promtail:
|
|
image: grafana/promtail:latest
|
|
volumes:
|
|
- ${PROMTAIL_CONF_DIR}/config.yml:/etc/promtail/config.yml
|
|
- ${LOKI_GEN_LOG}:/tmp/
|
|
- /var/log/:/var/log/
|
|
restart: unless-stopped
|
|
networks:
|
|
- loki
|
|
|
|
#------- flog generated log
|
|
log-generator:
|
|
image: gmouchet/flog
|
|
command:
|
|
- --loop
|
|
- --format=json
|
|
- --number=10 # number of log lines to generate per second
|
|
- --delay=100ms # delay between log lines
|
|
#- --output=/var/log/generated-logs.txt
|
|
- --output=/tmp/loki-gen-log/generated-logs.txt
|
|
- --overwrite
|
|
- --type=log
|
|
volumes:
|
|
- ${LOKI_GEN_LOG}:/tmp/
|
|
#volumes:
|
|
# grafana-storage:
|
|
# prometheus:
|
|
# loki-data: |