Check that /api/setup already happened

Hey everyone!

I have an Ansible Playbook to set up my Metabase installation, which is working fine already. Now I found out about the /api/setup endpoint and I thought it would be a nice addition to it.

Question is: how can I check that it is not the first time running the playbook (which is already used to update the installation as new versions are released), meaning the first installation already happened and therefore there is no need to call /api/setup again?

Alternatively, how could I check that it is the first time and it needs running? Either would be fine by me.

I would have in mind either:

  1. Check something in the Metabase database (some table exists, or some record in some table, or both).
  2. Use some endpoint, such as /api/session or /api/setup/validate.
  3. Check that the API server is listening on port 3000.

Thanks.

check my scripts here https://github.com/paoliniluis/metabase-cube/tree/main/setup

Thanks for your reply, Luiggi.

So, basically, if I understood your code correctly, upon installation (Docker container creation) what you are doing is waiting for the health check via /api/health to return 200 OK, then you run the setup via /api/setup.

That sounds fine by me in your scenario, but yours is a one-time shot (building the container), whereas mine is executed every time I need to upgrade the Metabase version, not just installing from scratch.

Or am I missing something?

Incidentally, I have not been able to find the /api/health endpoint in the documentation of the API. :thinking: