diff --git a/docker-compose.yml b/docker-compose.yml index 5bd125b..1175613 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,8 +6,8 @@ services: image: "traefik:latest" container_name: "traefik" command: -# - "--log.level=DEBUG" - - "--api.insecure=true" +# - "--log.level=DEBUG" # disable in prod + - "--api.insecure=true" # disable in prod - "--providers.docker=true" - "--providers.docker.exposedbydefault=false" - "--providers.file.directory=/etc/traefik/dynamic_conf.d" @@ -38,8 +38,31 @@ services: - "traefik.http.services.grafana.loadbalancer.server.port=3000" depends_on: - traefik - #networks: - # - traefik-net + restart: unless-stopped + environment: + - GF_SECURITY_ADMIN_USER=admin + - GF_SECURITY_ADMIN_PASSWORD=grafana + volumes: + - ./grafana:/etc/grafana/provisioning/datasources + + prometheus: + image: "prom/prometheus:latest" + container_name: "prometheus" + command: + - '--config.file=/etc/prometheus/prometheus.yml' + restart: unless-stopped + volumes: + - ./prometheus:/etc/prometheus + - prom_data:/prometheus + #labels: # We might want to reserve this interface to a closed network + # - "traefik.enable=true" + # - "traefik.http.routers.prometheus.rule=Host(`prom.clps.ch`)" + # - "traefik.http.routers.prometheus.entrypoints=https" + # - "traefik.http.routers.prometheus.tls.certresolver=letsencrypt" + # - "traefik.http.routers.prometheus.tls=true" + # - "traefik.http.services.prometheus.loadbalancer.server.port=9090" + depends_on: + - traefik nextcloud: image: "nextcloud/all-in-one:latest" @@ -49,8 +72,8 @@ services: - "APACHE_PORT=11000" - "APACHE_IP_BINDING=0.0.0.0" ports: - - "8080:8080" - - "8443:8443" + - "8080:8080" # disable in prod + - "8443:8443" # disable in prod volumes: - "nextcloud_aio_mastercontainer:/mnt/docker-aio-config" - "/var/run/docker.sock:/var/run/docker.sock:ro" @@ -60,4 +83,4 @@ services: volumes: nextcloud_aio_mastercontainer: - + prom_data: diff --git a/grafana/datasource.yml b/grafana/datasource.yml new file mode 100644 index 0000000..03277e5 --- /dev/null +++ b/grafana/datasource.yml @@ -0,0 +1,21 @@ +global: + scrape_interval: 15s + scrape_timeout: 10s + evaluation_interval: 15s +alerting: + alertmanagers: + - static_configs: + - targets: [] + scheme: http + timeout: 10s + api_version: v1 +scrape_configs: +- job_name: prometheus + honor_timestamps: true + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - prometheus:9090 diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml new file mode 100644 index 0000000..b0c47b4 --- /dev/null +++ b/prometheus/prometheus.yml @@ -0,0 +1,21 @@ +global: + scrape_interval: 15s + scrape_timeout: 10s + evaluation_interval: 15s +alerting: + alertmanagers: + - static_configs: + - targets: [] + scheme: http + timeout: 10s + api_version: v2 +scrape_configs: +- job_name: prometheus + honor_timestamps: true + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - localhost:9090