Matomo Self-Hosted Google Analytics Alternative on Docker

dbtechDockerLeave a Comment

Matomo Self-Hosted Google Analytics Alternative on Docker

In this video we’ll look at installing Matomo, a Self-Hosted Google Analytics Alternative, on Docker

Take back control with Matomo – a powerful web analytics platform that gives you 100% data ownership.

Be in full control with data ownership and privacy protection

With 100% data ownership you get the power to protect your user’s privacy. You know where your data is stored and what’s happening to it, without external influence.

What does Matomo offer?

Matomo today is a complete all-in-one web analytics platform.

Pre-Installation

The process of installing Matomo is pretty straightforward, but you’ll want to make sure that you have a domain name setup for it before you get started.

I use CloudFlare to manage my DNS, so I’ve pointed analytics.dbtech.xyz to my home IP. I’ve also made sure that the “Proxied” option has been changed to “DNS Only” by simply clicking it.

I’ve also got NGINX Proxy Manager setup on my network to manage server-side SSLs and to point URLs to the appropriate places on my server. We’ll come back to that after we get our containers deployed.

Installation

First things first, you’ll need to go to Portainer and create a new stack. Copy and paste this into your new stack:

version: '2.1'
services:
matomo:
image: matomo
restart: always
ports:
– 8384:80
environment:
– MATOMO_DATABASE_HOST=db
– MATOMO_DATABASE_TABLES_PREFIX=mat_
– MATOMO_DATABASE_USERNAME=matomo
– MATOMO_DATABASE_PASSWORD=matomo
– MATOMO_DATABASE_DBNAME=matomo
volumes:
– /srv/dev-disk-by-uuid-0d4a201c-b292-412d-ade6-cc5561e54f1f/Configs/Matomo:/var/www/html
links:
– db:db
db:
image: yobasystems/alpine-mariadb:latest
restart: always
environment:
MYSQL_DATABASE: matomo
MYSQL_USER: matomo
MYSQL_PASSWORD: matomo
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
– /srv/dev-disk-by-uuid-0d4a201c-b292-412d-ade6-cc5561e54f1f/Configs/Matomodb:/var/lib/mysql

view raw
gistfile1.txt
hosted with ❤ by GitHub

You’ll want to change the database username and password in both the matomo and the db sections. Also change the path for the volumes to reflect where you store data on your server.

Don’t forget to give your stack a name.

Once you’ve done that, you can scroll to the bottom and click the blue “Deploy the Stack” button.

Give your system a chance to do its thing. When the page reloads, the stack is deployed and your containers should be up and running.

Next, go to your-server-local-address:8384 just to make sure that everything is working. You should see the first page of the installation process for Matomo.

STOP.

Configuring Matomo’s Setup

Now were going to go over to NGINX Proxy Manager and setup our domain.

Click “Hosts” at the top of the page and when the new page loads, click “Add Proxy Host”.

Enter your domain name. I’ve entered analytics.dbtech.xyz into the first text box.

Enter your server’s local IP address in the “Forward Hostname / IP” box and enter 8384 into the “Forward Port” box.

Click the “Block Common Exploits” box.

Next, go to the “SSL” tab and select the “Request a New SSL” option in the dropdown. Also, check the “Force SSL” and “HTTP/2 Support” options.

Click “Save”.

After a moment or so, the page should reload and there should be a new entry on your Proxy Hosts page.

Click the URL under the SOURCE column and it should take you to your new installation of Matomo in a new browser tab.

If everything worked and you’re able to see analytics.your-domain.com, then we need to make a couple more changes.

Post-Installation Configuration

Go back to NGINX Proxy Manager and find your new entry. Click the 3 vertical dots on the right side of the page next to your new entry.

Click “Edit”.

Go to the “SSL” tab and re-check the 2 radio buttons for “Force SSL” and “HTTP/2 Support”.

Click “Save”.

Next, go back to CloudFlare and edit your Analytics entry and change “DNS Only” to “Proxied”.

Now you can go back to analytics.your-domain.com and go through the installation process. It’s just a matter of filling in the blanks and clicking the “continue” button on each page as you can see in the video.

Once you have completed the installation, you will setup your first site and can copy and paste the code that Matomo gives you into your site and start tracking traffic immediately.


Matomo Website:
https://matomo.org/

Matomo Docker Compose Stack:
https://gist.github.com/dnburgess/65161ecbfe714b677f37ce8d0e65b2b2

Join this channel to get access to perks:
https://www.youtube.com/channel/UCVy16RS5eEDh8anP8j94G2A/join

LattePanda Delta 432: https://dbte.ch/dfrobot
512 GB NVMe Drive: https://amzn.to/36N4aEB (Affiliate)

DFRobot Coupons
Coupon code: DBTech0125
Discount: $5 x 20 (No threshold)
Date Start: 2021/01/25
Date End: 2021/03/31
Product Limit: Lattepanda/Raspberry Pi/micro:bit board/ micro:Maqueen/ PCB/ NVIDIA/ Maix/ Sony Products

Join this channel to get access to perks:
https://www.youtube.com/channel/UCVy16RS5eEDh8anP8j94G2A/join

 

/=========================================/

Remember to leave a like on this video and subscribe if you want to see more!

/=========================================/

Like what I do? Want to be generous and help support my channel? Here are some ways to support:

Patreon: https://dbte.ch/patreon
Ko-fi: https://dbte.ch/kofi

/=========================================/

Here’s my YouTube Merch Store:
https://dbte.ch/ytstore

/=========================================/

Here’s my Amazon Influencer Shop Link:
Amazon: https://dbte.ch/amazonshop

/=========================================/

Follow Me:
Twitter: https://dbte.ch/tw
Facebook: https://dbte.ch/fb
Subscribe: https://dbte.ch/ytsub