From af19f7746cc5bba40566164fc536a6bb6cc5ea7c Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Sun, 28 Jan 2024 17:20:52 -0800 Subject: [PATCH] paperless-ngx o11y --- lotus-land-story/paperless-ngx.yml | 10 ++++++++++ lotus-land-story/templates/Caddyfile | 21 +++++++++++++++++++++ lotus-land-story/templates/prometheus.yml | 7 +++++++ 3 files changed, 38 insertions(+) diff --git a/lotus-land-story/paperless-ngx.yml b/lotus-land-story/paperless-ngx.yml index c9c2fcc..7cb1796 100644 --- a/lotus-land-story/paperless-ngx.yml +++ b/lotus-land-story/paperless-ngx.yml @@ -17,6 +17,13 @@ - export - media + - name: Celery monitoring configuration + ansible.builtin.copy: + content: | + url_prefix = "/flower/" + dest: /mnt/lotus-land-story/paperless-ngx/flowerconfig.py + mode: "0644" + - name: Get docker network community.docker.docker_network: name: lotus_land_story @@ -29,6 +36,7 @@ name: paperless-ngx image: ghcr.io/paperless-ngx/paperless-ngx:{{ version }} env: + PAPERLESS_ENABLE_FLOWER: "true" PAPERLESS_ENABLE_HTTP_REMOTE_USER: "true" PAPERLESS_REDIS: redis://host.docker.internal:6379 PAPERLESS_TIME_ZONE: America/Los_Angeles @@ -39,12 +47,14 @@ - /mnt/lotus-land-story/paperless-ngx/media:/usr/src/paperless/media - /mnt/lotus-land-story/paperless-ngx/export:/usr/src/paperless/export - /mnt/lotus-land-story/paperless-ngx/consume:/usr/src/paperless/consume + - /mnt/lotus-land-story/paperless-ngx/flowerconfig.py:/usr/src/paperless/src/paperless/flowerconfig.py:ro restart_policy: unless-stopped networks: - name: lotus_land_story etc_hosts: host.docker.internal: host-gateway + handlers: - name: Import restarts ansible.builtin.import_tasks: restarts.yml diff --git a/lotus-land-story/templates/Caddyfile b/lotus-land-story/templates/Caddyfile index b8f3f76..976a75c 100644 --- a/lotus-land-story/templates/Caddyfile +++ b/lotus-land-story/templates/Caddyfile @@ -67,3 +67,24 @@ books.{{ domain }} { import trusted_proxy_list } } + +paperless.{{ domain }} { + forward_auth authelia:9091 { + uri /api/verify?rd=https://auth.{{ domain }} + copy_headers Remote-User + + # This import needs to be included if you're relying on a trusted proxies configuration. + import trusted_proxy_list + } + + reverse_proxy paperless-ngx:8000 { + import trusted_proxy_list + } + + redir /flower /flower/ + handle /flower/* { + reverse_proxy paperless-ngx:5555 + } +} + +# vim: ts=4 diff --git a/lotus-land-story/templates/prometheus.yml b/lotus-land-story/templates/prometheus.yml index 8f11237..6465d1b 100644 --- a/lotus-land-story/templates/prometheus.yml +++ b/lotus-land-story/templates/prometheus.yml @@ -64,3 +64,10 @@ scrape_configs: static_configs: - targets: - {{ prometheus.akkoma.target }} + + - job_name: paperless + metrics_path: /flower/metrics + static_configs: + - targets: ['paperless-ngx:5555'] + +# vim: ft=yaml.ansible