add paperless-ng

This commit is contained in:
vincent 2022-09-04 16:42:51 +02:00
parent e88583f82a
commit b060db4a04
2 changed files with 106 additions and 0 deletions

View File

@ -21,6 +21,8 @@ postgresql_users:
password: "{{ lookup('hashi_vault', 'secret=secrets/data/ansible/database:drone')}}" password: "{{ lookup('hashi_vault', 'secret=secrets/data/ansible/database:drone')}}"
- name: dendrite - name: dendrite
password: "{{ lookup('hashi_vault', 'secret=secrets/data/ansible/database:dendrite')}}" password: "{{ lookup('hashi_vault', 'secret=secrets/data/ansible/database:dendrite')}}"
- name: paperless
password: "{{ lookup('hashi_vault', 'secret=secrets/data/ansible/database:paperless')}}"
postgresql_databases: postgresql_databases:
- name: wikijs - name: wikijs
@ -59,3 +61,7 @@ postgresql_databases:
lc_collate: fr_FR.UTF-8 lc_collate: fr_FR.UTF-8
lc_ctype: fr_FR.UTF-8 lc_ctype: fr_FR.UTF-8
owner: dendrite owner: dendrite
- name: paperless
lc_collate: fr_FR.UTF-8
lc_ctype: fr_FR.UTF-8
owner: paperless

View File

@ -0,0 +1,100 @@
job "paperless-ng" {
datacenters = ["homelab"]
priority= 50
type = "service"
meta {
forcedeploy = "0"
}
constraint {
attribute = "${attr.cpu.arch}"
value = "amd64"
}
group "paperless-ng"{
network {
mode = "host"
port "http" {
to = 8000
}
port "redis" {
to = 6379
}
}
vault{
policies= ["access-tables"]
}
task "redis" {
driver = "docker"
config {
image= "redis"
ports= ["redis"]
}
resources {
memory = 100
}
}
task "paperless-ng" {
driver = "docker"
service {
name = "${JOB}"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`${NOMAD_JOB_NAME}.ducamps.win`)",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=${NOMAD_JOB_NAME}.ducamps.win",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver",
"homer.enable=true",
"homer.name=Paperless",
"homer.service=Application",
"homer.logo=https://${NOMAD_JOB_NAME}.ducamps.win/static/frontend/fr-FR/apple-touch-icon.png",
"homer.target=_blank",
"homer.url=https://${NOMAD_JOB_NAME}.ducamps.win",
]
check {
type = "http"
name = "paperless-ng_health"
path="/"
interval = "30s"
timeout = "5s"
}
}
config {
image = "ghcr.io/paperless-ngx/paperless-ngx"
ports = ["http"]
volumes = [
"/mnt/diskstation/nomad/paperless-ng/media:/usr/src/paperless/media",
"/mnt/diskstation/nomad/paperless-ng/data:/usr/src/paperless/data",
"/mnt/diskstation/nomad/paperless-ng/export:/usr/src/paperless/export",
"/mnt/diskstation/nomad/paperless-ng/consume:/usr/src/paperless/consume",
]
}
env {
PAPERLESS_REDIS= "redis://${NOMAD_ADDR_redis}"
PAPERLESS_DBHOST= "db1.ducamps.win"
PAPERLESS_DBNAME= "paperless"
PAPERLESS_DBUSER= "paperless"
PAPERLESS_OCR_LANGUAGE="fra"
PAPERLESS_CONSUMER_POLLING="60"
PAPERLESS_URL="https://${NOMAD_JOB_NAME}.ducamps.win"
PAPERLESS_ALLOWED_HOSTS="*"
}
template {
data= <<EOH
PAPERLESS_DBPASS= {{ with secret "secrets/data/paperless"}}{{.Data.data.DB_PASSWORD }}{{end}}
EOH
destination = "secrets/paperless.env"
env = true
}
resources {
memory = 800
cpu = 2000
}
}
}
}