[Guide] How to install Metabase (dashboard) along with ERPNext on Ubuntu 18.04 server

Hi guys :raised_hand_with_fingers_splayed:

I am using ERPNext to manage data for my business and its working great. Actually I am not using the ERPNext functionality as such but instead I have developed my custom app to suite the business needs and its running smoothly.

One thing I have noticed is that Frappe and ERPNext lacks advanced data analytical tools in general. I know that since v12 steps are being taken in the right direction to get more data analytical and visualization tools (like dashboard charts) included as part of the core package but still it lacks the features of full-fledged data analytics and business intelligence tools like PowerBI, Metabase, etc.

I wanted to have a fully featured dashboard (like the images below) wherein I can visualize data and play around with it so as to make sense of it in a quick and visual way. After analyzing a lot of data analytics tool I finally zeroed in on Metabase as it goes well with the open-source nature of ERPNext & Frappe.


After a lot of tinkering around I finally managed to install and get Metabase running on the same server as ERPNext.

As my contribution to ERPNext’s wonderful community, I am sharing a step-by-step installation guide for Metabase to run along with ERPNext.

Before we start, I assume that you have already setup, installed and are running ERPNext on a Ubuntu server on cloud platforms like AWS, GCP, DO, etc.

Let’s start with the Metabase installation now:

Step 1: Login to your server’s SSH terminal and update available packages (if you log in as root, then switch to you admin user using “su [admin-username]” command)

sudo apt-get update

Step 2: Install Java JRE (select Yes for any installation prompts)

sudo apt-get install default-jre

Step 3: Check java version and installation path

sudo java -version             # this will print the java version installed
sudo which java                # this will print /usr/bin/java

Step 4: Create a directory for metabase installation

sudo mkdir -p /applications/metabase
cd /applications/metabase

Step 5: Download the Metabase application

wget http://downloads.metabase.com/v0.33.2/metabase.jar

# you can get the latest version download link from https://metabase.com/start/other.html

Step 6: Start the Metabase application

java -jar metabase.jar

Step 7: Create a new user and group and change ownership of the metabase directory to this new user

sudo groupadd -r metabasegrp
sudo useradd -r -s /bin/false -g metabasegrp metabaseusr
sudo chown -R metabaseusr:metabasegrp /applications/metabase

Step 8: Add a system service for Metabase application so that it can be managed like other services (nginx, bench, etc.)

Create a new file “metabase.service” at: /etc/systemd/system/

sudo vim sudo vim /etc/systemd/system/metabase.service

# in case you are new to the vim commands read below:
# hit "i" key to start inserting / typing into the file
# hit ":wq" to save and close the file (w=write, q=quit)
# you can also create a file using FTP tools like FileZilla, WinSCP, etc 

Copy the following code into the newly created file

[Unit]
Description=Metabase Application
Documentation=https://www.metabase.com/docs/latest

[Service]
WorkingDirectory=/applications/metabase
ExecStart=/usr/bin/java -Xms128m -Xmx256m -jar metabase.jar
User=metabaseusr
Type=simple
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Step 9: Start and enable the metabase service and reload nginx

sudo systemctl daemon-reload
sudo systemctl start metabase.service
sudo systemctl enable metabase.service
sudo systemctl status metabase
sudo service nginx reload

Step 10: You are done! You can now access the freshly installed Metabase via your browser at

http://[your-server-ip]:3000

You will see the below welcome screen. Setup Metabase using the following:

Database Type: MySQL
Host: localhost
Port: 3306
Database Name: [name-of-your-erpnext-db] 
Database Username: root
Database Password: [mysql-root-pass]

Notes:

  1. Allow some time (2-3 minutes) for the Metabase application to start on first load.
  2. You can find your ERPNext database details in the /home/frappe/frappe-bench/[site-name]/site_config.json file
  3. To secure your database server you can create and login to Metabase using a non-root user
  4. You can test Metabase on a sample database that you download here: http://www.mysqltutorial.org/mysql-sample-database.aspx

I hope I was able to make this guide as easy as possible so that even first time users will be able to install Metabase with ERPNext without any issues.

Thanks
Shashank :slight_smile:

37 Likes

Dang sir, thank you!

Hope you keep the document up to date in the long run :slight_smile:

1 Like

Thank you very much

1 Like

Awesome!!

1 Like

Does this work for Multi-Tenant setup?

Hi @Obinna_Ukwueze,

Yes this works absolutely fine for multi-tenant setup. Metabase is installed on port 3000. You can connect your sites (databases) directly from within the application.

1 Like

Hello everyone,
How to apply SSL Certificate on Metabase URL : {My-ERP-URL}:3000
Can we Setup lets-encrypt?? or Any other method ??

Good job!

@kolotayo you want to have a look at this ??

Refer this video for more details…:grinning:

1 Like

part-2,

@Tech_Hack_IT I have followed the procedure.My metabase status shows below and i perceived that is why my http://url:3000 could not start the metabase.Any guide? Thanks.
‘Dec 30 08:58:18 vps282314 java[2412]: Exception: java.lang.OutOfMemoryError thro
Dec 30 08:58:24 vps282314 java[2412]: Exception: java.lang.OutOfMemoryError thro
Dec 30 08:58:34 vps282314 java[2412]: Exception: java.lang.OutOfMemoryError thro
Dec 30 08:58:35 vps282314 java[2412]: Exception: java.lang.OutOfMemoryError thro
Dec 30 08:58:37 vps282314 java[2412]: Exception: java.lang.OutOfMemoryError thro
Dec 30 09:00:14 vps282314 java[2412]: Exception: java.lang.OutOfMemoryError thro
Dec 30 09:00:19 vps282314 java[2412]: Exception: java.lang.OutOfMemoryError thro
Dec 30 09:00:38 vps282314 java[2412]: Exception: java.lang.OutOfMemoryError thro
Dec 30 09:10:24 vps282314 java[2412]: Exception: java.lang.OutOfMemoryError thro
Dec 30 09:15:49 vps282314 java[2412]: Exception: java.lang.OutOfMemoryError thro’
~

@Fred1
Hello sir, Please refer the link.

Everytime I want to access to metabase web interface I have to reboot it. After reboot it work fine and then next day when I want to check my dashboards, I need to restart it if not the webpage is not responding. Any idea what to look for?

Please suggest me i was facing this issue during the database connection

Under the host field, type only your IP omitting http://, in this case 165.227.30.84

Great work shashank_shirke. Thank-you for this info and access to metabase.

1 Like

Hi @Samuel_Gervais

Have you correctly configured the metabase.service file?

This file is specifically created to make sure that you need not manually run the Metabase executable everytime you want to access your dashboards. This file keeps the service up and running in the background.

Hi, I have the same issue,
i configured the service file using your tutorial guide. @shashank_shirke

Can you please let me know about the following?

  • Frappe / ERPNext version you’ve installed
  • Metabase version that you’ve installed