Install Metabase on a Laravel Forge provisioned DigitalOcean Droplet
This article has been published a while ago.
If this is a technical article some information might be out of date. If something is terribly broken, let me know and I will update the article accordingly.
Recently I discovered Metabase an open source business intelligence tool. At work, I had to create a lot of statistics in the last months and I always struggled to create an easy to use interface for my coworkers and to reduce the workload for me to build all those database queries. Metabase was the perfect solution for this problem.
Here's a short step by step guide on how you can install Metabase on a DigitalOcean Droplet. (The Droplet in this tutorial is being created and provisioned by Laravel Forge. If you don't use Forge create the Droplet through the DigitalOcean Website)
1. Choose Droplet size
I recommend the "20$ per Month" Droplet (2GB RAM, 40GB SSD, 2 Core Processor).
2. Install Docker
DigitalOcean already has a great tutorial on how to install docker on your new Droplet. Just follow this guide.
3. Install Metabase Docker Image
Next, we install the latest Docker Image from Metabase. By default, all Metabase settings are stored in the docker image. If you ever update the Docker image or delete the image, you lose all your settings and "Questions" (Queries).
That's why we use MySQL as our settings storage.
Create a database called
metabase, create a new Firewall rule to allow all IPs to access port
3306 1 and then use the following code to install and start Metabase. Replace
<password> with your database credentials and you're ready to go.
docker run -d -p 3000:3000 --add-host metabase-db-host:<public-ip-of-droplet> \ -e "MB_DB_TYPE=mysql" \ -e "MB_DB_DBNAME=metabase" \ -e "MB_DB_PORT=3306" \ -e "MB_DB_USER=<username>" \ -e "MB_DB_PASS=<password>" \ -e "MB_DB_HOST=metabase-db-host" \ --name metabase metabase/metabase
You can find more information about the installation of Metabase here
That's it! Your Metabase installation is now running on Port 3000. You should now be able to open Metabase in your browser and follow the final setup steps. Then just add your data sources and you can begin analyzing your data.
I'm no Docker expert and this was the only way how I could connect the Docker Container to the MySQL Database on the Droplet. I know this might be a security risk! If you have a better idea on how to solve this issue, please let me know! ↩