Guide to upgrading from v4 to v5 on Docker?

My Mautic version is: 4.1.11
My PHP version is: 7.4.33
My Database type and version is: 5.7.44

Your problem
I have a docker installation based on mautic:v4. I want to upgrade it to v5 and I was wondering if there’s a guide on how to make this upgrade.

Thanks,

So I couldn’t find any step-by-step guide to performing this upgrade so I’m trying to figure it out on my own.

So far what I got is this:

The files that should survive the container life-cycle are those inside the directories:

  • media/files
  • media/images
  • media/dashboards

Plus the file app/config/local.php.

If you know of any other important user file please let me know (I’m kind of new to Mautic).

So, my idea was to change my docker-compose.yml to reflect this situation instead of mounting the whole /var/www/html directory which will get overwritten by the new version anyway…

Next step: change the image from mautic/mautic:v4 to mautic/mautic:5.0.3-apache and to mysql:8.0 for the database.

Then bring the services up and load a pre-existing database dump in the new container.

Right after that, bring the db up to date with the command php bin/console mautic:update:apply --finish.

I got this far but I got stuck on this error I can’t make sense of:

[error] Migration Mautic\Migrations\Version20230522141144 failed during Pre-Checks. Error: "Unknown column type "json_array" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information."

In Exception.php line 115:
                                                                                                                                                                                                                                             
  Unknown column type "json_array" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If th  
  is error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedData  
  baseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information.

Any pointer here will be highly appreciated.

Thanks!

Hey everyone. After a long list of unsuccesful experiments I think I have somewhat of a recipe for this upgrade.

What I did:

  1. Clone the repository locally
  2. Took a dump of my prod database (v4)
  3. Made a copy of my server configuration (docker cp mautic.ssl:/var/www/html/app/config/local.php)
  4. Copy the file from the server to my local
  5. Brought the services up using the basic example (docker-compose -f examples/basic/docker-compose.yml up)
  6. Imported the production database into the local container (docker-compose -f examples/basic/docker-compose.yml exec -T db mysql -u mautic_db_user -pmautic_db_pwd mautic_db < mautic.dump.sql)
  7. Run the migrations from within the local container (docker-compose -f examples/basic/docker-compose.yml exec php bin/console mautic:update:apply --finish)
  8. Adjusted the local config
    8.1 Replaced the prod URL with localhost
    8.2 Replaced the v4 directories (app/* for the structure used in v5)
    8.3 Added localhost as trusted_host

After this I was able to visit my local site and have version 5.0.3 working.

I didn’t copy my files nor dashboards but I believe that had I done that it would have worked.

I hope this helps. Haven’t done the full migration in prod, I hope I get to do it soon.

Regards,

1 Like