I want my metabase DB with all the reports to deploy to different environments. Let's say DEV, TEST, PROD.
That means I need to configure the base url of all drill through column links according the environment.
I would expect that we can read environment variables in metabase to solve this goal but I cannot find any documentation about this option.
What are the solution or best practice options for this common deployment requirement, please?
Many thanks for any discussion.
There isn't a setting/variable for adjusting the base URL. You would need to either include the host as part of your results, or do a search-replace in the Metabase application database for the different environments, or search-replace the yaml files in https://www.metabase.com/docs/latest/installation-and-operation/serialization.
the serialization yaml replacement is an option for the pro+ versions. For now, I'm looking into how to do without this extra support.
Thinking about Your DB search/replace hint:
One option could be that the metabase query makes a join with a table that contains the correct url field according the environment. This sounds quite simple for me.
Maybe another option is to "tag" the column link URL with a custom keyword like #dev#
so the complete link entry would be for example: #dev#/question/my_question?serialNumber=100001
Then, after metabase DB upload to the new DB instance, a set of API call would replace the #dev# keyword with the concrete value.
I've not looked into the APIs yet to evaluate this option, so just thinking.
@Dave2 It would be much easier to do a search-replace in the application database after something as simple and specific like this, compared to try to do some API replacement. But there's several solutions for this, though not exactly what you were looking for.
@flamber I assume with application database you mean the metabase application database that contains all the report definitions. So you are targeting the second option using the #dev# tag in the URL and then replacing it with the real value via SQL instead of APIs. Right? Yes, this looks simpler.
@Dave2 Yes, https://www.metabase.com/docs/latest/installation-and-operation/configuring-application-database. You would look in the tables
report_dashboardcard too) for the replacement string.
@flamber thanks for the insights.
Hi all, want to update this topic with the solution.
At the end there no such an issue I've ask in this topic.
The link to any sub query you provide in the "Link URL" in the "Table options",
Need not to contain the base-url.
The base-url is automatically added to your link from what is configured in
/admin/settings/general under SITE URL