Version 4.0.8

Released: June 23, 2021

Status: Stable


Background tasks

The queue distribution was tuned again to continue improving throughput and efficiency of the workers. Message consumption rate was increased for the indexing, search, uploads, duplicates, file metadata and metadata queues.

The readability Celery worker options was improved by using the long version of the options.


The Docker base image was updated from Debian:10.8-slim to Debian:10.10-slim.

The example RabbitMQ container entry in the Docker Compose file was updated to include the entries necessary to enable the image with the management plugin.

A new chapter was added explaining document files. The document version chapter was updated to include the changes since version 4.0.

Document parsing

The document parsing submit actions were updated to keep track of the user and apply it to the events when committed.


The document file and version page image API were optimized by reusing the page object per request.

The date and time of document version timestamps are now carried over during the upgrade from version 3.5.x to 4.0.x.

Fixed the situation where the document type button was not appearing. The cascade condition of the document type setup link was updated to correctly display when there are not document types created.

Digital signatures

The preparation of the GPG temporary home folder was improved. A temporary directory context manager is now used which also guarantees that the temporary folder will be removed even on failures.

The document signature logic was updated to not assume that all signatures provide a date_time field.


PIP was updated to version 21.1.2 and Django was updated from version 2.2.23 to 2.2.24.


The Docker Compose installation and upgrade instructions we improved. PostgreSQL migration instructions were also added.


The document email attachment was updated to send the active version instead of the last file uploaded. The email action will now export the active version and email that as an attachments. This mimics more closely the existing behavior of this feature before the document version were separated into versions and files.

File metadata

The file metadata submit actions were updated to keep track of the user and apply it to the events committed.


Fixed an issue with the document metadata add and edit actions which caused the user value to be ignored at the event commit.


The direct deployment and Docker supervisord templates were unified. The direct deployment and the Docker image now use the same supervisord template.

The GitLab CI configuration files and the Dockerfile were converted into templates. This allows these to use the same settings and Docker image tags as the rest of the project without requiring manual updates.


Event testing was improved for several apps. Events testing is now performed in an unified manner using the provided ._clear_events() and .get_test_events(). This supercedes the imporing the Action model directly.


  • Make optional the user_id argument of task_document_file_page_image_generate.

  • Don’t cache the missing items template to allow it to be removed when the missing items are fixed.

  • Apply small optimization to MultipleObjectViewMixin .get_object_list() method. The method now reuses the existing pk_list variable.

  • Add serializer explicit read only fields.

  • Optimize documents app saves with update_fields.


  • None

Upgrade process

Upgrading from Mayan EDMS 3.5.x

Direct deployment

  1. Stop supervisord:

    sudo systemctl stop supervisor
  2. Make a backup of your supervisord file:

    sudo cp /etc/supervisor/conf.d/mayan-edms.conf /etc/supervisor/conf.d/mayan-edms.conf.bck
  3. Make a backup of your database:

    Use the respective backup command for the database:

  4. Upgrade to the latest pip version:

    sudo -u mayan /opt/mayan-edms/bin/pip install -U pip
  5. Remove deprecated requirements:

    sudo -u mayan curl -o /tmp/removals.txt \
    && sudo -u mayan /opt/mayan-edms/bin/pip uninstall -y -r /tmp/removals.txt
  6. Update the Mayan EDMS Python package:

    sudo -u mayan /opt/mayan-edms/bin/pip install mayan-edms==4.1

    the requirements will also be updated automatically.

  7. Create the user_settings/ folder inside the media folder and convert it into a Python module. This folder is used for custom setting modules. Adjust the path of the media folder for your installation:

    sudo -u mayan mkdir --parents /opt/mayan-edms/media/user_settings/
    sudo -u mayan touch /opt/mayan-edms/media/user_settings/
  8. Update the Redis configuration to serve at least 3 databases:


    databases ...


    databases 3
  9. Edit the config file at /opt/mayan-edms/media/config.yml:




    LOCK_MANAGER_BACKEND: mayan.apps.lock_manager.backends.redis_lock.RedisLock
    LOCK_MANAGER_BACKEND_ARGUMENTS: {'redis_url':'redis://:mayanredispassword@<IP address of Redis server>:6379/2'}
  10. Update the supervisord configuration file. Replace the environment variables values shown here with your respective settings. This step will refresh the supervisord configuration file with the new queues and the latest recommended layout:

    sudo -u mayan MAYAN_MEDIA_ROOT=/opt/mayan-edms/media/ \
    /opt/mayan-edms/bin/ platformtemplate supervisord | sudo sh -c "cat > /etc/supervisor/conf.d/mayan-edms.conf"
  11. Edit the supervisord configuration file and update any setting specific to your installation:

    sudo vi /etc/supervisor/conf.d/mayan-edms.conf
  12. Migrate existing database schema and static media files with:

    sudo -u mayan MAYAN_MEDIA_ROOT=/opt/mayan-edms/media/ \
    /opt/mayan-edms/bin/ performupgrade
  13. Start supervisord:

    sudo systemctl start supervisor
  14. Clear the browser cache to avoid loading old web assets.

The upgrade procedure is now complete.

Docker Compose

Check the Docker upgrading chapter for the complete upgrade process.


If you observe the errors:

  • mayan.apps.file_caching.models.CachePartitionFile.DoesNotExist: CachePartitionFile matching query does not exist.


  • FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/mayan/document_file_storage/...

follow the solution outlined in the troubleshooting section: After upgrade to version 4.0

Backward incompatible changes

  • None

Issues closed