Thanks to help from @DocCyblade the following procedure was created.
Please try this procedure on a backup copy of your installations (or even better a VM snapshot) and report your results (good or bad) so we can finalize this and add it to the documentation.
Update the direct deployment to the 4.4 series.
Follow the instructions located in: Upgrades — Mayan EDMS 4.4.6 documentation
Purge all file caches.
- Option 1: Via the user interface.
System
→Tools
→File caches
Refresh the page until all current size
columns display 0
.
- Option 2: Via the command line.
echo "from mayan.apps.file_caching.models import CachePartitionFile;[i.delete() for i in CachePartitionFile.objects.all()]" | sudo --user=mayan MAYAN_MEDIA_ROOT=/opt/mayan-edms/media/ /opt/mayan-edms/bin/mayan-edms.py shell
Create the backup folder
mkdir ~/mayan-direct-backup
Stop the installation
sudo systemctl stop supervisor
Dump the database
IMPORTANT! Make a note of the database credentials.
Use the database credentials from the previous step.
pg_dump -U mayan -h 127.0.0.1 -d mayan -W > ~/mayan-direct-backup/database.sql
Copy the config.yml
cp /opt/mayan-edms/media/config.yml ~/mayan-direct-backup
Copy the SECRET_KEY
cp /opt/mayan-edms/media/SECRET_KEY ~/mayan-direct-backup
Copy the document files
Use rsync
to preserve the file attributes and ownership.
rsync -a /opt/mayan-edms/media/document_file_storage /home/ubuntu/mayan-direct-backup/
Stop and disable services
sudo systemctl stop supervisor # Should be already stopped
sudo systemctl disable supervisor
sudo systemctl stop postgresql
sudo systemctl disable postgresql
sudo systemctl stop redis
sudo systemctl disable redis
# RabbitMQ if installed
sudo systemctl stop rabbitmq
sudo systemctl disable rabbitmq
Install Mayan EDMS via Docker Compose
- Install Docker.
- Just download the Mayan Docker Compose files.
- Do not run docker compose up -d yet!
curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/master/docker/docker-compose.yml -O
curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/master/docker/.env -O
Restore the database
- Update the new database credentials in the
.env
file if desired.
- Start only PostgreSQL in Docker.
docker compose up postgresql -d
- Restore the database dump. Replace the database name, user as needed.
docker compose exec -T postgresql psql -U mayan -d mayan < ~/mayan-direct-backup/database.sql
- Inspect the Mayan app volume. Take note of the
Mountpoint
value.
docker volume inspect mayan_app
Restore the document files
Restore the document_file_storage
folder.
sudo rsync -a /home/ubuntu/mayan-direct-backup/document_file_storage /var/lib/docker/volumes/mayan_app/_data/
- Verify correct ownership of restored files. All files should be owner by
mayan:mayan
.
docker compose exec -ti app ls /var/lib/mayan -al
Shutdown the entire stack
docker compose down
Clean up volumes
Delete the Redis and RabbiMQ volumes to force a clean setup again.
docker volume rm mayan_rabbitmq mayan_redis
Start the entire stack
docker compose up -d
Initialize the search system
docker compose run frontend run_command search_initialize
Check logs for fatal errors
docker compose logs -f
Migrate custom settings
- Manually add custom settings from backed up
config.yml
file to the.env
file. - Restart the stack after each round of updates.