Matomo OpenShift
Matomo is a fully featured web analytics server and is a great alternative to Google Analytics when data ownership and privacy compliance are a concern.
Matomo OpenShift provides a set of OpenShift configurations to set up an instance of the Matomo web analytics server. See: matomo.org for additional details regarding Matomo.
Architecture
The service is composed by the following components:
- matomo: includes two containers within a single pod, the matomo analytics instance and matomo-proxy, which is the nginx used to proxy http requests.
- matomo-db: a mariadb instance that will be used to store the analytics data.
Deployment / Configuration
The templates provided in the openshift
folder include everything that is necessary to create the required builds and deployments.
To run Matomo on openshift you MUST install openshift-developer-tools and have them available on your path.
By default, Matomo uses the Artifactory as docker registry proxy cache. If you are going to keep the default settings, Artifactory MUST be enabled in your OCP cluster, otherwise you will have to tweak the param file to specify your docker registry.
Running with Artifactory/docker.io:
Follow the instructions on artifactory to create an artifactory secret in each of the environments
you will be building/deploying to. The initOSProjects.sh
utility function in openshift-developer-tools can also be used to autmatically set-up the pull credentials and links them to the service accounts.
If you want to use your docker hub account, do the same command as for artifactory but use your docker.io login credentials.
Deploy:
Once the secret is created, use the manage script in the openshift folder to deploy your project
./manage -n 4a9599 init
This will generate local param files, make sure to go through each of the param files, uncomment NAMESPACE_NAME, and set it to your project namespace. In this case, 4a9599.
If you're using a custom docker registry you will also need to uncomment and change DOCKERREG and PULLCREDS in matomo-proxy-build.local.param
and SOURCEIMAGENAME in matomo-build.local.param
Next we can build and deploy
./manage build ./manage -e dev deploy
The deployment will have created two sets of secrets for you to referance while completing the initial configuration; matomo-db, containing the database info and randomly generated credentials and matomo-admin, containing randomly generated credentials for your main super-user account.
For full script documentation run ./manage -h
.
First Run
Once everything is up and running in OpenShift, follow the instructions to create your superuser, set-up the connection to the database and initialize the Matomo dashboard.
To start tracking, copy the snippet for the appropriate website in the Matomo dashboard and place it in your website.