Raddy Website Design & Development Tutorials

Self Host Umami on Heroku – Step by Step Guide

By Raddy in Other ·

In this article, I am going to show you how to install Umami on Heroku. Umami is a Simple, Fast, Privacy-Focused, Website Analytics Tool alternative to Google Analytics.

* Note that the Free tier of Postgres only gives you Row Limit 10,000 which might get filled quickly. The next tier is $9 which makes it questionable.

What you need

1) Get Umami

The first thing that you need to do is to Download or Fork the project from the GitHub Page here.

Whether you choose to Download the zip file or Fork the Repo is up to you. In this example, I am only going to show you how to do it using GitHub since is easier and you can easily push future versions as well.

Fork Umami

2) Create New App

Login to your Heroku account and ‘Create a new Application‘ by clicking on the New -> Create new app.

Create heroku app

Name your application and choose a region that is closest to you.

Heroku App Name

3) Connect Your Application With GitHub

Make sure that you’ve selected the project that we just created in step two and go under the ‘Deploy‘. Look for the section called ‘Deployment method‘ and click on ‘GitHub‘ to make the connection.

heroku connect github

Once you connect your GitHub account, we need to select the project that we want to deploy. If you forked the project it should come up once you search for ‘umami‘.

Connect Repo

Click on ‘Connect‘. Don’t deploy the project just yet. We need to install Heroku Postgress first and set up the database.

4) Installing Postgres

To install Heroku Postgres click on the ‘Overview Tab‘ and then ‘Configure Add-ons‘.

Heroku Addon

Search for ‘Heroku Postgres‘ and select the plan that you want. I am using the ‘Hobby Dev‘ – Free plan.

Heroku Postgres

Submit the order.

5) Database Setup

To set up the database and tables required for Umami to run we need to first find out our database connection details. To do that navigate back to the ‘Overview‘ tab and click on the ‘Heroku Postgress‘ link.

Heroku Postgres Database Details

The dashboard should look similar to the image below:

postgresqsql

Click on the ‘Settings‘ tab and then ‘View Credentials‘.

Database Details

Now that we have the database credentials, grab the code below and replace the HOST_NAME, DB_NAME and APPLICATION_NAME with the credentials from the database.

heroku run psql -h HOST_NAME -U USER_NAME -d DB_NAME -f sql/schema.postgresql.sql -a APPLICATION_NAME

Mine would look something like this:

heroku run psql -h ec2-54-74-95-84.eu-west-1.compute.amazonaws.com -U hfzgyqqakmfinp -d DB_NAME -f sql/schema.postgresql.sql -a rad-analytics

Make a note of the Password too, as we’ll need it shortly.

Open PowerShell / Command Line and login to Heroku if you haven’t yet.

heroku login -i

Follow the instructions by entering your email and password. Note that if you have a 2FA, you’ll need to generate a temporarilyAuthorisation Token from Heroku (Account Settings -> Applications -> Create Authorization).

Heroku CLI

Once you are successfully logged in copy and paste the command that we generated earlier (replace with your own database details).

heroku run psql -h HOST_NAME -U USER_NAME -d DB_NAME -f sql/schema.postgresql.sql -a APPLICATION_NAME

Once you do that, it should ask you for your database password. Enter the password and continue.

6) Deploy Umami

This is the final step. Go Back to Heroku and click on the ‘Deploy‘ tab. Scroll to the bottom and click on Deploy Branch.

Deploy From GitHub

This might take a minute or two. While you are waiting, go back to the GitHub Repo and give it a start to support the project.

You might also want to read the medium article where Mike Cao explains how he created this amazing project in one month! Link to the article.

Finally, if you found the Video Guide or this Article useful please share it with friends, family and pets. Consider subscribing to my YouTube Channel.

More Resources:

Thank you for reading this article. Please consider subscribing to my YouTube Channel. It’s FREE!

  1. Sarah John says:

    Hi I was looking for a simple yet comprehensive blog about installing and configuring umami. You have explained it well but for a beginner like me a more detailed article will help as I just started using internet for earning. However, you did a good job. best wishes for you.

    1. Raddy says:

      Thanks, Sarah. I will try to improve on the blog post. I guess the video I did is a little bit more detailed. I hope that you got it to work

  2. Creepy Guru says:

    I’m beginner but the way you have explained it is amazing. I just follow these steps and boom. Appreciate that.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.