From 3f88065da4e0190dc38642bde7e5e9c4592f9cb6 Mon Sep 17 00:00:00 2001 From: TuDatTr Date: Sat, 7 Oct 2023 14:47:09 +0200 Subject: [PATCH] Added paperless Signed-off-by: TuDatTr --- group_vars/all/vars.yml | 26 +++++++++- host_vars/aya01.yml | 4 ++ roles/docker/templates/aya01/compose.yaml | 60 ++++++++++++++++++++++- 3 files changed, 87 insertions(+), 3 deletions(-) diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 1144d5f..6a1a883 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -458,9 +458,31 @@ nginx: jellyfin: host: "jellyfin" port: "8096" - config: "{{docker_data_dir}}/jellyfin/config" - cache: "{{docker_data_dir}}/jellyfin/cache" + config: "{{docker_dir}}/jellyfin/config" + cache: "{{docker_dir}}/jellyfin/cache" media: tv: "{{ plex_tv }}" movies: "{{ plex_movies }}" music: "{{ plex_music }}" + +# +# paperless-ngx +# + +paperless: + host: "paperless" + port: "8000" + data: + data: "{{ docker_dir }}/paperless/data/data" + media: "{{ docker_dir }}/paperless/data/media" + export: "{{ docker_dir }}/paperless/data/export" + consume: "{{ docker_dir }}/paperless/data/consume" + db: + host: "paperless-sqlite" + db: "paperless" + user: "paperless" + password: "{{ host.paperless.db.password }}" + data: "{{ docker_dir }}/paperless/db/data" + redis: + host: "paperless-redis" + data: "{{ docker_dir }}/paperless/redis/data" diff --git a/host_vars/aya01.yml b/host_vars/aya01.yml index f7b0fc1..6e45b0f 100644 --- a/host_vars/aya01.yml +++ b/host_vars/aya01.yml @@ -5,6 +5,7 @@ ansible_ssh_private_key_file: '{{ pk_path }}' ansible_become_pass: '{{ vault.aya01.sudo }}' host: + hostname: "aya01" ip: "{{ ansible_host }}" backblaze: account: "{{ vault.aya01.backblaze.account }}" @@ -43,3 +44,6 @@ host: type: "fuse.mergerfs" samba: password: "{{ vault.aya01.samba.password }}" + paperless: + db: + password: "{{ vault.aya01.paperless.db.password }}" diff --git a/roles/docker/templates/aya01/compose.yaml b/roles/docker/templates/aya01/compose.yaml index 692050a..c500ec8 100644 --- a/roles/docker/templates/aya01/compose.yaml +++ b/roles/docker/templates/aya01/compose.yaml @@ -35,7 +35,7 @@ services: - PGID={{pgid}} - TZ={{timezone}} - "WEBPASSWORD={{ vault_aya01_pihole_password }}" - - "ServerIP={{aya01_ip}}" + - "ServerIP={{ host.ip }}" - "INTERFACE=eth0" - "DNS1=1.1.1.1" - "DNS1=1.0.0.1" @@ -377,6 +377,64 @@ services: ports: - "{{ jellyfin.port }}:{{ jellyfin.port }}" + broker: + container_name: {{ paperless.redis.host }} + image: docker.io/library/redis:7 + restart: unless-stopped + depends_on: + - pihole + networks: + - net + volumes: + - {{paperless.redis.data}}:/data + + db: + container_name: {{ paperless.db.host }} + image: docker.io/library/postgres:15 + restart: unless-stopped + depends_on: + - pihole + networks: + - net + volumes: + - {{paperless.db.data}}:/var/lib/postgresql/data + environment: + POSTGRES_DB: {{ paperless.db.db }} + POSTGRES_USER: {{ paperless.db.user }} + POSTGRES_PASSWORD: {{ paperless.db.password }} + + paperless: + container_name: {{ paperless.host }} + image: ghcr.io/paperless-ngx/paperless-ngx:latest + restart: unless-stopped + depends_on: + - db + - broker + networks: + - net + ports: + - "{{ paperless.port }}:{{ paperless.port }}" + healthcheck: + test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:{{ paperless.port }}"] + interval: 30s + timeout: 10s + retries: 5 + volumes: + - {{ paperless.data.data }}:/usr/src/paperless/data + - {{ paperless.data.media }}:/usr/src/paperless/media + - {{ paperless.data.export }}:/usr/src/paperless/export + - {{ paperless.data.consume }}:/usr/src/paperless/consume + environment: + - "PAPERLESS_REDIS=redis://broker:6379" + - "PAPERLESS_DBHOST=db" + - "PAPERLESS_DBUSER={{paperless.db.user}}" + - "PAPERLESS_DBPASS={{paperless.db.password}}" + - "USERMAP_UID={{ puid }}" + - "USERMAP_GID={{ pgid}}" + - "PAPERLESS_URL=https://{{paperless.host}}.{{ host.hostname }}.{{ backup_domain }}" + - "PAPERLESS_TIME_ZONE={{ timezone }}" + - "PAPERLESS_OCR_LANGUAGE=deu" + networks: zoneminder: driver: bridge