Changes about data privacy are rippling out worldwide, because of the new law from Europe: the GDPR.
Set to take effect on May 25th of this year, this new law restricts the data that companies can collect, and more specifically, how to store and use these data. So, before using any SaaS tool for marketing, sales or analytics, we have to take a step back, and think about the impact this new tool can have on your GDPR data compliance checkist. Open source and self-hosted tools like Mautic significantly reduce the complexity of your compliance checklist (they also have a great post about it).
Mautic provides free and open source marketing automation software available to everyone; free email marketing software, lead management software and more.
This post is about how you can deploy step by step your own Mautic server on Clever Cloud (within a Europe-only zone) using Git.
Requirements
If you haven't done it yet, download the archive here and unzip it in an empty directory.
Then, create a PHP application linked with a MySQL add-on from the Clever Cloud Console or directly from you terminal using the Clever Cloud CLI:
$ clever create --type php mautic-php --alias production
$ # For MySQL, let's show available plans:
$ clever addon providers show mysql-addon
$ # For a matter of performance, let's create 'mautic-mysql' add-on with the 'm' plan
$ clever addon create mysql-addon --plan m mautic-mysql-M --link mautic-php
You also have to create 2 FS Bucket add-ons that we will configure in the next part.
$ clever addon create fs-bucket mautic-fs-media --link mautic-php
$ clever addon create fs-bucket mautic-fs-config --link mautic-php
Dynamic contents
In order to keep everything persisted between two deployments, we will use the two FS Bucket add-ons to store files that will be modified during the installation.
You need to add two variables in your application's environment to link those FS Buckets with the corresponding directories.
Note: The fs_bucket_host
can be found in each FS Bucket dashboards.
CC_FS_BUCKET=/media:<fs_bucket_host_1>
CC_FS_BUCKET_1=/app/config:<fs_bucket_host_2>
The next step is to upload the content of the media
directory to the first FS Bucket and the content of the app/config
directory to the second FS Bucket. You can use FileZilla to upload those files.
Once everything is uploaded, delete the content of those directories (FS Bucket add-on has to be linked to an empty directory).
Crontab
One of the main features of Mautic is e-mail delivery. You can't use this feature if you haven't configured crontab.
Therefore, we will configure 3 crons to update segments and trigger campaigns by adding a script in the cron-scripts
directory at the root of the main directory.
cron-scripts/mautic_cron.sh
#! /usr/bin/env bash
source /home/bas/applicationrc
/usr/bin/php ${APP_HOME}/app/console $1
Then, we create a clevercloud/cron.json
file containing the lines below to trigger the script:
[
"0,15,30,45 * * * * sh $ROOT/cron-scripts/mautic_cron.sh mautic:segments:update",
"5,20,35,50 * * * * sh $ROOT/cron-scripts/mautic_cron.sh mautic:campaigns:update",
"10,25,40,55 * * * * sh $ROOT/cron-scripts/mautic_cron.sh mautic:campaigns:trigger"
]
Going further with crontab
You might want to go further in your marketing automation and add new crons to trigger updates for social automation for example. The full list of crons is available here.
Deploying Mautic on Clever Cloud
Now it's time to use Git to deploy it to Clever Cloud.
$ git init
$ git add .
$ git commit -m "Mautic init config"
$ # if you have installed the Clever Cloud CLI
$ clever link <APP_ID | APP_NAME>
$ clever deploy
# else use a remote
$ git remote add clever <REMOTE_URL> # (available in the information of your app)
$ git push clever master
Wait for a few seconds, and your application should be running!
Configuration screen
The configuration is pretty straightforward. Follow the instructions and fill it with MySQL's credentials which you can find in the add-on configuration screen of the web console of Clever Cloud.
You also have to setup the Mailer transport.
What can I do now ?
After logging in, you can start configuring your marketing automations with the Mautic Documentation.
If you need help while deploying your own Mautic server on Clever Cloud, join the Clever Cloud Gitter and ask us any questions. Thanks for reading, and don't hesitate to reach our support if you need anything! ✌️