Metabase - A BI solution that just works
I like exploring new solutions and anything to do with data always piques my interest. I came across this nice tool through the list of free self hosted software.
UPDATE
I am still getting introduced to the world of docker and while most of it just works few things confuse the hell out of me.
Anyway what happened is there was an update for Metabase and I wanted to apply it on my container and in doing so I realised that some of this post can be changed to make it a better experience from get go because after update all my config and dashboards were gone and I had to reconfigure everything.
It could be that my lack of knowledge meant I did something wrong and faced the issue but irrespective doing it as per updated post below will ensure you dont face the issue at all because I have now tested it twice to ensure it works well.
I have also added the steps to update the metabase to latest docker image as it worked for me.
The overall impression when I opened their site can be summed up with WOW!! Now they offer simple docker install supported officially by them and the guide to install docker image is simple enough but the few simple steps I followed are as below:
- Create an A-record for a subdomain for metabase
- Download the official metabse docker image from dockerhub
- Create an apache server conf file for metabase
- Run the metabase docker image
- Access metabase docker image using subdomain URL
- Configure your database on metabase
- Run Certbot to make the URL https
- Done!!
Create A-record for subdomain¶
Using the process for your Domain Name Regsitrar create an A-Record for a subdomain you would want to use for metabase. For this guide we will assume that the subdomain being created is called "metabase" so if your domain name is say yourdomain.com then the URL to access metabase will be metabase .yourdomain .com.
Note
It is important that if you use a different subdomain name, please replace metabase with the subdomain name you have chosen in all Apache conf file samples in sections below.
More detailed steps are available on previous post HERE
Download and Create Apache Conf¶
Create a conf file similar to what is shown below:Ctrl+X
and issue following commands to enable site and reload the apache server.
Run Metabase docker image¶
Now Stop and rename the container
Finally run Metabase Docker Image while pointing it to your filesystem for database file.
docker run -d
- This is telling system to start a container in detached mode. By design, containers started in detached mode exit when the root process used to run the container exits.
-p 12345:3000
- This is telling docker to make the container map port 12345 to port 3000 which is the default port on which metabase starts its server.
-v ~/metabase-data:/var/www/metabase
- This part is telling docker to map the "metabase-data" directory in the container to "/var/www/metabase" on the filesystem. In other words, mounting the local volume at path "/var/www/metabase" onto the container in "metabase-data" directory.
--name metabase metabase/metabase
- Finally this part of command is telling docker to name the container "metabase" and to use the docker image "metabase/metabase" from dockerhub
Do bear in mind if you change the port as explained above, you will also need to change the port in apache conf file in previous step. So your apache conf file in this case will look as shown below:
Access and configure on browser¶
Note
Access your metabase using the subdomain url - http:// metabase.yourdomain .com and it should walk you through the initial configuration. If you do not want to add a database and just play with the tool, they have kindly provided a sample database.
It might be useful for you to create a "user" in your database that has "read only" access and then use that "user" when you configure metabase. Metabase will only ever need read access as it cannot be used to modify data in your database.
Enable SSL¶
Once you are happy with your configuration from step above, just run the certbot to enable https using letsencrypt certificate. On Debian this could be as simple as issuing the command
/etc/apache2/sites-available
. Check this and once it is there you are all set to access your new functional metabase instance on https. More detailed steps are available on previous post HERE
Update version¶
Updating on docker image is pretty straight forward and provided you have followed steps above should not result in you loosing all the effort once update has completed.
From my recent messing around, I have come to realise that so long as the first start of the docker image was done using environment variables pointing to correct database directory, there is no need to run the commented lines above and a simple stop, upgrade and start should work just fine. Enjoy!!!