Skip to main content
A project can have several gateways. All of them enforce the project’s one policy and share approvals and taint: an agent tainted on one is tainted on all.

Another network or region

When a database lives where your first gateway can’t reach it, run a second gateway there: Gateways, Set up another gateway, and run its commands in that network.
  • Its command names every database of the project, and setup asks for each one’s connection string. Press Enter to skip one it can’t reach, or add one the project doesn’t have yet.
  • A database can be served by more than one gateway. Give its connection string to each gateway’s setup.
  • An agent connects to one gateway. For databases behind two, add each gateway to the agent as its own MCP server and sign in to each.

Replicas

For availability, run several processes of one gateway behind one URL of your own, or two behind the relay. They share one identity (enroll once with midplane enroll, as on platforms without a disk), and each keeps its own audit file. A new enrollment token always makes a new gateway, so don’t use one for a replica. Behind the relay, each process also keeps its own certificate, so give each a disk of its own. More in linked mode.

Adding databases

1

Add it in the dashboard

+ Add database under Databases, with its id.
2

Add it to the gateway's config

Add a line under databases: that names a file for the connection string, then write the string to that file:
A gateway set up from environment variables (in Docker behind the relay, or on a platform) has lines such as shop: { dsn: { env: MIDPLANE_DSN_SHOP } }. Copied with the id changed, such a line names a variable the container doesn’t have, so name a file instead, as above.In Docker, the config and the secrets are in the gateway’s volume. Write from standard input, so the connection string stays off the command line: run docker exec -i midplane-gw-… sh -c 'umask 077 && cat > secrets/billing.dsn', paste the string, and press Ctrl-D. Then run docker exec -i midplane-gw-… sh -c 'cat >> midplane.yaml', paste the new line, and press Ctrl-D: the config setup writes ends with its databases: list, so the line joins it.
3

Restart the gateway

On your computer, stop it with Ctrl-C and start it again; in Docker, run docker restart midplane-gw-…. It reads the new database’s tables, and the policy editor shows them.
To keep the new connection string in a variable instead, as the others are, add MIDPLANE_DSN_BILLING where the gateway’s variables live, add a line under databases: that names it, and restart the gateway so it reads both:
A new MIDPLANE_DSN_ variable alone does nothing once the gateway has set itself up. In Docker, docker restart doesn’t read the env file again: remove the container and run its command again, as in upgrading. Each platform’s page says where its variables live. If you change the config first, the gateway still starts: on Gateways its line reads billing · in its config, not in this project. Add beside it adds the database with its id filled in, and the gateway sends its tables within seconds.