diff --git a/roles/mayan_edms/defaults/main.yml b/roles/mayan_edms/defaults/main.yml index ba62453..7180ee5 100644 --- a/roles/mayan_edms/defaults/main.yml +++ b/roles/mayan_edms/defaults/main.yml @@ -95,3 +95,7 @@ mayan_ldap_debug: False # 'is_superuser': 'CN=Role_Infra_Admin,OU=Roles,DC=example,DC=org', # } +# This is a list of indexes to expose as FUSE filesystem in {{ mayan_root_dir }}/fuse +# when running the pre-backup hook +mayan_index_as_fuse: + - creation_date diff --git a/roles/mayan_edms/tasks/directories.yml b/roles/mayan_edms/tasks/directories.yml index df269df..b448a2b 100644 --- a/roles/mayan_edms/tasks/directories.yml +++ b/roles/mayan_edms/tasks/directories.yml @@ -22,4 +22,6 @@ - path: "{{ mayan_root_dir }}/config" group: "{{ mayan_user }}" mode: 750 + - path: "{{ mayan_root_dir }}/fuse" + mode: 700 tags: mayan diff --git a/roles/mayan_edms/tasks/install.yml b/roles/mayan_edms/tasks/install.yml index 1c12cad..1aef398 100644 --- a/roles/mayan_edms/tasks/install.yml +++ b/roles/mayan_edms/tasks/install.yml @@ -50,7 +50,7 @@ name: - postgresql-devel - postgresql13 - - python-psocopg2 + - python-psycopg2 when: mayan_db_engine == 'postgresql' tags: mayan diff --git a/roles/mayan_edms/templates/post_backup.sh.j2 b/roles/mayan_edms/templates/post_backup.sh.j2 index 93b2285..1b2b574 100644 --- a/roles/mayan_edms/templates/post_backup.sh.j2 +++ b/roles/mayan_edms/templates/post_backup.sh.j2 @@ -1,3 +1,7 @@ #!/bin/bash -e rm -f {{ mayan_root_dir }}/backup/* +{% for index in mayan_index_as_fuse %} +umount {{ mayan_root_dir }}/fuse/{{ index }} +rmdir {{ mayan_root_dir }}/fuse/{{ index }} +{% endfor %} diff --git a/roles/mayan_edms/templates/pre_backup.sh.j2 b/roles/mayan_edms/templates/pre_backup.sh.j2 index e0a05d9..c9a332e 100644 --- a/roles/mayan_edms/templates/pre_backup.sh.j2 +++ b/roles/mayan_edms/templates/pre_backup.sh.j2 @@ -14,3 +14,13 @@ PGPASSWORD='{{ mayan_db_pass }}' /usr/pgsql-13/bin/pg_dump \ {{ mayan_db_name | quote }} | \ zstd -c > "{{ mayan_root_dir }}/backup/{{ mayan_db_name }}.sql.zst" {% endif %} + +# Use FUSE to export indexes as a file tree +set -o allexport +. /opt/mayan-edms/config/.env +set +o allexport +{% for index in mayan_index_as_fuse %} +mkdir -p {{ mayan_root_dir }}/fuse/{{ index }} +{{ mayan_root_dir }}/venv/bin/python {{ mayan_root_dir }}/venv/bin/mayan-edms.py mountindex {{ index }} {{ mayan_root_dir }}/fuse/{{ index }} & +{% endfor %} +