304 North Cardinal St.
Dorchester Center, MA 02124
Last Updated on: 20th June 2023, 10:37 am
Metabase is the easy, open source way for everyone in your company to ask questions and learn from data.
Let’s start with actual deployment…
Please make sure you should fulfill the below requirements before proceeding to the actual deployment.
If you are looking for a tool to easily summarize and visualize your data without ever writing a single line of SQL Query or having to wait on a coworker. Metabase is the perfect tool.
When you need to dig into the complicated stuff, Metabase provides a flexible GUI query builder and an elegant SQL interface.
You can get beautiful graphs and charts with just a few clicks from the data.
Metabase is a simple and powerful analytics tool that lets anyone learn and make decisions from their company’s data. No technical knowledge is required! I hope you love it.
Metabase allows us to visualize our data using beautiful GUI. You can browse or search through all tables in our databases, then filter things down to find just what you need.
Schedule and send charts or results to your team via email or Slack.
Let everyone on your team create, organize, and share beautiful collections of visualizations and data.
Set up alerts to let everyone know when something needs your attention, or when you’ve met that goal at last.
Metabase is the easy, open-source way for everyone in your company to ask questions and learn from data.
Metabase supports most of the databases. Below is the list of supported databases.
Containers are fast to deploy and make efficient use of system resources. Developers get application portability and programmable image management and the operations team gets standard run time units of deployment and management.
With all the known benefits of containers, there is one common misperception that the containers are ephemeral, which means if we restart the container or in case of any issues with it, we lose all the data for that particular container. They are only good for stateless micro-service applications and that it’s not possible to containerize stateful applications.
I am going to use GlusterFS to overcome the ephemeral behavior of Containers.
I already set up a Replicated GlusterFS Volume to have data replicated throughout the cluster if I would like to have some persistent data.
The below diagram explains how the replicated volume works.
Volume will be mounted on all the nodes, and when a file is written to the
/mntpartition, data will be replicated to all the nodes in the Cluster
In case of any one of the nodes fails, the application automatically starts on other node without loosing any data and that’s the beauty of the replicated volume.
Persistent application state or data needs to survive application restarts and outages. We are storing the data or state in GlusterFS and had periodic backups performed on it.
We will use a backup of the volume to spin a new application container anywhere else in case of unexpected issues occur in the current environment.
I am going to persistent
/metabase-data/metabase.db of Metabase for disorder recovery.
Create folders in
/mnt directory to persistent Metabase data folder.
sudo mkdir -p metabase
Please watch the below video for Glusterfs Installation
Create a folder in
/opt directory to place configuration file, i.e,
.yml file for Metabase.
Use the below commands to create the folder.
sudo mkdir -p metabase
sudo touch metabase
metabase.yml created earlier with nano editor using
sudo nano metabase.yml
Copy and paste the below code in
Here is the
docker compose file for
version: "3.7" services: metabase: image: metabase/metabase depends_on: - maindb ports: - '4000:3000' volumes: - /mnt/metabase:/metabase-data/metabase.db environment: - MB_DB_TYPE=mysql - MB_DB_DBNAME=metabase - MB_DB_PORT=3306 - MB_DB_USER=root - MB_DB_PASS_FILE=/run/secrets/mysql_root_password - MB_DB_HOST=maindb networks: - proxy deploy: placement: constraints: [node.role == worker] replicas: 1 update_config: parallelism: 2 delay: 10s restart_policy: condition: on-failure labels: - "traefik.enable=true" - "traefik.docker.network=proxy" - "traefik.http.routers.metabase.rule=Host(`metabase.example.com`)" - "traefik.http.routers.metabase.tls=true" - "traefik.http.routers.metabase.tls.certresolver=default" - "traefik.http.routers.metabase.entrypoints=websecure" - "traefik.http.services.metabase.loadbalancer.server.port=3000" volumes: metabase: driver: "local" networks: proxy: external: true
As I mentioned in the prerequisites, I used MariaDB as a back-end storage system for Wiki.js which was deployed earlier to our Docker Swarm environment.
Please make sure we have created a wiki database before deploying Metabase using the MariaDB stack deployed earlier.
Now it’s time to deploy our docker-compose file above
metabase.yml using the below command
docker stack deploy --compose-file metabase.yml metabase
You can give it any name for the stack. I just named it as
Check the status of the stack by using
docker stack ps metabase
Now open any browser and type
metabase.example.com (whatever host URL used in the Metabase configuration in the docker-compose file) to complete Metabase installation.
Make sure that you have DNS entry for your application (metabase.example.com) in your DNS Management Application.
Please find below images for your reference. Click on them to open in lightbox for full resolution.
Hope you enjoyed this tutorial, please give your input/thought on it by commenting below. It would help me to bring more articles that focus on Open Source to self-host.
Stay tuned for other deployments in coming posts… 🙄