Complete Mautic Setup guide – safe updating and GeoIP

Once we have a working Mautic installation, we need to make sure, we use the most up-to-date, stable system.

Use the following procedure to update in a safe way, that results in a stable environment.

Check database for errors, and prepare for migration:

php /var/www/html/mautic/app/console doctrine:migration:migrate
php /var/www/html/mautic/app/console doctrine:schema:update –force

Clear cache:

php /var/www/html/mautic/app/console cache:clear

Let’s see if there is a stable version we can update to:

php /var/www/html/mautic/app/console mautic:update:find

If yes, let’s apply the update:

Update Mautic in a safe way

php /var/www/html/mautic/app/console mautic:update:apply

Now we need to clear cache to rebuild the system for the new version:

php /var/www/html/mautic/app/console cache:clear

Check for errors again and clear cache one more time:

php /var/www/html/mautic/app/console doctrine:migration:migrate
php /var/www/html/mautic/app/console doctrine:schema:update --force
php /var/www/html/mautic/app/console cache:clear

Now let’s make sure, that our webserver has proper rights:

sudo chown -R www-data:www-data /var/www/html/mautic/

Add Maxmind database for geo-tracking

In order to have the proper country based tracking, like in the image below, you need to manually configure the maxmind geoip database daily download.

G

Maxmind’s geoip database used to be free, and Mautic used to be able to download the visitor data every day. But since 2020 January an API key verification was introduced, so it is not working at the time this tutorial is written.

In order to get it working, we need a small hack, but believe me, it is worth it.

First go to Maxmind’s website by clicking here.

Register and create an account if you don’t have one yet. Or just log in.

Get your Mixmind licence key:

Generate the licence key as follows:

And confirm. Write down your licence key, or save the config file for future reference.

Now let’s get back into the ssh and get install the packages:

sudo add-apt-repository ppa:maxmind/ppa
sudo apt update
sudo apt upgrade
sudo apt install geoipupdate

Now open the config file and add your credentials, you’ve just created:

sudo nano /etc/GeoIP.conf

Let’s go to our Mautic ip data folder:

cd /var/www/html/mautic/app/cache/ip_data

In case you get an error, and don’t have this folder, you can create it:

mkdir /var/www/html/mautic/app/cache/ip_data

sudo -u daemon geoipupdate -f /etc/GeoIP.conf -d /var/www/html/mautic/app/cache/ip_data -v

You need to make sure all files are readable by your web server, so:

chmod -R 777 /var/www/html/mautic/app/cache/ip_data

This database has to be updated all the time, see a future tutorial how to do it.