Connect from outside
By default only the apps in an environment can reach its Orbit-managed Postgres database.
External access lets you connect to it from your own computer or server, for example with psql, a database client or a migration tool.
It stays closed until you turn it on and name the one address that may connect.
How to get there
Section titled “How to get there”Open the environment’s Data page, choose the Postgres database and open the Access tab.
Before you start
Section titled “Before you start”- Only owners and admins of the organization can use external access. You must be signed in as a person, not use an API token.
- External access may not be enabled for every organization yet. If the Access tab says “External access is not available for this environment”, ask us to enable it.
- Connecting needs a client that uses TLS 1.3 and sends the server name (SNI).
psqland most current drivers do this by default. - You need the database’s certificate authority (CA) file, which you download in Get the connection details.
Turn it on
Section titled “Turn it on”- Open the environment’s Data page, choose the Postgres database and open the Access tab.
- Choose Read only or Read and write, then Turn on external access. Read only is the default. It lets a client read every table in the app database but denies every write and schema change. Choose read and write only if the tool you connect needs to change data.
- Sign in again when asked. Orbit checks that it is really you.
Turning it on does not open anything yet. Nothing outside can connect until you allow an address.
Allow one address
Section titled “Allow one address”- Under Allowed address, choose Allow my current IP, or type an IPv4 address or an IPv6
/64and choose Allow address. - Only one address is allowed at a time. Allowing another one replaces the current one.
- An IPv6 address is allowed as its whole
/64, because many networks change the last part of the address from time to time. The tab shows what was stored.
Some addresses cannot be allowed: private or reserved ones, and the ones Orbit itself connects from. The tab tells you when an address is refused.
The allowed address expires after 90 days and the tab shows the date. Choose Renew before then to keep it, or Remove address to close access right away without turning external access off. When it expires nothing can connect until you allow an address again.
Get the connection details
Section titled “Get the connection details”- Under Credentials, choose Reveal credentials and sign in again when asked.
- Copy the connection URL, or the host, port, database, user name and password.
The host looks like
pg-abcd1234.db.orbit.lustres.devand is random, so it does not reveal your project name. The port is5432. - Orbit does not keep a revealed password on the page after you hide it or leave.
- Choose Download CA certificate and save the file.
Connect with certificate checking on, for example:
psql "postgresql://<user>:<password>@<host>:5432/<database>?sslmode=verify-full&sslrootcert=<path-to-ca-file>"Use sslmode=verify-full with the CA file you downloaded.
Using a database client such as DBeaver or TablePlus
Section titled “Using a database client such as DBeaver or TablePlus”Enter the host, port 5432, database, user name and password from Reveal credentials.
Set the client’s SSL/TLS mode to full verification (often called verify-full).
Point the client’s root or CA certificate setting at the CA file you downloaded.
Connection limits
Section titled “Connection limits”Each connection counts against two small limits: no more than 5 at once from your allowed address and 5 at once for the database login. A tool that opens a pool of more than 5 connections will have some refused.
Change or close access
Section titled “Change or close access”- Change the level. Choose Allow writes or Restrict to read only in the Access level section. Clients that write start getting permission errors when you restrict.
- Rotate the password. Rotate password issues a new one now and ends the open connections that use the old one. Do this if the password may have leaked, then reveal the new one.
- Regenerate the hostname. A new random host is assigned. The old host stops working, so update every saved connection string.
- Turn off. Turn off external access closes it completely. Only apps in the environment can reach the database again. Turning it on later issues a new password.
Turning it on, revealing credentials and rotating the password ask you to sign in again. Turning off and removing the address need no extra sign-in and work at any time.
Every owner and admin of the organization gets an email whenever access is turned on or off, the address changes or the credentials are rotated.
The CA certificate expires
Section titled “The CA certificate expires”The CA file you downloaded is valid for a limited time, and Orbit replaces it before it expires. Orbit emails the owners and admins about 30 days before and again when it is replaced. After a replacement, download the CA file again and update your clients. A client holding the old file will refuse to connect.
Common issues
Section titled “Common issues”- It does not connect. “Reachable from outside” on the Access tab must say Yes, which means access is on and the address is current.
- I am connecting from the wrong place. Check you connect from the allowed address. A different network, a VPN or a mobile connection has a different address.
- My network is IPv6-only. IPv6-only networks cannot connect yet. Use an IPv4 address.
- It is refused after a change. Check you are using the current password and host, and the CA file Orbit gave you.
- The connection fails right at the start with no message. This usually means the address is not allowed, or the client did not send the server name (SNI).
Next steps
Section titled “Next steps”- Databases & caches - add a database and connect it to your app
- Team - who counts as an owner or admin