Support for Heroku

Hi! I want to clarify your statement here:

Metabase will be deprecating Heroku in an upcoming release.

I'm assuming that it's the Heroku Buildpack that is being deprecated? If I want to run Metabase on Heroku using their support for docker that it would be supported? We would be running on paid dynos with a paid database.

Cheers,

Lang

Hi @langsharpe
Affirmative. The article talks about deprecating the buildpack support. You will still be able to use Docker + Heroku. :partying_face:

1 Like

Hi @nemanja I tried to deploy the docker container to Heroku following the Heroku docker help

I executed these commands

docker pull metabase/metabase:v0.45.3
docker tag metabase/metabase:v0.45.3 registry.heroku.com/<MY-APP-NAME>/web
docker push registry.heroku.com/<MY-APP-NAME>/web
heroku container:release web --app <MY-APP-NAME>

And I get this error on the heroku logs

2023-05-05T19:15:57.476106+00:00 app[web.1]: 2023-05-05 19:15:57,443 INFO metabase.core ::
2023-05-05T19:15:57.476128+00:00 app[web.1]: Metabase v0.45.3 (070f57b release-x.45.x)
2023-05-05T19:15:57.476129+00:00 app[web.1]:
2023-05-05T19:15:57.476129+00:00 app[web.1]: Copyright © 2023 Metabase, Inc.
2023-05-05T19:15:57.476129+00:00 app[web.1]:
2023-05-05T19:15:57.476130+00:00 app[web.1]: Metabase Enterprise Edition extensions are NOT PRESENT.
2023-05-05T19:15:57.505658+00:00 app[web.1]: e[31mUnrecognized command: '/app/run_metabase.sh'e[0m
2023-05-05T19:15:58.123674+00:00 heroku[web.1]: Process exited with status 1
2023-05-05T19:15:58.170863+00:00 heroku[web.1]: State changed from starting to crashed

Any idea of what could be wrong with that?

The same image running locally works fine

docker run -d -p 3000:3000 --name metabase-local --env "MB_JETTY_PORT=3000" metabase/metabase:v0.45.3

there seems that Heroku uses another container runtime that maybe doesn't recognize that entrypoint or there's something wrong with it. If you can run it locally you should be able to run it on Heroku

Here is our Docker file and docker-entrypoint.sh. I hope this helps. I contributed some of this but not all of it, so I'm not sure why the default ENTRYPOINT is not working for you.

FROM metabase/metabase-enterprise:v1.46.1

COPY docker-entrypoint.sh /app/

RUN ["chmod", "+x", "/app/docker-entrypoint.sh"]

ENTRYPOINT [ "/app/docker-entrypoint.sh" ]
#!/usr/bin/env bash

if [ "$PORT" ]; then
    export MB_JETTY_PORT="$PORT"
fi

/app/run_metabase.sh

Where can I find instructions on how to transition from a buildpack based deployment to a Docker based deployment without losing any data?

Just back up the database and from there do a normal deployment in heroku connecting to the database you have

We just did this. You can keep using the same Heroku app, and push and release a container. It's also possible to seamlessly rollback to the previous buildpack-based release.

Note that we also had to export MB_DB_CONNECTION_URI="$DATABASE_URL" in our custom entrypoint script in the same way that @langsharpe handled the PORT above. Without this, it looks like Metabase initializes a H2 database in the filesystem to store questions in. When Metabase first booted without this, it did so in setup mode as it couldn't find the existing database we'd been using.

Once you've got a custom Dockerfile and entry file as per above, the workflow is basically just heroku container:push web -a your-heroku-app; heroku container:release web -a your-heroku-app and it should just work.