Refactor docker-compose configurations and add new services
- Reorganize Authelia configuration files - Add new dynamic routing files for Traefik - Update various service docker-compose files - Remove outdated templates and scripts
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
server:
|
||||
http_listen_port: 3100
|
||||
grpc_listen_port: 9096
|
||||
|
||||
common:
|
||||
path_prefix: /loki
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /loki/chunks
|
||||
rules_directory: /loki/rules
|
||||
replication_factor: 1
|
||||
ring:
|
||||
instance_addr: 127.0.0.1
|
||||
kvstore:
|
||||
store: inmemory
|
||||
|
||||
query_range:
|
||||
results_cache:
|
||||
cache:
|
||||
embedded_cache:
|
||||
enabled: true
|
||||
max_size_mb: 100
|
||||
|
||||
schema_config:
|
||||
configs:
|
||||
- from: 2020-10-24
|
||||
store: tsdb
|
||||
object_store: filesystem
|
||||
schema: v13
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
|
||||
ruler:
|
||||
alertmanager_url: http://localhost:9093
|
||||
@@ -1,16 +0,0 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'prometheus'
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
|
||||
- job_name: 'node-exporter'
|
||||
static_configs:
|
||||
- targets: ['node-exporter:9100']
|
||||
|
||||
- job_name: 'cadvisor'
|
||||
static_configs:
|
||||
- targets: ['cadvisor:8080']
|
||||
@@ -1,18 +0,0 @@
|
||||
server:
|
||||
http_listen_port: 9080
|
||||
grpc_listen_port: 0
|
||||
|
||||
positions:
|
||||
filename: /tmp/positions.yaml
|
||||
|
||||
clients:
|
||||
- url: http://loki:3100/loki/api/v1/push
|
||||
|
||||
scrape_configs:
|
||||
- job_name: system
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: varlogs
|
||||
__path__: /var/log/*log
|
||||
@@ -23,7 +23,7 @@ services:
|
||||
- homelab-network
|
||||
- traefik-network
|
||||
ports:
|
||||
- "9090:9090"
|
||||
- '9090:9090'
|
||||
volumes:
|
||||
- ./config/prometheus:/etc/prometheus
|
||||
- prometheus-data:/prometheus
|
||||
@@ -38,19 +38,19 @@ services:
|
||||
# TRAEFIK CONFIGURATION
|
||||
# ==========================================
|
||||
# Service metadata
|
||||
- 'homelab.category=monitoring"
|
||||
- 'homelab.description=Metrics collection and time-series database"
|
||||
- 'homelab.category=monitoring'
|
||||
- 'homelab.description=Metrics collection and time-series database'
|
||||
# Traefik reverse proxy (comment/uncomment to disable/enable)
|
||||
# If Traefik is on a remote server: these labels are NOT USED;
|
||||
# configure external yml files in /traefik/dynamic folder instead.
|
||||
- 'traefik.enable=true"
|
||||
- 'traefik.docker.network=traefik-network"
|
||||
- 'traefik.http.routers.prometheus.rule=Host(`prometheus.${DOMAIN}`)"
|
||||
- 'traefik.http.routers.prometheus.entrypoints=websecure"
|
||||
- 'traefik.http.routers.prometheus.tls=true"
|
||||
- 'traefik.http.routers.prometheus.tls.certresolver=letsencrypt"
|
||||
- 'traefik.http.routers.prometheus.middlewares=authelia@docker"
|
||||
- 'traefik.http.services.prometheus.loadbalancer.server.port=9090"
|
||||
- 'traefik.enable=true'
|
||||
- 'traefik.docker.network=traefik-network'
|
||||
- 'traefik.http.routers.prometheus.rule=Host(`prometheus.${DOMAIN}`)'
|
||||
- 'traefik.http.routers.prometheus.entrypoints=websecure'
|
||||
- 'traefik.http.routers.prometheus.tls=true'
|
||||
- 'traefik.http.routers.prometheus.tls.certresolver=letsencrypt'
|
||||
- 'traefik.http.routers.prometheus.middlewares=authelia@docker'
|
||||
- 'traefik.http.services.prometheus.loadbalancer.server.port=9090'
|
||||
|
||||
# Grafana - Metrics visualization
|
||||
# Default credentials: admin / admin (change on first login)
|
||||
@@ -71,7 +71,7 @@ services:
|
||||
- homelab-network
|
||||
- traefik-network
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
- grafana-data:/var/lib/grafana
|
||||
- ./config/grafana/provisioning:/etc/grafana/provisioning
|
||||
@@ -80,26 +80,26 @@ services:
|
||||
- GF_USERS_ALLOW_SIGN_UP=false
|
||||
- GF_SERVER_ROOT_URL=https://grafana.${DOMAIN}
|
||||
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,grafana-piechart-panel
|
||||
user: "1000:1000"
|
||||
user: '1000:1000'
|
||||
depends_on:
|
||||
- prometheus
|
||||
labels:
|
||||
# TRAEFIK CONFIGURATION
|
||||
# ==========================================
|
||||
# Service metadata
|
||||
- 'homelab.category=monitoring"
|
||||
- 'homelab.description=Metrics visualization and dashboards"
|
||||
- 'homelab.category=monitoring'
|
||||
- 'homelab.description=Metrics visualization and dashboards'
|
||||
# Traefik reverse proxy (comment/uncomment to disable/enable)
|
||||
# If Traefik is on a remote server: these labels are NOT USED;
|
||||
# configure external yml files in /traefik/dynamic folder instead.
|
||||
- 'traefik.enable=true"
|
||||
- 'traefik.docker.network=traefik-network"
|
||||
- 'traefik.http.routers.grafana.rule=Host(`grafana.${DOMAIN}`)"
|
||||
- 'traefik.http.routers.grafana.entrypoints=websecure"
|
||||
- 'traefik.http.routers.grafana.tls=true"
|
||||
- 'traefik.http.routers.grafana.tls.certresolver=letsencrypt"
|
||||
- 'traefik.http.routers.grafana.middlewares=authelia@docker"
|
||||
- 'traefik.http.services.grafana.loadbalancer.server.port=3000"
|
||||
- 'traefik.enable=true'
|
||||
- 'traefik.docker.network=traefik-network'
|
||||
- 'traefik.http.routers.grafana.rule=Host(`grafana.${DOMAIN}`)'
|
||||
- 'traefik.http.routers.grafana.entrypoints=websecure'
|
||||
- 'traefik.http.routers.grafana.tls=true'
|
||||
- 'traefik.http.routers.grafana.tls.certresolver=letsencrypt'
|
||||
- 'traefik.http.routers.grafana.middlewares=authelia@docker'
|
||||
- 'traefik.http.services.grafana.loadbalancer.server.port=3000'
|
||||
|
||||
# Node Exporter - Host metrics exporter
|
||||
# Metrics at: http://192.168.4.4:9100/metrics
|
||||
@@ -110,7 +110,7 @@ services:
|
||||
networks:
|
||||
- homelab-network
|
||||
ports:
|
||||
- "9100:9100"
|
||||
- '9100:9100'
|
||||
volumes:
|
||||
- /proc:/host/proc:ro
|
||||
- /sys:/host/sys:ro
|
||||
@@ -121,8 +121,8 @@ services:
|
||||
- '--path.sysfs=/host/sys'
|
||||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||
labels:
|
||||
- 'homelab.category=monitoring"
|
||||
- 'homelab.description=Hardware and OS metrics exporter"
|
||||
- 'homelab.category=monitoring'
|
||||
- 'homelab.description=Hardware and OS metrics exporter'
|
||||
|
||||
# cAdvisor - Container metrics exporter
|
||||
# Access at: http://192.168.4.4:8082
|
||||
@@ -134,7 +134,7 @@ services:
|
||||
- homelab-network
|
||||
- traefik-network
|
||||
ports:
|
||||
- "8082:8080"
|
||||
- '8082:8080'
|
||||
volumes:
|
||||
- /:/rootfs:ro
|
||||
- /var/run:/var/run:ro
|
||||
@@ -148,19 +148,19 @@ services:
|
||||
# TRAEFIK CONFIGURATION
|
||||
# ==========================================
|
||||
# Service metadata
|
||||
- 'homelab.category=monitoring"
|
||||
- 'homelab.description=Container metrics and performance monitoring"
|
||||
- 'homelab.category=monitoring'
|
||||
- 'homelab.description=Container metrics and performance monitoring'
|
||||
# Traefik reverse proxy (comment/uncomment to disable/enable)
|
||||
# If Traefik is on a remote server: these labels are NOT USED;
|
||||
# configure external yml files in /traefik/dynamic folder instead.
|
||||
- 'traefik.enable=true"
|
||||
- 'traefik.docker.network=traefik-network"
|
||||
- 'traefik.http.routers.cadvisor.rule=Host(`cadvisor.${DOMAIN}`)"
|
||||
- 'traefik.http.routers.cadvisor.entrypoints=websecure"
|
||||
- 'traefik.http.routers.cadvisor.tls=true"
|
||||
- 'traefik.http.routers.cadvisor.tls.certresolver=letsencrypt"
|
||||
- 'traefik.http.routers.cadvisor.middlewares=authelia@docker"
|
||||
- 'traefik.http.services.cadvisor.loadbalancer.server.port=8080"
|
||||
- 'traefik.enable=true'
|
||||
- 'traefik.docker.network=traefik-network'
|
||||
- 'traefik.http.routers.cadvisor.rule=Host(`cadvisor.${DOMAIN}`)'
|
||||
- 'traefik.http.routers.cadvisor.entrypoints=websecure'
|
||||
- 'traefik.http.routers.cadvisor.tls=true'
|
||||
- 'traefik.http.routers.cadvisor.tls.certresolver=letsencrypt'
|
||||
- 'traefik.http.routers.cadvisor.middlewares=authelia@docker'
|
||||
- 'traefik.http.services.cadvisor.loadbalancer.server.port=8080'
|
||||
|
||||
# Uptime Kuma - Uptime monitoring
|
||||
uptime-kuma:
|
||||
@@ -180,7 +180,7 @@ services:
|
||||
- homelab-network
|
||||
- traefik-network
|
||||
ports:
|
||||
- "3001:3001"
|
||||
- '3001:3001'
|
||||
volumes:
|
||||
- uptime-kuma-data:/app/data
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
@@ -188,19 +188,19 @@ services:
|
||||
# TRAEFIK CONFIGURATION
|
||||
# ==========================================
|
||||
# Service metadata
|
||||
- 'homelab.category=monitoring"
|
||||
- 'homelab.description=Service uptime monitoring and alerts"
|
||||
- 'homelab.category=monitoring'
|
||||
- 'homelab.description=Service uptime monitoring and alerts'
|
||||
# Traefik reverse proxy (comment/uncomment to disable/enable)
|
||||
# If Traefik is on a remote server: these labels are NOT USED;
|
||||
# configure external yml files in /traefik/dynamic folder instead.
|
||||
- 'traefik.enable=true"
|
||||
- 'traefik.docker.network=traefik-network"
|
||||
- 'traefik.http.routers.uptime-kuma.rule=Host(`uptime-kuma.${DOMAIN}`)"
|
||||
- 'traefik.http.routers.uptime-kuma.entrypoints=websecure"
|
||||
- 'traefik.http.routers.uptime-kuma.tls=true"
|
||||
- 'traefik.http.routers.uptime-kuma.tls.certresolver=letsencrypt"
|
||||
- 'traefik.http.routers.uptime-kuma.middlewares=authelia@docker"
|
||||
- 'traefik.http.services.uptime-kuma.loadbalancer.server.port=3001"
|
||||
- 'traefik.enable=true'
|
||||
- 'traefik.docker.network=traefik-network'
|
||||
- 'traefik.http.routers.uptime-kuma.rule=Host(`uptime-kuma.${DOMAIN}`)'
|
||||
- 'traefik.http.routers.uptime-kuma.entrypoints=websecure'
|
||||
- 'traefik.http.routers.uptime-kuma.tls=true'
|
||||
- 'traefik.http.routers.uptime-kuma.tls.certresolver=letsencrypt'
|
||||
- 'traefik.http.routers.uptime-kuma.middlewares=authelia@docker'
|
||||
- 'traefik.http.services.uptime-kuma.loadbalancer.server.port=3001'
|
||||
|
||||
# Loki - Log aggregation
|
||||
# Access at: http://192.168.4.4:3100
|
||||
@@ -221,7 +221,7 @@ services:
|
||||
- homelab-network
|
||||
- traefik-network
|
||||
ports:
|
||||
- "3100:3100"
|
||||
- '3100:3100'
|
||||
volumes:
|
||||
- ./config/loki:/etc/loki
|
||||
- loki-data:/loki
|
||||
@@ -230,19 +230,19 @@ services:
|
||||
# TRAEFIK CONFIGURATION
|
||||
# ==========================================
|
||||
# Service metadata
|
||||
- 'homelab.category=monitoring"
|
||||
- 'homelab.description=Log aggregation system"
|
||||
- 'homelab.category=monitoring'
|
||||
- 'homelab.description=Log aggregation system'
|
||||
# Traefik reverse proxy (comment/uncomment to disable/enable)
|
||||
# If Traefik is on a remote server: these labels are NOT USED;
|
||||
# configure external yml files in /traefik/dynamic folder instead.
|
||||
- 'traefik.enable=true"
|
||||
- 'traefik.docker.network=traefik-network"
|
||||
- 'traefik.http.routers.loki.rule=Host(`loki.${DOMAIN}`)"
|
||||
- 'traefik.http.routers.loki.entrypoints=websecure"
|
||||
- 'traefik.http.routers.loki.tls=true"
|
||||
- 'traefik.http.routers.loki.tls.certresolver=letsencrypt"
|
||||
- 'traefik.http.routers.loki.middlewares=authelia@docker"
|
||||
- 'traefik.http.services.loki.loadbalancer.server.port=3100"
|
||||
- 'traefik.enable=true'
|
||||
- 'traefik.docker.network=traefik-network'
|
||||
- 'traefik.http.routers.loki.rule=Host(`loki.${DOMAIN}`)'
|
||||
- 'traefik.http.routers.loki.entrypoints=websecure'
|
||||
- 'traefik.http.routers.loki.tls=true'
|
||||
- 'traefik.http.routers.loki.tls.certresolver=letsencrypt'
|
||||
- 'traefik.http.routers.loki.middlewares=authelia@docker'
|
||||
- 'traefik.http.services.loki.loadbalancer.server.port=3100'
|
||||
|
||||
# Promtail - Log shipper for Loki
|
||||
# Ships Docker container logs to Loki
|
||||
@@ -260,8 +260,8 @@ services:
|
||||
depends_on:
|
||||
- loki
|
||||
labels:
|
||||
- 'homelab.category=monitoring"
|
||||
- 'homelab.description=Log collector for Loki"
|
||||
- 'homelab.category=monitoring'
|
||||
- 'homelab.description=Log collector for Loki'
|
||||
|
||||
volumes:
|
||||
prometheus-data:
|
||||
|
||||
46
docker-compose/monitoring/loki/loki-config.yml
Normal file
46
docker-compose/monitoring/loki/loki-config.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
# Loki Configuration Template
|
||||
# Copy this file to ./config/loki/loki-config.yml
|
||||
|
||||
auth_enabled: false
|
||||
|
||||
server:
|
||||
http_listen_port: 3100
|
||||
grpc_listen_port: 9096
|
||||
|
||||
common:
|
||||
path_prefix: /loki
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /loki/chunks
|
||||
rules_directory: /loki/rules
|
||||
replication_factor: 1
|
||||
ring:
|
||||
instance_addr: 127.0.0.1
|
||||
kvstore:
|
||||
store: inmemory
|
||||
|
||||
schema_config:
|
||||
configs:
|
||||
- from: 2020-10-24
|
||||
store: boltdb-shipper
|
||||
object_store: filesystem
|
||||
schema: v11
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
|
||||
ruler:
|
||||
alertmanager_url: http://localhost:9093
|
||||
|
||||
# Retention configuration (delete logs older than 30 days)
|
||||
limits_config:
|
||||
retention_period: 720h # 30 days
|
||||
|
||||
# Compactor to delete old data
|
||||
compactor:
|
||||
working_directory: /loki/compactor
|
||||
shared_store: filesystem
|
||||
compaction_interval: 10m
|
||||
retention_enabled: true
|
||||
retention_delete_delay: 2h
|
||||
retention_delete_worker_count: 150
|
||||
49
docker-compose/monitoring/prometheus/prometheus.yml
Normal file
49
docker-compose/monitoring/prometheus/prometheus.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
# Prometheus Configuration Template
|
||||
# Copy this file to ./config/prometheus/prometheus.yml
|
||||
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
external_labels:
|
||||
monitor: 'homelab'
|
||||
|
||||
# Alertmanager configuration (optional)
|
||||
# alerting:
|
||||
# alertmanagers:
|
||||
# - static_configs:
|
||||
# - targets:
|
||||
# - alertmanager:9093
|
||||
|
||||
# Load rules once and periodically evaluate them
|
||||
# rule_files:
|
||||
# - "alerts/*.yml"
|
||||
|
||||
# Scrape configurations
|
||||
scrape_configs:
|
||||
# Prometheus itself
|
||||
- job_name: 'prometheus'
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
|
||||
# Node Exporter - System metrics
|
||||
- job_name: 'node-exporter'
|
||||
static_configs:
|
||||
- targets: ['node-exporter:9100']
|
||||
labels:
|
||||
instance: 'homelab-server'
|
||||
|
||||
# cAdvisor - Container metrics
|
||||
- job_name: 'cadvisor'
|
||||
static_configs:
|
||||
- targets: ['cadvisor:8080']
|
||||
labels:
|
||||
instance: 'homelab-server'
|
||||
|
||||
# Add your own services here
|
||||
# Example: Monitor a service with /metrics endpoint
|
||||
# - job_name: 'my-service'
|
||||
# static_configs:
|
||||
# - targets: ['my-service:8080']
|
||||
# labels:
|
||||
# instance: 'homelab-server'
|
||||
# service: 'my-service'
|
||||
53
docker-compose/monitoring/promtail/promtail-config.yml
Normal file
53
docker-compose/monitoring/promtail/promtail-config.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
# Promtail Configuration Template
|
||||
# Copy this file to ./config/promtail/promtail-config.yml
|
||||
|
||||
server:
|
||||
http_listen_port: 9080
|
||||
grpc_listen_port: 0
|
||||
|
||||
positions:
|
||||
filename: /tmp/positions.yaml
|
||||
|
||||
clients:
|
||||
- url: http://loki:3100/loki/api/v1/push
|
||||
|
||||
scrape_configs:
|
||||
# Docker container logs
|
||||
- job_name: docker
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: docker
|
||||
__path__: /var/lib/docker/containers/*/*-json.log
|
||||
|
||||
pipeline_stages:
|
||||
# Parse Docker JSON logs
|
||||
- json:
|
||||
expressions:
|
||||
output: log
|
||||
stream: stream
|
||||
attrs: attrs
|
||||
|
||||
# Extract container name from path
|
||||
- regex:
|
||||
expression: '/var/lib/docker/containers/(?P<container_id>[^/]+)/.*'
|
||||
source: filename
|
||||
|
||||
# Add labels
|
||||
- labels:
|
||||
stream:
|
||||
container_id:
|
||||
|
||||
# Output the log line
|
||||
- output:
|
||||
source: output
|
||||
|
||||
# System logs (optional)
|
||||
# - job_name: system
|
||||
# static_configs:
|
||||
# - targets:
|
||||
# - localhost
|
||||
# labels:
|
||||
# job: varlogs
|
||||
# __path__: /var/log/*.log
|
||||
42
docker-compose/monitoring/redis/redis.conf
Normal file
42
docker-compose/monitoring/redis/redis.conf
Normal file
@@ -0,0 +1,42 @@
|
||||
# Redis Configuration Template
|
||||
# Copy this file to ./config/redis/redis.conf
|
||||
|
||||
# Network
|
||||
bind 0.0.0.0
|
||||
protected-mode yes
|
||||
port 6379
|
||||
|
||||
# General
|
||||
daemonize no
|
||||
supervised no
|
||||
pidfile /var/run/redis_6379.pid
|
||||
loglevel notice
|
||||
logfile ""
|
||||
|
||||
# Persistence - AOF (Append Only File)
|
||||
appendonly yes
|
||||
appendfilename "appendonly.aof"
|
||||
appendfsync everysec
|
||||
no-appendfsync-on-rewrite no
|
||||
auto-aof-rewrite-percentage 100
|
||||
auto-aof-rewrite-min-size 64mb
|
||||
|
||||
# Persistence - RDB (Snapshotting)
|
||||
save 900 1
|
||||
save 300 10
|
||||
save 60 10000
|
||||
stop-writes-on-bgsave-error yes
|
||||
rdbcompression yes
|
||||
rdbchecksum yes
|
||||
dbfilename dump.rdb
|
||||
dir /data
|
||||
|
||||
# Memory Management
|
||||
maxmemory 256mb
|
||||
maxmemory-policy allkeys-lru
|
||||
|
||||
# Security
|
||||
# requirepass yourpassword # Uncomment and set a strong password
|
||||
|
||||
# Limits
|
||||
maxclients 10000
|
||||
Reference in New Issue
Block a user