Roll Your Own Google Analytics Alternative with Umami in Docker 🌱

What is Umami?

Umami is a simple, fast, privacy-focused alternative to Google Analytics. -https://github.com/umami-software/umami

Installing Docker

  1. Log into the Linux based device
  2. Run the following commands in the terminal
    # install prerequisites
    sudo apt install apt-transport-https ca-certificates openssl curl software-properties-common gnupg-agent -y
    # add docker gpg key
    curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
    # add docker software repository
    sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
    # install docker
    sudo apt install docker-ce docker-compose containerd.io -y
    # enable and start docker service
    sudo systemctl enable docker && sudo systemctl start docker
    # add the current user to the docker group
    sudo usermod -aG docker $USER
    # reauthenticate for the new group membership to take effect
    su - $USER

Running Umami

  1. Now that Docker is installed, run the following commands to setup the Umami Docker container and run it
    # create working directories
    mkdir ~/docker/mariadb -p
    # set owner of working directories
    sudo chown "$USER":"$USER" ~/docker -R
    # create containers network
    docker network create containers
    # generate a random string
    RANDOMSTRING=$(openssl rand -base64 30)
    # run the mariadb docker container
    docker run -d --name mariadb --network containers -e MYSQL_ROOT_PASSWORD=r00tp@ss -e MYSQL_USER=umami_rw -e MYSQL_PASSWORD=Um4m1 -e MYSQL_DATABASE=umami -v ~/docker/mariadb:/var/lib/mysql --restart=unless-stopped mariadb:latest
    # run the umami docker container
    docker run -d --name umami --network containers -p 8030:3000 -e DATABASE_URL=mysql://umami_rw:Um4m1@mariadb:3306/umami -e DATABASE_TYPE=mysql -e APP_SECRET=$RANDOMSTRING --restart=unless-stopped umamisoftware/umami:mysql-latest
  2. Open a web browser and navigate to http://DNSorIP:8030
  3. Login with the username admin and password umami
  4. Navigate to Settings > Profile and click the Change Password button
  5. Enter the current password (umami) and enter and confirm the new password > Click save

Documentation: https://umami.is/docs