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 16:
[isabell@stardust ~]$ uberspace tools version show node
Using 'Node.js' version: '16'
[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]$ yarn install
(...)
[isabell@stardust umami]$
Configuration
After the installation you need to create the database.
[isabell@stardust umami]$ mysql -e "CREATE DATABASE ${USER}_umami"
[isabell@stardust umami]$
Use your favorite editor to create ~/umami/.env
with the following content:
DATABASE_URL=mysql://isabell:mypassword@localhost:3306/isabell_umami
Additionally you can define a HASH_SALT environment variable. That’s no longer required, but optional if you still want to use it.
HASH_SALT=(any random string)
Create a ~/umami/.babelrc
file with the following content:
{
"presets": ["next/babel"]
}
Now you can create the production build:
[isabell@stardust umami]$ yarn 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 npm run build --debug
to limit the RAM usage and build the app successfully.
Create database tables
[isabell@stardust umami]$ yarn update-db
[isabell@stardust umami]$
This will also create a login account with username admin and password umami.
Setup daemon
Create ~/etc/services.d/umami.ini
with the following content:
[program:umami]
directory=%(ENV_HOME)s/umami
command=yarn 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.33.0 and Uberspace 7.12.2
Written by: Thomas Johnson <https://johnson.tj/>, Andreas Fuchs <https://anfuchs.de/>