diff --git a/paperless/init.sls b/paperless/init.sls index 3c18919..f99e17b 100644 --- a/paperless/init.sls +++ b/paperless/init.sls @@ -1,12 +1,3 @@ -# Attempt to fix json with pillar variables in variable -{% set client_secret = salt['pillar.get']('paperless:webserver:keycloak:client_secret', '') %} -{% set oauth_server = salt['pillar.get']('paperless:webserver:keycloak:server_url', 'https:///realms//.well-known/openid-configuration') %} -{% set PAPERLESS_SOCIALACCOUNT_PROVIDERS_ = {'openid_connect':{'APPS':[{'provider_id': 'keycloak', 'name': 'Keycloak', 'client_id': 'paperless', - 'secret': client_secret, - 'settings':{'server_url': - oauth_server}}]}} | -tojson %} - broker-data-directory-exists: file.directory: - name: /opt/paperless/broker @@ -51,6 +42,7 @@ docker-requirements: # - 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 @@ -109,38 +101,19 @@ 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') }} +paperless-docker-compose-env-file-present: + file.managed: + - name: /opt/docker-compose.env + - template: jinja + - source: salt://docker-compose.env - - PAPERLESS_APPS=allauth.socialaccount.providers.openid_connect - - PAPERLESS_SOCIALACCOUNT_PROVIDERS={"key": {"value": 3}} - - 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-docker-compose-file-present: + file.managed: + - name: /opt/docker-compose.yml + - template: jinja + - source: salt://docker-compose.yml - - 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') }} - - restart: always - - networks: - - paperless-network - - 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-up: + module.run: + - dockercompose.up: + - path: /opt/docker-compose.yml