Metabase configuration file for repeatable deployments

A config.yml lets a self-hosted Metabase Pro or Enterprise instance start with its users, databases and settings already defined, so rebuilds match. The trade-off is that the file wins over UI changes on every restart.

On this page

When a Metabase config file makes deployments repeatable

A platform team that has to rebuild, copy or promote a self-hosted Metabase usually wants the same users, database connections and settings every time, without someone clicking through the admin screens again. On self-hosted Pro and Enterprise plans, Metabase can initialize on launch from a configuration file, so the instance is shaped by a file your team can version and review. The open source and Starter plans are not covered by this capability, so confirm your plan before you design a process around it.

The file is organized into three sections: users, databases and settings. Metabase reads a config.yml or config.yaml file placed in the same directory as the JAR, or at the path set by MB_CONFIG_FILE_PATH if you keep configuration elsewhere. Treat the file as an ongoing initialization and enforcement mechanism rather than a one-time import. On each restart, the file overwrites changes made to those same settings in the UI, so anyone who edits a managed setting in the admin panel should expect that change to revert. Decide early which settings the file owns and which remain open to administrators, and document that split for your admins.

Before you rely on the file in production, confirm with Metabase how it handles secrets such as database passwords and how it treats fields it does not manage, and test a full restart in a non-production instance. Keep the file in version control and review changes like any other infrastructure code. Metabase configuration file documentation lists the supported keys for each section, which is the reference your reviewers should check against.

Config file sections and environment variables compared

This table compares the config file sections (users, databases and settings) with settings defined by environment variables, by what each defines and whether Admin settings can change it. Read it as a rule set: a config file value is overwritten on each restart if someone changes it in the UI, while an environment variable value cannot be changed in Admin settings at all. Confirm exact key and variable names in Metabase's configuration docs before writing your files.

ItemConfig fileEnvironment variables
What it definesUsers, databases and instance settings, applied when Metabase initializes on launchIndividual settings that Metabase reads at startup from the process environment
Available onPro and Enterprise self-hosted plans onlyConfiguration mechanism for self-hosted Metabase; confirm which variables your edition and plan accept
Can Admin settings change it?NoSettings defined this way cannot be changed in Admin settings
What happens when the UI changes itThe config file overwrites the UI change on each restartNot applicable, because the UI cannot change the value
Where it is read fromconfig.yml or config.yaml in the JAR's directory, or the path set by MB_CONFIG_FILE_PATHThe container or service environment that starts the JAR
Best fitRepeatable setup of users, databases and settings across new or rebuilt instancesInfrastructure values such as connection details that your deployment tooling already manages
Main riskAdmins change a setting in the UI, then lose it silently on the next restartAdmins look for a setting in the UI, cannot find it, and need a redeploy to change it
Keep in version control?Yes, with secrets referenced rather than stored in plain text, following your secrets policyYes, as deployment manifests, with secret values injected from your secrets store

Setting up a config file for a new Metabase instance

This sequence takes a new self-hosted Metabase from first start to a verified instance where users, databases and settings come from a config file. The result is a deployment you can rebuild and check the same way each time.

  1. Confirm the plan supports config file initialization

    Before writing anything, confirm with your Metabase account team or the pricing page that your self-hosted deployment is on the Pro or Enterprise plan. Initialization from a config file is available only on those plans, so an Open Source or Starter instance cannot follow the rest of this sequence. Record the plan and the Metabase version you intend to run so the file matches that release. The step is done when you have written confirmation of the plan and a chosen version.

  2. Choose and provision the application database

    Metabase stores its own configuration and content in an application database. Metabase ships with an embedded H2 database for demos and recommends PostgreSQL for production, so the platform or database team should provision a PostgreSQL instance in your infrastructure and create a dedicated database and role for Metabase. Confirm the supported database versions against the application database documentation before you provision. The step is done when Metabase can connect to the empty database with credentials held outside the config file.

  3. Decide where the config file lives

    Metabase looks for a config.yml or config.yaml file in the directory that holds the JAR, or at the path set by the MB_CONFIG_FILE_PATH environment variable. Put the file in the JAR directory for a simple single-host install, or set MB_CONFIG_FILE_PATH when your deployment mounts configuration from a fixed location, such as a container volume or a managed secret mount. Make sure the Metabase process account can read the file and that it is not writable by users who should not change access. The step is done when the chosen path is written in your deployment runbook and tested with a dummy file.

  4. Write config.yml with users, databases and settings

    Write the file with three sections: users, databases and settings. Keep secrets such as database passwords and initial admin credentials out of plain text where your deployment tooling allows it, and check the configuration file documentation for the exact keys and how each section is read. Store the file in version control with the secrets referenced, not inlined, so changes are reviewed. The step is done when the file validates against the documented structure and a peer has reviewed it.

  5. Start the instance and let it initialize

    Start Metabase with the application database settings and the config file path in place. On launch, Metabase reads the file and creates the listed users, connects the listed databases and applies the listed settings. Watch the startup logs for errors that mention the config file, the database connection or the user list, and fix any problems before continuing. The step is done when the instance is running and the logs show a successful start with no configuration errors.

  6. Verify users, databases and settings in Admin

    Sign in as an administrator and check the Admin settings against the file. Confirm that each expected user exists with the right group membership, each database connects and syncs, and each setting shows the configured value. Compare the list against your file line by line rather than relying on a visual check. The step is done when every item in the file is visible in Admin with the value you wrote.

  7. Restart and confirm the configuration holds

    Restart the Metabase process without changing the file. Repeat the Admin checks and confirm that users, databases and settings still match, and that no duplicate users or databases were created. This confirms the file is idempotent for the deployment. The step is done when a second check after restart matches the first one exactly.

  8. Test that a UI change is reverted on restart

    Pick one setting that the file controls, change it in the Admin UI to a different value, then restart Metabase. The Metabase configuration file documentation states that the file overwrites UI changes to those settings on each restart, so the value should return to the file value. Record the test, and note that settings driven by environment variables cannot be changed in Admin at all, so set your team's expectations for both sources. The step is done when the reverted value is confirmed and your runbook states which settings are owned by the file and which are owned by environment variables.

How the config file and UI changes interact at startup

Metabase reads its config file when it starts, whether the file sits beside the JAR or at the path set by MB_CONFIG_FILE_PATH. The file's users, databases and settings are applied on every restart, so a value changed in the Admin settings for the same key is overwritten the next time Metabase starts. Settings supplied as environment variables follow a separate path and cannot be changed from Admin settings at all. Before you rely on either route, confirm which settings your instance takes from each source.

Illustrative of the documented startup behavior for config file and environment variable settings.

Where UI changes collide with the config file

A config.yml makes a Metabase deployment repeatable, but it also decides which settings the Admin screens can change. The cards below cover the places where UI edits, environment variables, secrets, plan limits and upgrades can quietly disagree with the file, and what to check in your own environment before relying on it.

UI edits get reverted

The config file overwrites changes made to its users, databases and settings sections each time Metabase restarts. An admin who changes a database connection, a setting or a user in the Admin panel may see that change disappear after the next restart, container replacement or node rollout. Before go-live, list every setting the file manages, decide who may change each one, and test a restart after a deliberate UI edit to confirm the behavior in your own environment.

Configuration file docs

Environment variables lock settings

Settings defined by environment variables cannot be changed in the Admin settings screens. Teams that expect to adjust a value in the UI may find the field locked because a container variable or deployment manifest already sets it. Review the environment block of your deployment and the config file together, so each setting has one owner. Confirm which setting names your version exposes as read-only before you hand admin access to a wider group.

Plain text secrets in config

Database passwords, SSO client secrets and similar values written directly into config.yml sit in plain text in the file and in any repository, backup or artifact that holds it. Check whether your deployment pipeline can inject these values from a secrets manager at startup, and limit file read access to the Metabase service account. Keep the file out of version control when it contains credentials, and rotate any secret that has ever been committed.

Drift between file and instance

The config file describes the intended state, but the live application database can hold different values after manual changes, failed restarts or partial rollouts. Two instances started from the same file may still differ if one has an older application database or extra UI-made content. Compare the running settings, users and database connections against the file after each deployment, and record which instance is the source of truth for each section.

Plan-gated features assumed configured

Some identity and access features require a Pro or Enterprise plan, including SAML, JWT, OIDC, advanced LDAP group sync and SCIM provisioning. A config file can list these settings, but on a plan that lacks them the features will not work as your design expects. Confirm the plan that will run each feature before writing its section, and check the pricing page for the plan boundaries, since the Starter plan does not include SSO.

Metabase pricing page

Upgrades that change behavior

A new Metabase release can change how a setting is read, which keys are accepted and how the application database migrates. A config file that worked on one version may need edits, or behave differently, after an upgrade. Keep the file under version control with the release it was tested against, test it on a copy of the application database, and back up the application database before upgrading, as the upgrade documentation recommends.

Upgrading Metabase docs

Why the application database matters for repeatable rebuilds

A config file can initialize a fresh Metabase instance, but it does not protect the content and state that live in the application database. The application database is the part of the deployment you must back up and plan around, because users, saved questions, dashboards and permissions are stored there, and a rebuild from configuration alone will not recreate them. Metabase ships with an embedded H2 database, which suits demos and evaluation. For production, Metabase recommends PostgreSQL, and it also supports MySQL 8.4.0 or MariaDB 10.6.0 and later, with the utf8mb4 character set. Confirm the exact database versions your chosen Metabase release supports in the application database documentation before you commit to a platform.

If your instance still runs on H2, move it off before you rely on repeatable rebuilds. Metabase documents a one-time load-from-h2 command that copies the H2 application database into PostgreSQL or MySQL. Run it with the same Metabase version that last updated the H2 file, or the migration can fail or leave the data in an unexpected state. Plan this as a discrete change: take a copy of the H2 file, perform the load into a new target database, start Metabase against it, and verify that content and permissions appear as expected before you retire the old file. Record the Metabase version in your change log so the next engineer knows which build the migration depended on.

Once the application database is on PostgreSQL or MySQL, your backup schedule becomes the real recovery mechanism, and the config file becomes the record of intended setup. Decide who owns each layer: the config file in version control for users, databases and settings, and database backups for everything users have built. Ask your DBA or platform team to confirm restore tests against a non-production copy, not only that backups complete. Expect that a restored application database will carry its own state, so the config file should be treated as a source of truth for setup only, with the understanding that UI changes overwritten on restart are a separate governance question.

Securing config.yml and the instance it creates

A config.yml file can create admin users, connect databases and set instance settings on every restart, so it carries the same weight as the credentials it references. The cards below cover where the file lives, who can edit it, how secrets reach it, and how to review what it creates before and after each change.

Keep credentials out of source control

If a config.yml holds database passwords, API tokens or initial admin passwords, a commit to a shared repository exposes them to everyone with read access and to every clone that follows. Keep the file in a deployment repository only when its secret values are placeholders or references, and check the history of any repository that has already received a real value. Confirm that your version control system's ignore rules and pre-commit scanning cover the file name you use, such as config.yml or config.yaml.

Configuration file docs

Restrict file permissions on the host

Metabase reads the file from the JAR's directory or from the path set in MB_CONFIG_FILE_PATH, so the service account that runs Metabase needs read access and nobody else on the host should. Set the owner and mode so that only the operator account and the Metabase service user can read the file, and confirm the same rule applies to any backup or copy of it. Check the permissions after each provisioning run, because a file recreated by a script often inherits looser defaults.

Inject secrets from your secret store

Where your standards require secrets to live in a managed store, render the values into the config file at deploy time or mount the file from a secret volume, rather than typing values into a file kept on disk. Confirm which of your deployment tools can write the rendered file to the path Metabase reads, and that the rendered copy is removed or rotated when the secret changes. Test a rotation in a non-production instance first, since a config file that is re-read on restart will apply the new value.

Limit who can change the file

Because the config file overwrites matching settings made in the Metabase admin UI on each restart, a single unreviewed edit can reverse a security setting that an administrator changed by hand. Decide which role owns the file, route changes through the same review path as other infrastructure code, and make the UI-managed settings explicit so administrators know which values will be reset. Keep a record of who approved each change to users, databases and settings.

Back up the application database first

Applying a changed config file can create users, alter databases and rewrite settings in the application database, and those changes are hard to reverse by hand. Take a backup of the application database before each run that changes the file, and record which config version was applied alongside it. Confirm with your database team how the backup is taken and how long a restore takes, since the restore is your rollback path.

Application database docs

Review users and group assignments

The users section can create accounts and place them in groups at launch, so a copied entry can grant an unintended admin role or give a contractor access to a sensitive database. Compare each user and group assignment in the file against your approved access list before deployment, and check the result in the admin panel after the first start. Ask your identity team whether accounts defined in the file should be the long-term source of truth or a bootstrap for a single-sign-on setup.

How config files fit into Metabase upgrades and rollback

Treat the config file as part of the upgrade change set, not as something that survives an upgrade untouched. Metabase runs application database migrations automatically when a newer JAR starts, so the database schema moves forward whether or not the config file has been checked against the new version. Before any upgrade, back up the application database, since the upgrading documentation recommends this step first. If the instance is a cluster, reduce it to a single node for major upgrades because of the migration lock, and if the current version is older than 40, move through each release in order rather than jumping straight to the newest JAR.

Rollback has two documented paths. The recommended path is to restore the pre-upgrade application database backup and start the older JAR with its matching config file. The second path is running the migrate down command with the newer JAR, which reverses schema changes but depends on the migration tooling working cleanly, so it is the less predictable option. Whichever you choose, make sure the config file that goes with each version is kept in version control, because a restart applies the config file again and overwrites UI changes to the settings it manages.

Re-test the config file against each new version in staging before production. Start a copy of the production application database backup with the target JAR and the same config.yml, then confirm that users, databases and settings load as expected and that no setting has been renamed or dropped in the release notes. Confirm the support window for your current and target versions on the version support page before you schedule the change, and record which config file revision was live at each version so a rollback restores both the database and the matching configuration.

Questions buyers ask about Metabase config file deployments

Is the Metabase config file available in Open Source or Starter?

No. Metabase documents initialization from a config file only for self-hosted Pro and Enterprise plans. On Open Source and Starter, you configure the instance through the admin UI and environment variables. Pro and Enterprise also unlock SSO, row and column level permissions, and usage analytics and auditing, which are not available on Open Source or Starter. Check current plan contents on the Metabase pricing page before you commit, since plan details and prices change.

What does it cost to set up a config file deployment?

Your cost has two parts: the Metabase license for a Pro or Enterprise plan, and the services work to build the configuration. Licensing is a recurring cost. Pro is listed at $575 per month, or $517.50 per month billed yearly, with the first 10 users included, and Enterprise is priced by quote starting at $20,000 per year, according to the Metabase pricing page. Services effort depends on how many databases, users, groups and settings you define, how many environments you run, and how your secrets are stored. Ask any provider for a written scope that lists each of those items separately.

How long does a first config file build take?

Duration depends on scope, and no fixed figure applies to every organization. A small instance with one database and a few groups moves quickly. Time grows with the number of data sources, the identity provider design, the number of environments (for example, development, staging and production), and how many settings must match an existing standard. Reviews by your security and compliance teams add time, as do upgrade and rollback tests. Ask for a timeline tied to written deliverables and a list of decisions that must be made before the build starts.

What must our team provide before a config file build starts?

Plan the following decisions and inputs before the build begins:

  • The Metabase plan and license key handling for each environment.
  • The application database, which Metabase recommends running on PostgreSQL for production.
  • Identity decisions, including which sign-in method, group mapping and user provisioning approach you will use.
  • The list of data sources, their connection details and the service accounts that will reach them.
  • Where secrets live and who can read them, so passwords and keys stay out of files stored in version control.

Clarifying these early reduces rework when the config file overwrites settings on restart.

Can our internal team set up a config file deployment alone?

Yes, if your team has administrators comfortable with Metabase, container or JAR deployment, and your secrets tooling. The config file documentation describes the sections and the load-on-launch behavior, so an experienced platform engineer can build a working file. Risk rises when the team has not tested restarts, has no environment promotion path, or must reconcile UI changes already made in production. Environment variables cannot be changed in Admin settings, so mixing both methods needs a clear ownership model. Decide who owns the file, who reviews changes and how emergency fixes are recorded.

When is it worth hiring a partner for a Metabase config file deployment?

Hire a partner when the deployment must pass a formal security or compliance review on a tight schedule, when several environments must match, or when your team lacks time to test upgrades and restores. DeployOpen plans, implements, hardens, backs up, upgrades, documents and supports self-hosted open-source platforms inside your own infrastructure, and most engagements are fixed-scope with scope, deliverables and timelines agreed in writing before work starts. DeployOpen does not issue audit reports or certifications. Independent auditors and certification bodies do that work, and DeployOpen prepares the systems and evidence they review.

What goes wrong when UI changes collide with the config file?

Each restart reapplies the settings in the config file, so UI changes to those same settings are overwritten. Teams that edit users, databases or settings in the admin panel without updating the file lose those edits on the next restart. Settings defined by environment variables cannot be changed in Admin settings at all, which can confuse operators who expect to adjust them there. Set a rule that the file is the source of truth for managed settings, and document which settings remain editable in the UI.

Official Metabase documentation on configuration

Start with the configuration file reference before you write your first config.yml. It sets out the sections the file supports (users, databases and settings), how the file is found at launch, and the rule that matters most for repeatable deployments: on each restart, the config file overwrites changes made to those settings in the UI. Read it with your admin team so everyone agrees which settings live in the file and which stay editable in the Admin settings. The file is available on self-hosted Pro and Enterprise plans, so confirm your plan before planning a file-driven rollout. The Metabase configuration file documentation is the natural next read for the exact keys and load behavior.

Before you commit to a plan tier, read the current pricing page side by side with the configuration documentation. Pricing lists four plans (Open Source, Starter, Pro and Enterprise), and the file-based initialization is tied to the self-hosted Pro and Enterprise plans, so the tier you pick determines whether this deployment method is open to you. Ask your Metabase account contact or the pricing page to confirm which features are included at the tier you are considering, and get the Enterprise quote in writing if that is your path. Pricing changes over time, so record the date you checked and the plan terms you relied on. The Metabase pricing page is where to start that comparison.

How DeployOpen scopes and delivers Metabase configuration work

DeployOpen starts by mapping which settings, users and databases belong in a config file and which stay under UI control. We then build, test and document the file-driven setup inside your own infrastructure so each deployment can be repeated with the same result.

How we scope

  • Inventory the users, databases and settings you want initialized from config.yml and the plan edition they run on.
  • Agree which settings stay UI-managed, since config file values overwrite UI changes on each restart.
  • Confirm the written, fixed scope, deliverables and timeline before any build work starts, with ongoing support available as a retainer.

How we build

  • Write the config file and set MB_CONFIG_FILE_PATH so the file loads on launch in your environment.
  • Move environment-only settings out of the admin UI path and document which ones cannot be changed there.
  • Test repeat launches on a non-production instance to confirm that edits to the file produce the expected state.

How we hand over

  • Deliver the config file, environment variable list and a runbook describing each section and its ownership.
  • Document which UI changes will be reverted on restart and the change process your team should follow.
  • Walk your platform and analytics owners through the deployment so they can repeat it without DeployOpen.

How we support

  • Review the config file alongside each Metabase upgrade, backing up the application database first.
  • Offer retainers for ongoing maintenance, continued testing and upgrades when your team wants a partner in place.
  • Confirm with your team which Metabase edition and plan your config file depends on before each change.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.