paperless-ngx: add service

This commit is contained in:
dogeystamp 2023-12-09 21:36:36 -05:00
parent 314f1cfc8d
commit 533082b8d4
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
9 changed files with 109 additions and 8 deletions

View File

@ -9,12 +9,13 @@ This project was largely inspired by his own [infra](https://github.com/notthebe
## services ## services
The following services are managed completely automatically: The following services are managed completely automatically:
- Gitea - [Gitea](https://about.gitea.com/)
- Matrix Synapse - [Matrix Synapse](https://github.com/matrix-org/synapse)
- Syncthing - [Syncthing](https://syncthing.net/)
- Navidrome - [Navidrome](https://www.navidrome.org/)
- Exim mail (internal use only) - [Paperless-ngx](https://docs.paperless-ngx.com/)
- Caddy reverse proxy - [Exim](https://www.exim.org/) mail (internal use only)
- [Caddy](https://caddyserver.com/) reverse proxy
## misc features ## misc features

View File

@ -20,3 +20,6 @@ syncthing_gui_pass: ""
registration_shared_secret: "" registration_shared_secret: ""
macaroon_secret_key: "" macaroon_secret_key: ""
form_secret: "" form_secret: ""
# paperless secret key
paperless_secret: ""

View File

@ -45,6 +45,9 @@ all:
navidrome: navidrome:
hosts: hosts:
your_fleet_host: your_fleet_host:
paperless:
hosts:
your_fleet_host:
bastion: bastion:
children: children:
ddclient: ddclient:

View File

@ -9,6 +9,7 @@ website_path: /srv/http
gitea_domain: "git.{{ domain }}" gitea_domain: "git.{{ domain }}"
navidrome_domain: "mus.{{ domain }}" navidrome_domain: "mus.{{ domain }}"
matrix_domain: "m.{{ domain }}" matrix_domain: "m.{{ domain }}"
paperless_domain: "doc.{{ domain }}"
## send renewal reminders to this address ## send renewal reminders to this address
email: null email: null

View File

@ -38,3 +38,9 @@ www.{{ domain }} {
reverse_proxy /_matrix/* {{ groups["synapse"][0] }}:8008 reverse_proxy /_matrix/* {{ groups["synapse"][0] }}:8008
} }
{% endif %} {% endif %}
{% if groups["paperless"] | length > 0 %}
{{ paperless_domain }} {
reverse_proxy {{ groups["paperless"][0] }}:8000
}
{% endif %}

View File

@ -16,3 +16,5 @@ syncthing_conf_dir: "{{ dataroot }}/syncthing/config"
music_path: "{{ dataroot }}/music" music_path: "{{ dataroot }}/music"
navidrome_domain: "mus.{{ domain }}" navidrome_domain: "mus.{{ domain }}"
paperless_domain: "doc.{{ domain }}"

View File

@ -21,7 +21,6 @@
group: group:
name: vault name: vault
state: present state: present
when: '"syncthing" in groups'
- name: Create Syncthing user - name: Create Syncthing user
user: user:
@ -54,7 +53,43 @@
name: "{{ username }}" name: "{{ username }}"
append: yes append: yes
groups: vault groups: vault
when: '"syncthing" in groups'
- name: Create Paperless group
group:
name: paperless
state: present
register: group_paperless
- name: Create Paperless user
user:
name: paperless
group: paperless
register: user_paperless
- name: Create Paperless directories
file:
path: "{{ dataroot }}/paperless/{{ item }}"
state: directory
owner: paperless
group: paperless
mode: "u=rwX,g=,o="
with_items:
- data
- media
- name: Create Paperless consume directory
file:
path: "{{ dataroot }}/paperless/consume"
state: directory
owner: paperless
group: paperless
mode: "u=rwX,g=rwX,o="
- name: Create Paperless .env file
template:
src: "paperless.env.j2"
dest: "{{ docker_compose_dir }}/paperless.env"
lstrip_blocks: true
- name: Create Navidrome user - name: Create Navidrome user
user: user:

View File

@ -47,6 +47,7 @@ services:
- {{ archive_path }}/:/vault_a - {{ archive_path }}/:/vault_a
- {{ syncthing_conf_dir }}/:/var/syncthing/config - {{ syncthing_conf_dir }}/:/var/syncthing/config
- "{{ music_path }}:/music" - "{{ music_path }}:/music"
- "{{ dataroot }}/paperless/consume:/paperless"
{% endif %} {% endif %}
{% if "navidrome" in group_names %} {% if "navidrome" in group_names %}
@ -83,3 +84,51 @@ services:
- "8008:8008/tcp" - "8008:8008/tcp"
{% endif %} {% endif %}
{% if "paperless" in group_names %}
paperless-broker:
container_name: paperless-broker
image: docker.io/library/redis:7
restart: unless-stopped
volumes:
- redisdata:/data
paperless-web:
container_name: paperless-web
image: ghcr.io/paperless-ngx/paperless-ngx:latest
restart: unless-stopped
depends_on:
- paperless-broker
ports:
- "8000:8000"
healthcheck:
test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- "{{ dataroot }}/paperless/data:/usr/src/paperless/data"
- "{{ dataroot }}/paperless/media:/usr/src/paperless/media"
- paperless-export:/usr/src/paperless/export
- "{{ dataroot }}/paperless/consume:/usr/src/paperless/consume"
env_file: paperless.env
environment:
USERMAP_UID: "{{ user_paperless.uid }}"
# it gets the vault group because otherwise syncthing can't read the consume dir
USERMAP_GID: "{{ user_syncthing.group }}"
PAPERLESS_REDIS: redis://paperless-broker:6379
PAPERLESS_URL: "https://{{ paperless_domain }}"
PAPERLESS_USE_X_FORWARD_HOST: true
PAPERLESS_USE_X_FORWARD_PORT: true
PAPERLESS_OCR_PAGES: 1
PAPERLESS_TASK_WORKERS: 2
PAPERLESS_THREADS_PER_WORKER: 2
PAPERLESS_WEBSERVER_WORKERS: 1
PAPERLESS_ENABLE_NLTK: false
{% endif %}
{% if "paperless" in group_names %}
volumes:
redisdata:
paperless-export:
{% endif %}

View File

@ -0,0 +1 @@
PAPERLESS_SECRET_KEY={{ paperless_secret }}