Compare commits

...

36 commits

Author SHA1 Message Date
rfl
7140ebb516
Update configs 2024-10-27 21:18:05 +01:00
rfl
7e0c9d5399
Include account email verification config 2024-10-27 20:32:10 +01:00
rfl
4b40777742
Include social auto signup config 2024-10-27 19:46:14 +01:00
rfl
e0ec215239
Set paperless url 2024-10-27 19:35:29 +01:00
rfl
f3cde83121
Switch to double quotes 2024-10-27 18:12:54 +01:00
rfl
3fac8ddcb2
Add quotes 2024-10-27 18:04:12 +01:00
rfl
8fe2695baf
Use correct env variable keys 2024-10-27 17:56:48 +01:00
rfl
3fb6d592e4
Fix env variable syntax 2024-10-27 17:53:21 +01:00
rfl
189f80c234
Set env variable 2024-10-27 17:43:03 +01:00
rfl
280ba5cba7
Add docker network 2024-10-27 17:32:15 +01:00
rfl
c36620551d
Patch docker compose version 2024-10-27 17:15:57 +01:00
rfl
6be4363d7e
Fix compose template file 2024-10-27 16:58:23 +01:00
rfl
af9d01bdb9
Fix compose template file 2024-10-27 16:55:09 +01:00
rfl
6a9507ad10
Fix jinja expression 2024-10-27 16:50:48 +01:00
rfl
6502e193fa
Fix template file paths 2024-10-27 16:49:20 +01:00
rfl
18590b7375
Fix template file names 2024-10-27 16:35:17 +01:00
rfl
69ec63e199
Track files 2024-10-25 20:06:53 +02:00
rfl
554ce3fd3e
Trying more 2024-10-25 19:58:00 +02:00
rfl
f7f212c248
Trying more 2024-10-25 19:54:13 +02:00
rfl
6ce5615675
Trying more 2024-10-25 19:52:20 +02:00
rfl
55f5572288
Trying out docker-compose state 2024-10-25 19:48:03 +02:00
rfl
0ae52b462a
ffs 2024-10-25 17:57:21 +02:00
rfl
2d6092cc4d
ffs 2024-10-25 17:56:17 +02:00
Bltzz
71306a2cd1 ffs 2024-10-22 23:00:59 +02:00
Bltzz
1d43361c72 ffs 2024-10-22 22:54:06 +02:00
Bltzz
3a9f812be1 ffs 2024-10-22 22:48:59 +02:00
Bltzz
3722602203 ffs 2024-10-22 22:47:31 +02:00
Bltzz
bfbaf515c2 ffs 2024-10-22 22:46:57 +02:00
Bltzz
1d495e1798 ffs 2024-10-22 22:45:35 +02:00
Bltzz
36f9d091e4 ffs 2024-10-22 22:39:28 +02:00
Bltzz
a958f1abd7 ffs 2024-10-22 22:38:43 +02:00
rfl
0909683e87 ffs 2024-10-22 22:37:12 +02:00
rfl
c54c629b5c
Merge branch 'dev' into dev-json-fix 2024-10-22 20:13:16 +02:00
rfl
cef3f9a5e4
FFS this environment variable 2024-10-22 20:10:10 +02:00
Bltzz
f942614e99 [FIX] Attempt to fix broken json variable parsing 2024-10-20 17:19:05 +02:00
rfl
4cf8c5c7d4
WIP: Use keycloak for sso 2024-10-02 13:02:56 +02:00
5 changed files with 142 additions and 51 deletions

View file

@ -0,0 +1,12 @@
--- /usr/local/lib/python3.11/dist-packages/docker/utils/utils.py 2024-10-08 22:38:19.859988188 +0200
+++ utils.py 2024-10-27 17:06:27.445617219 +0100
@@ -350,7 +350,8 @@
return device_list
-def kwargs_from_env(environment=None):
+def kwargs_from_env(environment=None, ssl_version=None):
+ # https://stackoverflow.com/a/77642303
if not environment:
environment = os.environ
host = environment.get('DOCKER_HOST')

View file

@ -0,0 +1,21 @@
USER_UID=1000
USER_GID=1000
PAPERLESS_REDIS={{ salt['pillar.get']('paperless:webserver:environment:redis', 'redis://broker:6379') }}
PAPERLESS_TIKA_ENABLED={{ salt['pillar.get']('paperless:webserver:environment:tika_enabled', '1') }}
PAPERLESS_TIKA_ENDPOINT={{ salt['pillar.get']('paperless:webserver:environment:tika_endpoint', 'http://tika:9998') }}
PAPERLESS_TIKA_GOTENBERG_ENDPOINT={{ salt['pillar.get']('paperless:webserver:environment:tika_gotenberg_endpoint', 'http://gotenberg:3000') }}
PAPERLESS_APPS=allauth.socialaccount.providers.openid_connect
PAPERLESS_CLIENT_SECRET={{ salt['pillar.get']('paperless:webserver:keycloak:client_secret', '<CLIENT_SECRET>') }}
PAPERLESS_SERVER_URL={{ salt['pillar.get']('paperless:webserver:keycloak:server_url', 'https://<KEYCLOAK_SERVER>/realms/<REALM>/.well-known/openid-configuration') }}
PAPERLESS_SOCIALACCOUNT_PROVIDERS="{\"openid_connect\":{\"APPS\":[{\"provider_id\": \"keycloak\", \"name\": \"Keycloak\", \"client_id\": \"paperless\", \"secret\": \"${PAPERLESS_CLIENT_SECRET}\", \"settings\":{\"server_url\": \"${PAPERLESS_SERVER_URL}\"}}]}}"
PAPERLESS_DISABLE_REGULAR_LOGIN={{ salt['pillar.get']('paperless:webserver:environment:disable_regular_login', 'true') }}
PAPERLESS_REDIRECT_LOGIN_TO_SSO={{ salt['pillar.get']('paperless:webserver:environment:redirect_login_to_sso', 'true') }}
PAPERLESS_SOCIAL_AUTO_SIGNUP={{ salt['pillar.get']('paperless:webserver:environment:social_auto_signup', 'true') }}
PAPERLESS_ACCOUNT_EMAIL_VERIFICATION={{ salt['pillar.get']('paperless:webserver:environment:account_email_verification', 'none') }}
PAPERLESS_ADMIN_USER={{ salt['pillar.get']('paperless:webserver:environment:admin_user', 'admin') }}
PAPERLESS_ADMIN_PASSWORD={{ salt['pillar.get']('paperless:webserver:environment:admin_password', 'change-me') }}
PAPERLESS_URL={{ salt['pillar.get']('paperless:webserver:environment:url', 'https://paperless.flipdot.space') }}

View file

@ -0,0 +1,22 @@
services:
paperless:
image: {{ salt['pillar.get']('paperless:webserver:image:path', 'ghcr.io/paperless-ngx/paperless-ngx') }}:{{ salt['pillar.get']('paperless:webserver:image:version', '2.12') }}
container_name: paperless
env_file: docker-compose.env
restart: always
networks:
- paperless-network
volumes:
- /opt/paperless/webserver/data:/usr/src/paperless/data
- /opt/paperless/webserver/media:/usr/src/paperless/media
- /opt/paperless/webserver/export:/usr/src/paperless/export
- /opt/paperless/webserver/consume:/usr/src/paperless/consume
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- {{ salt['pillar.get']('paperless:webserver:ip', '127.0.0.1') }}:{{ salt['pillar.get']('paperless:webserver:port', '8000') }}:8000
networks:
paperless-network:
external:
name: paperless-network

View file

@ -8,10 +8,65 @@ paperless-data-directory-exists:
- name: /opt/paperless/webserver
- makedirs: True
python3-pip:
pkg.installed
# https://github.com/saltstack/salt/issues/61004
python-pip-uptodate:
pip.installed:
- require:
- pkg: python3-pip
- pkgs:
- pip
- upgrade: True
# https://bugs.launchpad.net/ubuntu/+source/python-docker/+bug/2066926
# https://packages.debian.org/source/sid/python-docker
# does not work
# python-docker-package:
# pkg.installed:
# - name: python3-docker
# https://stackoverflow.com/a/78224409
# https://github.com/docker/docker-py/issues/3113
# https://github.com/saltstack/salt/issues/62689
docker-requirements:
pip.installed:
- require:
- pkg: python3-pip
- pkgs:
- pyyaml==5.3.1
# - docker==6.1.3
# - docker==7.0.0
- docker==7.1.0
# - docker==5.0.3
# - docker-py==1.10.5
# - requests<2.29.0
# - urllib3<2.0
- docker-compose>=1.5.0
# other errors that were encountered
# keyerror http+docker
# https://github.com/geerlingguy/ansible-role-docker/issues/462
# https://github.com/docker/docker-py/issues/3279
# unexpected keyword argument 'chunked'
# https://github.com/saltstack/salt/issues/65526
# 'docker.version' is not available
# https://github.com/saltstack/salt/issues/53836
# https://github.com/saltstack/salt/issues/54449
# https://github.com/saltstack/salt/issues/62602
# network is always recreated
# https://github.com/saltstack/salt/issues/66408
# otherwise it complains about scope attribute, similar to
# https://github.com/saltstack/salt/issues/50194
# https://github.com/saltstack/salt/issues/51009
# but it should be possible according to docs
# https://docs.saltproject.io/en/latest/ref/states/all/salt.states.docker_network.html#salt.states.docker_network.present
docker-network-paperless-exists:
docker_network.present:
- name: paperless-network
- scope: local
# - scope: local
broker-docker-container-running:
docker_container.running:
@ -47,37 +102,25 @@ tika-docker-container-running:
- networks:
- paperless-network
paperless-docker-container-running:
docker_container.running:
# The Docker setup does not use the configuration file.
# So we have to set everything through environment variables.
# see https://github.com/paperless-ngx/paperless-ngx/blob/main/docker/compose/docker-compose.env
- name: paperless
- image: {{ salt['pillar.get']('paperless:webserver:image:path', 'ghcr.io/paperless-ngx/paperless-ngx') }}:{{ salt['pillar.get']('paperless:webserver:image:version', '2.12') }}
- container_name: paperless
- environment:
- USER_UID=1000
- USER_GID=1000
- PAPERLESS_REDIS={{ salt['pillar.get']('paperless:webserver:environment:redis', 'redis://broker:6379') }}
- PAPERLESS_TIKA_ENABLED={{ salt['pillar.get']('paperless:webserver:environment:tika_enabled', '1') }}
- PAPERLESS_TIKA_ENDPOINT={{ salt['pillar.get']('paperless:webserver:environment:tika_endpoint', 'http://tika:9998') }}
- PAPERLESS_TIKA_GOTENBERG_ENDPOINT={{ salt['pillar.get']('paperless:webserver:environment:tika_gotenberg_endpoint', 'http://gotenberg:3000') }}
# https://stackoverflow.com/a/77642303
docker-compose-version-fix:
file.patch:
- name: /usr/local/lib/python3.11/dist-packages/docker/utils/utils.py
- source: salt://paperless/docker-compose-version-fix.patch
# - PAPERLESS_ENABLE_HTTP_REMOTE_USER={{ salt['pillar.get']('', 'false') }}
# - PAPERLESS_ENABLE_HTTP_REMOTE_USER_API={{ salt['pillar.get']('', 'false') }}
# - PAPERLESS_SECRET_KEY={{ salt['pillar.get']('paperless:webserver:environment:secret_key', 'change-me') }}
# - PAPERLESS_URL={{ salt['pillar.get']('paperless:webserver:environment:url', 'https://paperless.flipdot.org') }}
- restart: always
- networks:
- paperless-network
- extra_hosts:
- ldap.flipdot.space:192.168.3.233
- binds:
- /opt/paperless/webserver/data:/usr/src/paperless/data
- /opt/paperless/webserver/media:/usr/src/paperless/media
- /opt/paperless/webserver/export:/usr/src/paperless/export
- /opt/paperless/webserver/consume:/usr/src/paperless/consume
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- port_bindings:
- {{ salt['pillar.get']('paperless:webserver:ip', '127.0.0.1') }}:{{ salt['pillar.get']('paperless:webserver:port', '8000') }}:8000
paperless-docker-compose-env-file-present:
file.managed:
- name: /opt/paperless/docker-compose.env
- template: jinja
- source: salt://paperless/docker-compose.env.jinja
paperless-docker-compose-file-present:
file.managed:
- name: /opt/paperless/docker-compose.yml
- template: jinja
- source: salt://paperless/docker-compose.yml.jinja
paperless-docker-compose-up:
module.run:
- dockercompose.up:
- path: /opt/paperless/docker-compose.yml

View file

@ -15,27 +15,20 @@ paperless:
tika_endpoint: http://tika:9998
tika_gotenberg_endpoint: http://gotenberg:3000
# following is included here for later, uncomment in init.sls as well
# https://docs.paperless-ngx.com/advanced_usage/#sso-and-third-party-authentication-with-paperless-ngx
# https://github.com/paperless-ngx/paperless-ngx/discussions?discussions_q=ldap
# https://github.com/paperless-ngx/paperless-ngx/discussions/498
# https://github.com/paperless-ngx/paperless-ngx/discussions/3228
# Allows authentication via HTTP_REMOTE_USER which is used by some SSO applications.
# enable_http_remote_user=true
# Allows authentication via HTTP_REMOTE_USER directly against the API
# enable_http_remote_user_api=true
# Adjust this key if you plan to make paperless available publicly. It should
# be a very long sequence of random characters. You don't need to remember it.
# secret_key=change-me
# This is required if you will be exposing Paperless-ngx on a public domain
# (if doing so please consider security measures such as reverse proxy)
# url=https://paperless.flipdot.org
disable_regular_login: True
redirect_login_to_sso: True
social_auto_signup: True
account_email_verification: none
admin_user: admin
admin_password: change-me
url: https://paperless.flipdot.space
keycloak:
client_secret: <CLIENT_SECRET>
server_url: https://<KEYCLOAK_SERVER>/realms/<REALM>/.well-known/openid-configuration
gotenberg:
image:
path: docker.io/gotenberg/gotenberg