umami

umami is a simple, easy to use, self-hosted web analytics solution. The goal is to provide you with a friendlier, privacy-focused alternative to Google Analytics and a free, open-sourced alternative to paid solutions. Umami collects only the metrics you care about and everything fits on a single page.


Note

For this guide you should be familiar with the basic concepts of

Prerequisites

Node and npm

We’re using Node.js version 12:

[isabell@stardust ~]$ uberspace tools version show node
Using 'Node.js' version: '12'
[isabell@stardust ~]$

You’ll need your MySQL credentials. Get them with my_print_defaults:

[isabell@stardust ~]$ my_print_defaults client
--default-character-set=utf8mb4
--user=isabell
--password=MySuperSecretPassword
[isabell@stardust ~]$

Your website domain needs to be set up:

[isabell@stardust ~]$ uberspace web domain list
isabell.uber.space
[isabell@stardust ~]$

Installation

We clone the repository to our home directory and install the application.

[isabell@stardust ~]$ git clone https://github.com/mikecao/umami.git
[isabell@stardust ~]$ cd umami
[isabell@stardust umami]$ npm install
(...)
[isabell@stardust umami]$

Configuration

After the installation you need to setup the database and do some configuration.

[isabell@stardust umami]$ mysql -e "CREATE DATABASE ${USER}_umami"
[isabell@stardust umami]$ mysql "${USER}_umami" < sql/schema.mysql.sql
[isabell@stardust umami]$

Enter your MySQL password.

Use your favorite editor to create ~/umami/.env with the following content:

DATABASE_URL=mysql://isabell:mypassword@localhost:3306/isabell_umami
HASH_SALT=(any random string)

Generate the database client and create the production build:

[isabell@stardust umami]$ npm run build-mysql-client
[isabell@stardust umami]$ npm run build
[isabell@stardust umami]$

Setup daemon

Create ~/etc/services.d/umami.ini with the following content:

[program:umami]
directory=%(ENV_HOME)s/umami
command=npm start
autostart=yes
autorestart=yes

After creating the configuration, tell supervisord to refresh its configuration and start the service:

[isabell@stardust ~]$ supervisorctl reread
SERVICE: available
[isabell@stardust ~]$ supervisorctl update
SERVICE: added process group
[isabell@stardust ~]$ supervisorctl status
SERVICE                            RUNNING   pid 26020, uptime 0:03:14
[isabell@stardust ~]$

Configure web server

Note

umami is running on port 3000.

To make the application accessible from the outside, configure a web backend:

[isabell@stardust ~]$ uberspace web backend set / --http --port <port>
Set backend for / to port <port>; please make sure something is listening!
You can always check the status of your backend using "uberspace web backend list".
[isabell@stardust ~]$

Configure application

Your Umami installation will create a default administrator account with the username admin and the password umami.

Warning

The first thing you will want to do is log in and change your password.

For more information check the umami documentation.

Updates

Note

Check the git repository regularly to stay informed about changes.

To update the application, stop the daemon and repeat the installation step.


Tested with umami 2020-08-19 and Uberspace 7.7.4

Written by: Thomas Kammerer <https://kammerer.tk/>