Added: paperless-ngx
This commit is contained in:
1 parent
230a360ad7
commit
376255e15d
8 files changed
+167
No files matched your search
@@ -0,0 +1,27 @@
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
server_name {{ http_host }};
|
||||
|
||||
# Allow large attachments
|
||||
client_max_body_size 128M;
|
||||
|
||||
location / {
|
||||
|
||||
# Adjust host and port as required.
|
||||
proxy_pass http://localhost:{{ web_port }}/;
|
||||
|
||||
# These configuration options are required for WebSockets to work.
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin";
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: Setup Paperless-NGX and Nginx reverse proxy
|
||||
hosts: gondor
|
||||
become: true
|
||||
vars_files:
|
||||
- vars/default.yml
|
||||
roles:
|
||||
- paperless
|
||||
- nginx
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#################################################
|
||||
# DO Community Playbooks: Docker
|
||||
#################################################
|
||||
---
|
||||
- hosts: all
|
||||
become: true
|
||||
vars_files:
|
||||
- vars/default.yml
|
||||
|
||||
tasks:
|
||||
- name: Create paperless-ng container
|
||||
docker_container:
|
||||
name: "{{ container_name }}"
|
||||
image: "{{ container_image }}"
|
||||
state: started
|
||||
restart_policy: "unless-stopped"
|
||||
env:
|
||||
PAPERLESS_DBHOST: db
|
||||
PAPERLESS_REDIS: redis://broker:6379
|
||||
links:
|
||||
- postgres:db
|
||||
- redis:broker
|
||||
published_ports:
|
||||
- 127.0.0.1:8000:8000
|
||||
volumes:
|
||||
- /var/lib/paperless/data:/usr/src/paperless/data
|
||||
- /var/lib/paperless/media:/usr/src/paperless/media
|
||||
- /var/lib/paperless/export:/usr/src/paperless/export
|
||||
- /var/lib/paperless/consume:/usr/src/paperless/consume
|
||||
@@ -0,0 +1,6 @@
|
||||
# Paperless NGX
|
||||
|
||||
Create a super user inititally:
|
||||
```shell
|
||||
docker exec -it paperless-ngx python3 manage.py createsuperuser
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
# Handlers for Nginx role
|
||||
- name: Reload Nginx
|
||||
service:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
# Tasks for Nginx role
|
||||
- name: Check if Nginx conf file exists
|
||||
stat:
|
||||
path: "/etc/nginx/sites-available/{{ http_conf }}"
|
||||
register: status
|
||||
|
||||
- name: No need to reload Nginx
|
||||
debug:
|
||||
msg: "No need to reload Nginx as sites-available entries have already been created"
|
||||
|
||||
- name: Set Nginx conf file
|
||||
when: status.stat.exists == false
|
||||
template:
|
||||
src: "files/nginx.conf.j2"
|
||||
dest: "/etc/nginx/sites-available/{{ http_conf }}"
|
||||
|
||||
- name: Enable new site
|
||||
when: status.stat.exists == false
|
||||
file:
|
||||
src: "/etc/nginx/sites-available/{{ http_conf }}"
|
||||
dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
|
||||
state: link
|
||||
notify: Reload Nginx
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
- name: Pull image
|
||||
docker_image:
|
||||
name: "{{ image_name }}"
|
||||
source: pull
|
||||
force_source: yes
|
||||
|
||||
|
||||
- name: Ensure Paperless Directories exists
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
loop:
|
||||
- "/var/lib/{{ host_directory }}"
|
||||
- "/var/lib/{{ host_directory }}/data"
|
||||
- "/var/lib/{{ host_directory }}/media"
|
||||
- "/var/lib/{{ host_directory }}/export"
|
||||
- "/var/lib/{{ host_directory }}/consume"
|
||||
|
||||
- name: Run Paperless-NGX Docker container
|
||||
community.docker.docker_container:
|
||||
name: "{{ container_name }}"
|
||||
image: "{{ image_name }}:{{ image_version }}"
|
||||
state: started
|
||||
restart_policy: always
|
||||
links:
|
||||
- postgres:db
|
||||
- redis:redis
|
||||
env:
|
||||
PAPERLESS_URL: "https://{{ http_host }}"
|
||||
PAPERLESS_REDIS: redis://redis:6379
|
||||
PAPERLESS_DBHOST: db
|
||||
PAPERLESS_DBUSER: "{{ postgres_user }}"
|
||||
PAPERLESS_DBPASS: "{{ postgres_password }}"
|
||||
PAPERLESS_DBNAME: "{{ postgres_db }}"
|
||||
PAPERLESS_TIME_ZONE: "{{ paperless_time_zone }}"
|
||||
PAPERLESS_OCR_USER_ARGS: '{"invalidate_digital_signatures": true}'
|
||||
volumes:
|
||||
- "/var/lib/{{ host_directory }}/data:/usr/src/paperless/data"
|
||||
- "/var/lib/{{ host_directory }}/media:/usr/src/paperless/media"
|
||||
- "/var/lib/{{ host_directory }}/export:/usr/src/paperless/export"
|
||||
- "/var/lib/{{ host_directory }}/consume:/usr/src/paperless/consume"
|
||||
ports:
|
||||
- "127.0.0.1:{{ web_port }}:8000"
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
|
||||
image_name: ghcr.io/paperless-ngx/paperless-ngx
|
||||
image_version: "latest"
|
||||
container_name: paperless-ngx
|
||||
|
||||
web_port: 8000 # Configurable port
|
||||
|
||||
host_directory: paperless
|
||||
http_host: paperless.tanshu.com # Replace with your domain
|
||||
http_conf: "{{ http_host }}.conf"
|
||||
|
||||
paperless_time_zone: Etc/UTC
|
||||
postgres_user: "postgres"
|
||||
postgres_password: "123456"
|
||||
postgres_db: "paperless"
|
||||
|
||||
|
||||
|
||||
# db_url: postgresql://postgres:123456@db:5432/paperless
|
||||
|
||||
Reference in new issue
Block a user