It is always useful to know how your business or projects are doing and for that, there are a bunch of tools available such as Excel spreadsheets, Google DataStudio, Apache Superset, etc. I personally am a fan of Metabase as it is the easiest to deploy and use. When paired with the right technologies, this setup becomes trivial to any small or large organizations.
Main benefits of self-hosting Metabase (other tools as well):
- Performance - compared to Cloud VMs your own hardware will not be throttled even when it runs heavy queries.
- Costs - hardware like Intel NUC (or new ones from AMD) pay for themselves not in years but in months. I have mine for more than 2 years and it's been fantastic little helper.
- Privacy - since you need to supply connection strings to your detabase, it's much better to do it on your own hardware where you control the risks.
- Stability - managed instances can be updated at any time and can break your setup. This happened to us :)
In this article, we will use a setup that works exactly the same way on both an Intel NUC (for some of my projects) and on a large VM that is managed by a VMware.
Prerequisites
- Webhook Relay account - will be used to expose the Metabase to the internet, so we can access it.
- Synpse account - a lightweight and fantastic platform to manage and run software on your own hardware. Offers management of up to 5 devices free of charge.
1. Install Synpse into your server/machine
Once you log into Synpse Cloud, select your project and then head to the "Devices" page. From there you will be able to find the auto-generated command that you need to run on the device to add it to your project.
There are multiple ways to do it however initially you can just SSH into the machine via local network. Once you run the command, after a few seconds (depends on your internet speed) you should see the magic happen and device appear in your "Devices" page in Synpse :)
2. Create a Webhook Relay tunnel for your Metabase app
Our Metabase deployment will need to be reachable from outside so we can actually view reports. For this, we are creating a Webhook Relay tunnel that will be established by a webhookrelayd
container.
Go to your https://my.webhookrelay.com/tunnels page and create a new tunnel with these details:
- name: 'whr-metabase' (
webhookrelayd
agent will need to know which tunnel to use) - destination: 'http://metabase:3000' (metabase is reachable using container's name)
3. Get your access token key and secret
Head to the tokens page here https://my.webhookrelay.com/tokens and create a new pair. Save the key and secret before closing the window.
Go to the secrets page in Synpse and create both relayKey
and relaySecret
secrets:
4. Deploy Metabase via Synpse
Last step is to create a Synpse application.
name: metabase
description: metabase + WHR
scheduling:
type: Conditional
selectors:
type: controller
spec:
containers:
- name: metabase
image: metabase/metabase:latest
volumes:
- /data/metabase:/metabase-data
env:
- name: MB_DB_FILE
value: /metabase-data/metabase.db
- name: MB_REDIRECT_ALL_REQUESTS_TO_HTTPS
value: "false"
- name: relayd
image: webhookrelay/webhookrelayd:1
args:
- --mode
- tunnel
- -t
- whr-metabase # <--- if you have chosen a different name for the tunnel, change it here too
env:
- name: RELAY_KEY
fromSecret: relayKey
- name: RELAY_SECRET
fromSecret: relaySecret
Once deployed, use your tunnel URL to access it. You can also configure Google OAuth to make the login easier, however that's out of scope in this article.
Enjoy!
Originally published on https://webhookrelay.com/blog/2021/11/11/setting-up-selfhosted-metabase/
Top comments (0)