Ken Robinson's picture

Edit: Updated to 4.4.4 - Also note support from the developer.
Edit: This only works with v17.1. If you have an older version (v16) check out these posts: TKL Mayan EDMS v16.1 - Upgrade v3.5.5 to 4.0.23 and Migration of TKL Mayan EDMS v16.1 to 17.1

 

Please note that the developer of Mayan NO LONGER SUPPORTS A MANUAL INSTALL. Hint we use a manual install for Turnkey. It seems he started removing upgrade instructions after 4.4. However with that being said, these instructions do work! If you run into issues post here first!

Note: The warnings about urllib3, chardet and charset_normalizer are normal and are cause by the transition between Python 3.9 and 3.10 taking place for some dependencies. 

 

Have a Fresh TKL Mayan EDMS v17.1 install and want to upgrade? In this post I will document how you can upgrade Mayan EDMS v17.1 v4.2.7 to the latest (as of this post) to v4.4.4 in about 30 minutes or less! If you find this helpful or have questions or issues post a reply. 

Note: There are changes in v4.4.2 that are not backwards compatible. Please read the release notes to see what those changes are! 

 

This guide assumes:

  • You are using TKL Mayan EDMS v17.1
  • You are logged in as root
  • You have a working system
  • You have not made any modifications to the base system
  • Made a complete backup of your system

Now lets crack on once again shall we? This is very much like my other post "TKL Mayan EDMS v16.1 - Upgrade v3.5.5 to 4.0.23" where I basically take instructions from the docs but tweak them for TKL install.

Mayan EDMS 4.4.4 Release Notes

 

# Turnkey Mayan V17.1
# EDMS Upgrade from 4.2.7 to 4.4.4

# Create home dir
# Pip will be angry if there is no home dir, cache will be disabled
# Also su gets angry when the home dir is missing in later steps and
# will fail.
#
# Skip this if the home dir is there
mkdir /home/mayan
chown mayan:mayan /home/mayan


# (1.) Stop Services 
#
systemctl stop supervisor


# (2.) Backup supervisor config
#
mv /etc/supervisor/conf.d/mayan.conf /etc/supervisor/conf.d/mayan.conf.backup


# (3.) Backup db
#
pg_dump mayan > ~/mayan_db_backup.sql


# (4.) Upgrade PIP
#
su - mayan -c "/opt/mayan-edms/bin/pip install --upgrade pip"


# (5.) Remove un-needed packages 
#
su - mayan -c "curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/v4.4.4/removals.txt -o /tmp/removals.txt"
su - mayan -c "/opt/mayan-edms/bin/pip uninstall --yes --requirement /tmp/removals.txt"


# (6.) Update Mayan
#
su - mayan -c "/opt/mayan-edms/bin/pip install mayan-edms==4.4.4"


# (7.) Update the environment file
# as we only need one line now all settings are in the config file in the media folder
# Skip this step if you already did this
#
mv /etc/mayan/env /etc/mayan/env.backup
echo "export MAYAN_MEDIA_ROOT=/opt/mayan-edms/media" > /etc/mayan/env


# (8.) Setup the environment for the next few steps 
# 
ENV=/etc/mayan/env
BIN=/opt/mayan-edms/bin


# (9.) Update Supervisor config
# You may get some errors at top, but as long as the file gets updated
su - mayan -c ". $ENV && $BIN/mayan-edms.py platform_template supervisord" > /etc/supervisor/conf.d/mayan.conf


# (11.) Edit the supervisord configuration file and update any setting 
# specific to your installation and verify its been created
nano /etc/supervisor/conf.d/mayan.conf


# (12.) Upgrade db
#
su - mayan -c ". $ENV && $BIN/mayan-edms.py common_perform_upgrade"


# (13.) Start supervisor, check status
systemctl start supervisor
supervisorctl status


# (14.) Clear the browser cache, and check app functions
#


# (15.) Cleanup backup files
# Only clear the files if everything is working!
#
rm /etc/mayan/env.backup
rm ~/mayan_db_backup.sql
rm /etc/supervisor/conf.d/mayan.conf.backup
Forum: 
Ken Robinson's picture

Updated to upgrade to v4.4.4

Regards,

Ken  
":0)

http://www.github.com/DocCyblade

Jeremy Davis's picture

Thanks Ken! :)

Marcel Kaiser's picture

That guide helped a lot! Thanks a lot!
MikeGinger123456789's picture

Hello, Thank you for the upgrade, is there any documentation on upgrading mayan python from 3.7 - 3.9 currently i keep gettting errors when im upgrading mayan to 4.4.4 saying that i need version 3.9 or more ERROR: Ignored the following versions that require a different python version: 4.4.3 Requires-Python >=3.9; 4.4.4 Requires-Python >=3.9; 4.4.5 Requires-Python >=3.9 ERROR: Could not find a version that satisfies the requirement mayan-edms==4.4.4 (from versions: 1.0rc1, 1.0rc2, 1.0rc3, 1.0.0, 1.1.0.post1502100955, 1.1.1, 2.0.0b1, 2.0.0b2, 2.0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4.1b2, 4.1rc1, 4.1rc2, 4.1, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.1.6, 4.1.7, 4.1.8, 4.1.9, 4.1.10, 4.1.11, 4.2a1, 4.2b1, 4.2rc1, 4.2, 4.2.1, 4.2.2, 4.2.3, 4.2.4, 4.2.5, 4.2.6, 4.2.7, 4.2.8, 4.2.9, 4.2.10, 4.2.11, 4.2.12, 4.2.13, 4.2.14, 4.3a1, 4.3rc1, 4.3, 4.3.1, 4.3.2, 4.3.3, 4.3.4, 4.3.5, 4.3.6, 4.3.7, 4.4, 4.4.1, 4.4.2) ERROR: No matching distribution found for mayan-edms==4.4.4 if you have any documentation on getting that upgraded that would be great, i went ahead and upgraded python to 3.9.10 but for somereason mayan still using Python 3.7   Thank you
Jeremy Davis's picture

The best way to upgrade to Python3.9 is to move to a newer Debian version. I assume you have a v16.x appliance (based on Debian 10/Buster) - so you'll want to move to v17.x (based on Debian 11/Bullseye - which includes Python 3.9 by default).

one way is to launch a new v17.x appliance and then migrate your data across to it. Alternatively, you can do an "in place" Debian upgrade - to upgrade the base OS from Debian 10/Buster to Debian 11/Bullseye. Technically we don't support the latter option, but it should work fine and I'm happy to give you free "best effort" support if you wish to go that way. It's also worth noting that a Debian in-place upgrade won't get you TurnKey v17.x, it will be a hybrid of v16.x, but with a newer Debian Bullseye base.

Either way, if you want some support, please sign up to a free website user account and to ensure that I enable it in a timely manner, please shoot me an email to support AT turnkeylinux.org.

Some resources that are worth a read:

Ken Robinson's picture

What version of TKL Mayan EDMS are you running, and what version of Mayan is running it seems it may be v16 like J is assuming.

 

I updated the post with assumptions that include running v17.1 Mayan to make it more clear. 

 If you have an older version (v16) check out these posts: TKL Mayan EDMS v16.1 - Upgrade v3.5.5 to 4.0.23 and Migration of TKL Mayan EDMS v16.1 to 17.1

Regards,

Ken  
":0)

http://www.github.com/DocCyblade

Morkg's picture

Do you think you can help me figure out after updating to 3.9 I can't get LDAP to work, can you look at this code and let me know if I need to change anything, I'm using ldap3, python-ldap 


 

from __future__ import absolute_import

from mayan.settings.production import *

import ldap
from django_auth_ldap.config import (
    LDAPSearch, LDAPSearchUnion, NestedActiveDirectoryGroupType
)

from django.contrib.auth import get_user_model

SECRET_KEY = 'SecretKey'

# makes sure this works in Active Directory
ldap.set_option(ldap.OPT_REFERRALS, 0)

# Turn of debug output, turn this off when everything is working as expected
ldap.set_option(ldap.OPT_DEBUG_LEVEL, 4095)

# This is the default, but I like to be explicit.
AUTH_LDAP_ALWAYS_UPDATE_USER = True

LDAP_USER_AUTO_CREATION = "False"

LDAP_URL = "ldap://:389/"
LDAP_BASE_DN = "DC=usit,DC=com"
LDAP_ADMIN_DN = "CN=,OU=,DC=usit,DC=com"
LDAP_PASSWORD = ""

AUTH_LDAP_SERVER_URI = LDAP_URL
AUTH_LDAP_BIND_DN = LDAP_ADMIN_DN
AUTH_LDAP_BIND_PASSWORD = LDAP_PASSWORD

AUTH_LDAP_USER_SEARCH = LDAPSearchUnion(
     LDAPSearch(
         'OU=WebDevelopment,DC=USIT,DC=com', 
         ldap.SCOPE_SUBTREE,'(samaccountname=%(user)s)'
     ),
     LDAPSearch(
        'OU=Information Technology,DC=USIT,DC=com',
         ldap.SCOPE_SUBTREE,'(samaccountname=%(user)s)'
     ),
     LDAPSearch(
        'OU=Service Accounts,DC=USIT,DC=com',
         ldap.SCOPE_SUBTREE,'(samaccountname=%(user)s)'
     ),
     LDAPSearch(
        'OU=Environmental,DC=USIT,DC=com',
         ldap.SCOPE_SUBTREE,'(samaccountname=%(user)s)'
     ),
     LDAPSearch(
        'OU=Fish & Wildlife,DC=USIT,DC=com',
         ldap.SCOPE_SUBTREE,'(samaccountname=%(user)s)'
     ),
    LDAPSearch(
         'OU=Law,DC=USIT,DC=com',
         ldap.SCOPE_SUBTREE,'(samaccountname=%(user)s)'
     ),

 )

AUTH_LDAP_USER_ATTR_MAP = {
    'first_name': 'givenName',
    'last_name': 'sn',
    'email': 'mail'
}
AUTHENTICATION_BACKENDS = (
    'django_auth_ldap.backend.LDAPBackend',
    'mayan.media.mayan_settings.ldaplogin.EmailOrUsernameModelBackend',
)


class EmailOrUsernameModelBackend(object):
    """
    This is a ModelBackend that allows authentication with either a username or an email.
    """

    def authenticate(self, request, username=None, password=None, **kwargs):
        if '@' in username:
            kwargs = {'email': username}
        else:
            kwargs = {'username': username}
        try:
            user = get_user_model().objects.get(**kwargs)
            if user.check_password(password):
                return user
        except get_user_model().DoesNotExist:
            return None

    def get_user(self, user_id):
        try:
            return get_user_model().objects.get(pk=user_id)
        except get_user_model().DoesNotExist:
            return None

 

Morkg's picture

Hello, Thank you for the help, I ended up deploying a new Debian and moving all the files over thanks to Kens instructions, however, after moving - i cant get LDAP to work again any insight on that ?

Morkg's picture

So i forgot to mention that the LDAP link im using is

MAYAN_SETTINGS_MODULE=mayan.media.mayan_settings.ldaplogin,

Im thinking that there is something wrong with it, when I change that from production to the location of my LDAP file I get an error other than that Production works fine.

 

thank you

Jeremy Davis's picture

Apologies on the really slow response (I've got my head down working on the next major release).

TBH, LDAP is not my strong suit, so I'm possibly not much help to you. I suggest that you reach out to the Mayan community and ask them for assistance. If you do post over there, it might be good to cross post a link here, to the thread you start over there.

Add new comment