DEV Community

Chris Harris for Microsoft Azure

Posted on

Make Better Decisions the Easy Way: Deploy Metabase with Azure Container Apps

With a few simple steps, you can deploy Metabase on Microsoft Azure using Azure Container Apps. This process works for any Docker container hosted on Docker Hub, not just Metabase, so you can try it with your containers.

Background

I work on improving the Developer Experience on Microsoft Azure and I love spending time in the data engineering and data analysis space. I recently have enjoyed working with Metabase, and deploying it on Azure makes it easy to create some amazing visualizations for my data that is already in the Azure cloud.

Metabase Dashboard Example

There are several options for running container-based apps on Azure, but Azure Container Apps (ACA) is one of the easiest to get started with.

The set up

Prerequisites you will need:

 

Deploy Metabase to Azure Container Apps

  1. Create the Container App and deploy the Metabase image

    az containerapp create -g metabase-rg -n metabase --image [myname]metabaseacr.azurecr.io/metabase --environment metabase-aca-env --target-port 3000 --ingress 'external' --cpu 2 --memory 4.0Gi
    

    Note: If prompted to install the containerapp extension, choose Y.

    You will see the steps as they are running, like 'Creating resource group 'your-resource-group-name' and Creating Containerapp your-app-name....

    When the command is complete you will see a line that starts with Browse to your Container App at: http://metabase. You will use this URL to open your new Metabase app, but if you do it right now, you'll likely see a stream timeout error because Metabase needs more resources than the default .5 CPU and 1GB memory Azure Container Apps allocates. The next step will help you update the resources and get the app running.

     

  2. Update the resources for your Container App
    To increase the CPU and memory resources allocated to your new Container App, just run the following command:

    az containerapp update --resource-group metabase-rg --name metabase --cpu 1 --memory 2.0Gi
    

     

Open Metabase and explore

  1. Paste the URL from Step 1 in a browser to start enjoying Metabase!

    If you need that URL again, you can use this command to quickly find it:

    az containerapp show -g metabase-rg -n metabase --query properties.configuration.ingress.fqdn
    

     

    Use the Metabase Getting Started Guide or search for Metabase on YouTube if you need help getting started.

     

Cleanup the resources

When you are done exploring Metabase, don't forget to delete the resources you created if you aren't going to use them any longer.

az group delete -g metabase-rg
Enter fullscreen mode Exit fullscreen mode

 

Next Step - Set up your Container App for production use

Metabase has a nice doc for configuring Metabase to be used in production: How to Run Metabase in Production. One of the steps is to migrate from the internal H2 database to PostgreSQL, and you can use Azure Database for PostgreSQL for this purpose.

You will need to set some environment variables in your Container App to tell Metabase which database to talk to. Azure Container Apps lets you do this easily through the Azure Portal or through the Azure CLI.

If This step is interesting to you, let me know and I'll add another article.

 

Conclusion

I'm still learning about Metabase myself, but I've been super impressed so far. I would love to hear what you think, and if you run into problems, don't hesitate to drop into the Metabase Discussion and bring your questions.

 

Metabase Dashboard Example

 

I want to give a shout-out to the Metabase Discussion site. I've had a number of questions about deploying and using Metabase that I've posted on the site. Most of my questions have been answered within hours and no question has gone unanswered. Amazing support!

 

And if you want a little more information on running Metabase in a Docker container, Metabase has a very nice doc that got me off to a good start: Running Metabase on Docker

Top comments (0)