I encountered different problems during the upgrade process:
The upgrade from rabbitmq from 3.13 to 4.0 requires an additional step: Execute rabbitmqctl enable_feature_flag all inside the rabbitmq container before you shut down the container stack before the upgrade. See Upgrading RabbitMQ | RabbitMQ for more information.
I get some errors upon upgrading my workflows: AttributeError: ‘Workflow’ object has no attribute ‘get_state_initial’. I read in the release notes that workflows need to have an initial state before they can be initialized but I did not expect that it also causes an upgrade to fail. I will check my workflows and try the upgrade again. EDIT: My workflows all have an initial status set. So this might be a bug?
Ok, I finally upgraded successfully. Most likely the problem was, that I had documents for which workflows were not yet started. I tried to start the workflows with the corresponding tool but the workflows were still not started so I had to start them manually which worked. Luckily there were only about 20 documents so it was ok to do that manually.
Improved the workflow migration 0037 to handle this edge case. New release build pipeline is already running and he new version will be available in a few hours.
Thank you for the quick fix. I now observe a different problem: Some document previews for pdf files no longer load. I see errors in the logs when I try to open them:
worker_a-1 | File "/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/documents/models/document_file_page_model_mixins.py", line 73, in generate_image worker_a-1 | image = self.get_image( worker_a-1 | ^^^^^^^^^^^^^^^ worker_a-1 | File "/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/documents/models/document_file_page_model_mixins.py", line 185, in get_image worker_a-1 | with self.document_file.get_intermediate_file() as file_object: worker_a-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ worker_a-1 | File "/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/documents/models/document_file_model_mixins.py", line 361, in get_intermediate_file worker_a-1 | raise exception worker_a-1 | File "/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/documents/models/document_file_model_mixins.py", line 336, in get_intermediate_file worker_a-1 | converter = ConverterBase.get_converter_class()( worker_a-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ worker_a-1 | File "/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/converter/classes.py", line 102, in __init__ worker_a-1 | self.mime_type = mime_type or MIMETypeBackend.get_backend_instance().get_mime_type( worker_a-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ worker_a-1 | File "/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/mime_types/classes.py", line 13, in get_backend_instance worker_a-1 | return import_string(dotted_path=setting_backend.value)( worker_a-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ worker_a-1 | File "/opt/mayan-edms/lib/python3.11/site-packages/django/utils/module_loading.py", line 30, in import_string worker_a-1 | return cached_import(module_path, class_name) worker_a-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ worker_a-1 | File "/opt/mayan-edms/lib/python3.11/site-packages/django/utils/module_loading.py", line 15, in cached_import worker_a-1 | module = import_module(module_path) worker_a-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ worker_a-1 | File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module worker_a-1 | return _bootstrap._gcd_import(name[level:], package, level) worker_a-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ worker_a-1 | File "<frozen importlib._bootstrap>", line 1206, in _gcd_import worker_a-1 | File "<frozen importlib._bootstrap>", line 1178, in _find_and_load worker_a-1 | File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked worker_a-1 | ModuleNotFoundError: No module named 'mayan.apps.mime_types.backends.python_magic'
Running migrations:
Traceback (most recent call last):
File “/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/common/management/base.py”, line 106, in do_perform_upgrade
signal_pre_upgrade.send(sender=self)
File “/opt/mayan-edms/lib/python3.11/site-packages/django/dispatch/dispatcher.py”, line 176, in send
return [
^
File “/opt/mayan-edms/lib/python3.11/site-packages/django/dispatch/dispatcher.py”, line 177, in
(receiver, receiver(signal=self, sender=sender, **named))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/common/handlers.py”, line 13, in handler_pre_upgrade
management.call_command(
File “/opt/mayan-edms/lib/python3.11/site-packages/django/core/management/init.py”, line 194, in call_command
return command.execute(*args, **defaults)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/mayan-edms/lib/python3.11/site-packages/django/core/management/base.py”, line 458, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/mayan-edms/lib/python3.11/site-packages/django/core/management/base.py”, line 106, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/mayan-edms/lib/python3.11/site-packages/django/core/management/commands/migrate.py”, line 356, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File “/opt/mayan-edms/lib/python3.11/site-packages/django/db/migrations/executor.py”, line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/mayan-edms/lib/python3.11/site-packages/django/db/migrations/executor.py”, line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File “/opt/mayan-edms/lib/python3.11/site-packages/django/db/migrations/executor.py”, line 252, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/mayan-edms/lib/python3.11/site-packages/django/db/migrations/migration.py”, line 132, in apply
operation.database_forwards(
File “/opt/mayan-edms/lib/python3.11/site-packages/django/db/migrations/operations/special.py”, line 193, in database_forwards
self.code(from_state.apps, schema_editor)
File “/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/document_states/migrations/0037_populate_state_active.py”, line 31, in code_populate_state_active
workflow_instance.state_active = workflow_instance.get_current_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/document_states/migrations/0037_populate_state_active.py”, line 16, in get_current_state
return self.workflow.get_state_initial()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: ‘Workflow’ object has no attribute ‘get_state_initial’
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/opt/mayan-edms/bin/mayan-edms.py”, line 22, in
main()
File “/opt/mayan-edms/bin/mayan-edms.py”, line 18, in main
execute_from_command_line(sys.argv)
File “/opt/mayan-edms/lib/python3.11/site-packages/django/core/management/init.py”, line 442, in execute_from_command_line
utility.execute()
File “/opt/mayan-edms/lib/python3.11/site-packages/django/core/management/init.py”, line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/opt/mayan-edms/lib/python3.11/site-packages/django/core/management/base.py”, line 412, in run_from_argv
self.execute(*args, **cmd_options)
File “/opt/mayan-edms/lib/python3.11/site-packages/django/core/management/base.py”, line 458, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/common/management/commands/common_perform_upgrade.py”, line 18, in handle
instance.do_perform_upgrade(
File “/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/common/management/base.py”, line 108, in do_perform_upgrade
raise BaseCommonException(
mayan.apps.common.exceptions.BaseCommonException: Error during signal_pre_upgrade signal.
Applying document_states.0037_populate_state_active… mayan: starting entrypoint.sh
I discovered that I had the removed mime_type_backend in my settings. I’ve never changed that manually so I was a bit surprised not to see the default setting here. Maybe this setting could also be set to the default value in the upgrade process?