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 create the database and import the database setup.

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

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)

Now you can create the production build:

[isabell@stardust umami]$ npm run build
[isabell@stardust umami]$

Warning

In newer versions, sometimes the build process fails without any errors in the next build stage. This is due to Uberspace killing the process for needing to much memory. If this happens, you will not be able to start the app – it will say Error: Could not find a production build in the ‘/home/isabell/umami/.next […]’ directory. Try running the build process via NODE_OPTIONS=–max_old_space_size=512 npx next build –debug to limit the RAM usage and build the app successfully.

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 1.17.0 and Uberspace 7.11.0

Written by: Thomas Johnson <https://johnson.tj/>