1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
- name: Set up Paperless-ngx
hosts: lotus-land-story
vars:
version: "{{ versions.paperless_ngx }}"
tasks:
- name: Create directories for volume mounting
ansible.builtin.file:
path: /mnt/lotus-land-story/paperless-ngx/{{ item }}
state: directory
mode: "0700"
loop:
- consume
- data
- export
- media
- name: Celery monitoring configuration
ansible.builtin.copy:
content: |
url_prefix = "/flower/"
dest: /mnt/lotus-land-story/paperless-ngx/flowerconfig.py
mode: "0644"
# https://github.com/paperless-ngx/paperless-ngx/blob/main/docker/compose/docker-compose.sqlite.yml
- name: Run Paperless-ngx
community.docker.docker_container:
restart: true
name: paperless-ngx
image: ghcr.io/paperless-ngx/paperless-ngx:{{ version }}
env:
PAPERLESS_ENABLE_FLOWER: "true"
PAPERLESS_ENABLE_HTTP_REMOTE_USER: "true"
# PAPERLESS_ENABLE_HTTP_REMOTE_USER_API: "true"
PAPERLESS_OCR_USER_ARGS: '{"continue_on_soft_render_error": true}'
PAPERLESS_REDIS: redis://host.docker.internal:6379
PAPERLESS_SECRET_KEY: "{{ paperless_ngx.secret }}"
PAPERLESS_TASK_WORKERS: "1"
PAPERLESS_THREADS_PER_WORKER: "1"
PAPERLESS_TIME_ZONE: America/Los_Angeles
# Training exhausts the host's memory, so keep it overnight.
PAPERLESS_TRAIN_TASK_CRON: "5 0 * * *"
PAPERLESS_URL: https://docs
PAPERLESS_WEBSERVER_WORKERS: "1"
volumes:
- /mnt/lotus-land-story/paperless-ngx/data:/usr/src/paperless/data
- /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
# paperless images are huge, so clean them up after we update the container
notify: Prune unused Docker images
no_log: true
handlers:
- name: Prune unused Docker images
community.docker.docker_prune:
images: true
images_filters:
dangling: false
- name: Import restarts
ansible.builtin.import_tasks: restarts.yml
# vim: ft=yaml.ansible