From 1aed26618b6333927a120dbb1ee5328223270555 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Mon, 12 Jul 2021 13:00:05 +0200 Subject: [PATCH] Update to 2021-07-12 13:00 --- roles/mayan_edms/defaults/main.yml | 2 +- roles/papermerge/defaults/main.yml | 12 ++++++++++-- roles/papermerge/meta/main.yml | 1 + roles/papermerge/tasks/archive_pre.yml | 6 ++++++ roles/papermerge/tasks/install.yml | 1 + roles/papermerge/templates/papermerge.conf.py.j2 | 16 ++++++++++++++-- roles/redis_server/files/redis_copy_dumps.sh | 3 +++ roles/redis_server/tasks/main.yml | 2 +- 8 files changed, 37 insertions(+), 6 deletions(-) diff --git a/roles/mayan_edms/defaults/main.yml b/roles/mayan_edms/defaults/main.yml index 5a6c70f..11e4ad4 100644 --- a/roles/mayan_edms/defaults/main.yml +++ b/roles/mayan_edms/defaults/main.yml @@ -1,6 +1,6 @@ --- -mayan_version: 3.5.1 +mayan_version: 4.0.11 mayan_root_dir: /opt/mayan-edms mayan_user: mayan-edms # Should ansible handle upgrades ? If false, only initial install will be done diff --git a/roles/papermerge/defaults/main.yml b/roles/papermerge/defaults/main.yml index e96f458..f2cf773 100644 --- a/roles/papermerge/defaults/main.yml +++ b/roles/papermerge/defaults/main.yml @@ -1,11 +1,11 @@ --- # Version of papermerge to deploy -papermerge_version: 1.5.0 +papermerge_version: 2.0.1 # URL of the tarball papermerge_archive_url: https://github.com/ciur/papermerge/archive/v{{ papermerge_version }}.tar.gz # Expected sha1 of the archive, to check the download was OK -papermerge_archive_sha1: d97d63f3102a48af9aaeb261e498533c54d22bc3 +papermerge_archive_sha1: 1dc4e144c299fa133ca135420b851a4730fc82d6 # Papermerge uses 2 ports. for gunicorn and will only listen on the loopback # The other for nginx and is the one which will be accessible over the network @@ -35,3 +35,11 @@ papermerge_ocr_default_lang: fra # Django secret key. A random one will be created if not set # papermerge_secret_key: abc123 + +# Import dir is where papermerge will look for files and consume them +papermerge_import_dir: "{{ papermerge_root_dir }}/input" + +# IMAP settings for fetching document by email +# papermerge_imap_host: mail.example.org +# papermerge_imap_user: +# papermerge_imap_pass: diff --git a/roles/papermerge/meta/main.yml b/roles/papermerge/meta/main.yml index c9b8ad1..cbeff6d 100644 --- a/roles/papermerge/meta/main.yml +++ b/roles/papermerge/meta/main.yml @@ -6,4 +6,5 @@ dependencies: - role: nginx - role: postgresql_server when: papermerge_db_server == '127.0.0.1' or papermerge_db_server == 'localhost' + - role: redis_server diff --git a/roles/papermerge/tasks/archive_pre.yml b/roles/papermerge/tasks/archive_pre.yml index 8848d95..eec8fb2 100644 --- a/roles/papermerge/tasks/archive_pre.yml +++ b/roles/papermerge/tasks/archive_pre.yml @@ -4,6 +4,12 @@ file: path={{ papermerge_root_dir }}/archives/{{ papermerge_current_version }} state=directory tags: ged +- name: Install postgresql client + package: + name: + - postgresql13 + tags: ged + - name: Stop sevices during upgrade service: name={{ item }} state=stopped loop: diff --git a/roles/papermerge/tasks/install.yml b/roles/papermerge/tasks/install.yml index 90dbec0..7d37fde 100644 --- a/roles/papermerge/tasks/install.yml +++ b/roles/papermerge/tasks/install.yml @@ -9,6 +9,7 @@ - python-setuptools - python-psycopg2 - postgresql-devel + - postgresql13 - tesseract - tesseract-langpack-fra - tesseract-langpack-deu diff --git a/roles/papermerge/templates/papermerge.conf.py.j2 b/roles/papermerge/templates/papermerge.conf.py.j2 index b791ccb..3fd5bf8 100644 --- a/roles/papermerge/templates/papermerge.conf.py.j2 +++ b/roles/papermerge/templates/papermerge.conf.py.j2 @@ -5,8 +5,7 @@ DBPASS = "{{ papermerge_db_pass }}" DBHOST = "{{ papermerge_db_server }}" DBPORT = "{{ papermerge_db_port }}" MEDIA_DIR = "{{ papermerge_root_dir }}/data" -IMPORTER_DIR = "{{ papermerge_root_dir }}/input" -FILES_MIN_UNMODIFIED_DURATION = 10 +IMPORTER_DIR = "{{ papermerge_import_dir }}" OCR_DEFAULT_LANGUAGE = "{{ papermerge_ocr_default_lang }}" LANGUAGE_FROM_AGENT = True LANGUAGES = [ @@ -27,3 +26,16 @@ METADATA_DATE_FORMATS = [ 'yyyy-mm-dd', 'month' ] +CELERY_BROKER_URL = "redis://" +CELERY_BROKER_TRANSPORT_OPTIONS = {} +CELERY_RESULT_BACKEND = "redis://localhost/0" + +{% if papermerge_imap_host is defined and papermerge_imap_user is defined and papermerge_imap_pass is defined %} +IMPORT_MAIL_HOST = "{{ papermerge_imap_host }}" +IMPORT_MAIL_USER = "{{ papermerge_imap_user }}" +IMPORT_MAIL_PASS = "{{ papermerge_imap_pass }}" +IMPORT_MAIL_BY_USER = True +IMPORT_MAIL_BY_SECRET = True +{% endif %} + +BINARY_STAPLER= "/opt/papermerge/venv/bin/stapler" diff --git a/roles/redis_server/files/redis_copy_dumps.sh b/roles/redis_server/files/redis_copy_dumps.sh index 5a4fc30..8555212 100644 --- a/roles/redis_server/files/redis_copy_dumps.sh +++ b/roles/redis_server/files/redis_copy_dumps.sh @@ -6,8 +6,11 @@ DEST=/home/lbkp/redis [ -d $DEST ] || mkdir -p $DEST +echo "Saving dump.rdb" +/usr/bin/redis-cli save for FILE in dump.rdb appendonly.aof; do if [ -e /var/lib/redis/$FILE ]; then + echo "Copying /var/lib/redis/$FILE to $DEST" cp /var/lib/redis/$FILE $DEST/ fi done diff --git a/roles/redis_server/tasks/main.yml b/roles/redis_server/tasks/main.yml index f870a5e..9ac106f 100644 --- a/roles/redis_server/tasks/main.yml +++ b/roles/redis_server/tasks/main.yml @@ -10,7 +10,7 @@ tags: redis - name: Deploy redis configuration - template: src=redis.conf.j2 dest={{ (redis_etc_dir.stat.isdir) | ternary('/etc/redis/redis.conf','/etc/redis.conf') }} + template: src=redis.conf.j2 dest={{ (redis_etc_dir.stat.exists and redis_etc_dir.stat.isdir) | ternary('/etc/redis/redis.conf','/etc/redis.conf') }} notify: restart redis tags: redis