← Blog

Private networks between your services

Link two services and they reach each other at a private address, on any port, with nothing open to the internet. A database needs no public port now.

Say you run a small shop on Estiba: the website is one service, its PostgreSQL another. Until today, the shop reached its database the same way you did from your laptop, at an address like ports.estiba.cloud:21450. Since 15 November that worked from any server, wherever each one ran. But it meant the database's port was open to the whole internet, and the only thing keeping strangers out was its password.

For most small projects a long password is enough. Still, a database that only your shop talks to has no reason to answer anyone else. And the way around it, giving each app its own WireGuard tunnel to the other, meant publishing UDP ports, writing keys and listing peers by hand. Nobody should have to do that to connect an app to its own database.

So every service on Estiba now has a private address, and you can link services to each other.

Every service has a private address

Each service gets an address of its own, such as 100.64.0.8. It belongs to the service, not to the server it runs on, so it stays the same when Estiba moves the service to another machine. You'll find it in the service's settings, and once the service is linked to another, also on its page, with a Copy button, and in the services list.

Nobody reaches a service at that address until you link it to another of your services: your apps can't reach each other unless you link them.

Open a service's settings. There is a new section, Network, right below Basics, and its Private network row lists your other services with a box for each. Tick the database in the shop's settings, and the two are linked. It applies at once, with no deployment.

The Network section of a service's settings, with the Private network dialog open and the database ticked

Now the shop reaches the database at its private address, on the port PostgreSQL listens on inside its container, and the database can reach the shop the same way. The connection URL changes from the public address to the private one:

postgresql://app:PASSWORD@100.64.0.8:5432/app

Note the port: 5432, PostgreSQL's own, instead of the public one Estiba gave it. Linked services talk to each other on any TCP or UDP port the app listens on, so a worker can reach an internal API on port 8000 without publishing anything.

Once the shop uses the private address, you can remove the database's public port. It no longer answers from the internet at all. If you still want to open it from your laptop now and then, keep the port; linking and ports work side by side.

If the shop is linked to the database and the database is linked to a reporting job, the shop and the reporting job still can't reach each other. Each service reaches exactly the ones ticked in its Private network row.

Unlinking takes effect at once too, and cuts any open connections between the two.

The app on the other end sees the caller's private address, so a database can tell which of your services connected. A service doesn't reach its own private address; inside it, localhost is still the way.

Turn off the internet for a database

The Network section has another new row, Internet. Untick "It can connect to the internet" and the app can no longer open connections to the internet: it reaches only the services linked to it. Its web addresses and ports still take visits.

That suits a database well. It answers your app over the private network and has no reason to call anywhere else.

The rest of the Network section

The settings used to keep web addresses, ports and WireGuard inside Basics, with WireGuard tucked under the start command. They now have their own card, Network, with a row each: Web addresses, Ports (which used to be called "Other connections"), Private network, Internet and WireGuard. Basics keeps the description, when the app runs and its variables. WireGuard shows its endpoint, so you can see where it connects without opening it.

WireGuard is still there, and still useful, for what is outside Estiba: a database on a server of yours, or your home network. Between your own services, link them instead.

How it works

Each new service takes the lowest free address of a range set aside for private use, so it never clashes with an address on the internet. When a service is deleted for good, its address is free for another one, and its links go with it.

Two linked services reach each other whether they run on the same server or on different ones. Between servers, the traffic is encrypted. When a service moves to another server, open connections to it are cut and its clients reconnect to the same address, the way they would after a restart.

A connection to a private address doesn't wake a sleeping website. If other services depend on one, ask your agent to keep it always on.

What it costs

Nothing. Traffic between services, like all traffic on Estiba, is free; you pay for memory, CPU and disk as before.

Try it

Link two services in the Network section of either one's settings, or tell your AI:

On Estiba, link my app shop to the database shop-db, switch its connection URL to the database's private address, and then remove the database's public port.

Your agent does it with link_services and unlink_services, and can turn off a service's internet when it creates or updates it. For networks outside Estiba, see Private network with WireGuard.

Ask your AI about Estiba

It opens with the question already written. We left a summary just for it, so it answers right and spends few tokens.