TurboPanel Docs
Architecture

Managed database ingress

TurboPanel managed databases do not publish engine ports on the host. Client SQL (operators, apps, binding-emitted DSNs) always dials a per-server ProxySQL frontend that the daemon configures via managed.ingress.reconcile.

Topology

Diagram will load when scrolled into view
PieceRole
ProxySQLOne compose project per managed server, with configuration under /etc/turbopanel/proxysql/. Inventory: system component managed-ingress, container <serviceId>-in, container role ingress
ListenersHost TCP 15432 (Postgres family) and 13306 (MySQL family)
BackendsEngine containers on the organization's managed Docker network, or private (site) / TurboFabric — or, as a last resort, public — addresses of remote members
UsersNon-replication managed database users resealed for that server — binding-created users included

Replication users never become ProxySQL frontend users.

Names you never have to type

TurboPanel allocates the Docker network that carries managed engine traffic — one per organization — and the ProxySQL compose project on each managed server. Both names are assigned by the platform and are not meant to be typed, guessed, or referenced by an operator: you reach a managed database through its connection details in the app or a binding, and you manage the stack through TurboPanel, not through docker on the host. Nothing on a managed server is expected to carry a human-readable Docker name. The one exception is the self-hosted TurboPanel control plane stack itself, whose compose project stays turbopanel-system because operators do inspect it directly.

External access

One yes/no per server decides how far the ProxySQL listener is published: Allow external access to the databases on this server (stored on the server, default No). One ProxySQL fronts every cluster on a server and has no network-level per-login source rule, so who can reach the listener is deliberately a server-level fact rather than a per-database one. A login can be narrowed further, but only as query rules, after it has signed in (see below).

  • No: the listener is published on 127.0.0.1 only. Sites run by a Hosting Account connect there (13306 for MySQL and MariaDB, 15432 for PostgreSQL); bound containers reach ProxySQL by name over the managed Docker network and need no publish. Nothing off the machine can connect.
  • Yes: the same ports are published on every address of the server (0.0.0.0). Anyone who can reach the server's network can try to connect, and every database on the server is reachable that way. TurboPanel's firewall is a preview only and enforces nothing yet, so restrict access with your cloud or provider firewall.

The root login is limited by source address

Every cluster has a root login (postgres_… / root_…), a full superuser that is registered on the shared ProxySQL like any other login. ProxySQL refuses its queries unless they come from the server itself, its containers or the organization's other servers. In plain words: the root login works for apps and the panel, and tools on a laptop must use a normal login.

How it works:

  • The control plane sends each root login an allowedSources list in managed.ingress.reconcile: the addresses of the organization's servers (public, private network and mesh). The daemon adds its own sources: loopback and every Docker network the ProxySQL container is attached to, translated to address prefixes ProxySQL understands (it matches an exact address or a trailing % prefix, never a CIDR range).
  • ProxySQL gets one query rule per allowed source that lets the query through, then a final rule for that login that answers every other query with "This login is not allowed from this address". The rules are rebuilt on every reconcile, so hand-added rules are lost and a recreated Docker network is picked up.
  • The refusal happens at the first query, not at login: the login still authenticates. Tools that run setup queries when connecting fail right away; others connect and fail on the first statement.
  • Internet clients (IPv4 and IPv6) arrive with their real address. Callers on 127.0.0.1, the host's bridge gateway and containers that dial the server's own public address arrive as the gateway of ProxySQL's Docker network (the docker-proxy effect), so the gateway counts as local. Anything that can arrive as the gateway is allowed to use root.
  • A control plane or daemon that predates the field sends or reads no list, and the root login stays unlimited, as before. The rule starts once both sides are new.

Per-login source limits and connection caps

An ordinary login can carry the same kind of limit as the root login, chosen by its owner (see "Where a login can connect from" in the database guide). It uses the same mechanism and the same helpers:

  • The control plane stores allowedSources on the login (any is stored as nothing). It sends the daemon the resolved list on the login's users[] entry in managed.ingress.reconcile: plain addresses and trailing-% prefixes (a CIDR is translated on save, only where that is exact; server:<id> is resolved to the server's addresses on each reconcile), plus allowLocalSources when "This server only" was chosen, and maxConnections. All three are optional; absent means no rules, as before.
  • The daemon renders, per limited login, one pass rule per allowed source and a final error rule ("This login is not allowed from this address…"). Rule ids come from one sequence per protocol family, lowest first, so every limit sits ahead of the read-split rules; a limited login gets its own ^SELECT reader rule on each pass rule so the split keeps working (not for read-only or database-tool logins, which have a fixed route). fast_forward is never set, because it would skip the rules. maxConnections is the user row's max_connections.
  • The refusal lands on the first query, not at sign-in: the login authenticates, the proxy answers every query from another address with an error. Tools that run queries on connect fail immediately, and some (for example Adminer) show an empty page.
  • "This server only" is loopback plus every subnet of every Docker network ProxySQL is attached to. Callers on 127.0.0.1 and containers on a Docker bridge arrive as the network gateway (the docker-proxy effect), so anything arriving as the gateway counts as local. Internet clients arrive with their real address, and so does a program on the server dialing the server's own public address (canary-checked on both engines): that path is not "local" and needs the server:<id> place, which also lets the server's own programs in.
  • Rules are admin SQL only and are rebuilt on every reconcile: hand-added rules are lost, and removing a limit removes its rules at the next reconcile.
  • Version skew: the control plane sends these fields only to a daemon that lists the managed-login-limits-v1 feature. For an older daemon a source-limited login is left out of that server's payload (it cannot sign in there) instead of being sent unlimited, and a bare connection cap is dropped. The API answers 409 managed_login_limits_need_daemon_update rather than saving a limit that could not be enforced. A daemon that gets none of the fields behaves as before.

The control plane sends the daemon a single bind address (127.0.0.1 or 0.0.0.0) in bindAddresses; the daemon contract is unchanged. A change is queued to the server at once and kept as "waiting" until the server confirms it, then retried automatically if the server was offline. The API is GET/PUT /api/client/v1/servers/{id}/managed-external-access.

Ports and firewall

On each server that hosts a managed member or a placed compose service bound to a managed cluster:

PortProtocolAudience
15432TCPPostgres-family clients through ProxySQL (on 127.0.0.1 unless external access is on)
13306TCPMySQL / MariaDB clients through ProxySQL (on 127.0.0.1 unless external access is on)
127.0.0.1:6032TCPProxySQL admin (loopback only)
45000–45999TCPMember private listeners (replication + remote backends)

Firewall guidance:

  • Prefer datacenter network private CIDRs (and TurboFabric) for server-to-server engine traffic.
  • The root login is refused from outside the organization's servers, but still restrict the listener: when external access is on for the server, restrict 15432/13306 to operator IP ranges in your cloud or provider firewall. TurboPanel's own firewall only previews this listener today and enforces nothing.
  • Engine containers themselves never publish host ports for SQL.

Public replication transport

When a remote read replica shares no trusted datacenter network subnet and no TurboFabric mesh with its primary, the cluster falls back to the public transport — the last rung of the local → datacenter → TurboFabric → public ladder. The datacenter rung picks the lowest-priority shared trusted datacenter network (priority asc, then id); an untrusted shared datacenter network is skipped as if it were not shared. A failover pair whose only shared datacenter networks are untrusted rides TurboFabric over the LAN, and is refused with 422 untrusted_network_needs_fabric when the tunnel cannot carry it, rather than silently falling through (see Datacenter networks):

  • The member publishes its replication/backend listener on one concrete public address at the allocated private port — never 0.0.0.0 and never loopback.
  • TLS is mandatory. The daemon refuses a public listener without Organization CA material, so the engine only ever starts with its Organization CA leaf (SANs include that public IP) and the trust bundle on disk. Postgres accepts the peer through a hostssl replication line scoped to the peer address (/32 or /128); MySQL / MariaDB replication grants carry REQUIRE SSL, so the server enforces TLS regardless of what the standby requests.
  • The daemon additionally installs address-scoped firewall rules that allow only the known peer address(es) to reach that published port and drop everything else. If no stable peer address is known, no rule is installed and no broad fallback is ever added.

See also Deployment security and Self-hosted overview.

Stable client endpoint

Promotion changes the ProxySQL writer hostgroup, never the host or port operators and apps dial. The advertised endpoint stays host:15432 / host:13306 on the placement server (member or bound consumer). There is no DNS or floating-IP primary discovery and no ProxySQL-to-ProxySQL chaining. A promotion can be operator-triggered or, when a dead primary is reported and the safeguards pass, automatic — see Automatic failover.

Lazy placement and teardown

The ProxySQL stack exists on a server only when that server hosts a managed member or a compose service bound to a managed cluster. Emptying a server enqueues managed.ingress.reconcile with clusters: [], which runs docker compose down --remove-orphans. Servers that never had a stack are left untouched.

Rollout: listener port move

Already-running consumer containers keep injected *_PORT=5432/3306 until their next deploy. Binding variables are recomputed in deploy-prepare.ts on every deploy — after this ingress port move, consuming environments must be redeployed to pick up 15432 / 13306. No schema migration is required.

TLS and Organization CA

  • Managed engines default to TLS on; Postgres connection strings use sslmode=verify-full (and MySQL-family equivalents with server verification).
  • ProxySQL frontend certificates are Organization CA leaves. SANs include the advertised listener host (connection details / binding host), bind IP when applicable, and private peer endpoints used as backends — not only synthetic container names.
  • Operators download the Organization CA trust bundle (active + retired) from Connect → Download CA certificate (GET /api/client/v1/tls/ca/download). Trust that bundle on clients; never ship private keys over the client API. Rotation, renewal, and the client-impact checklist live in Organization CA.

Bindings (credentials → compose)

A binding connects a managed database user to a compose service:

  1. The control plane materializes service-scoped variables (host, port, user, password, URL, CA paths) — secret values never reappear on later GETs.
  2. Host/port always resolve to the consuming service’s placement server ProxySQL listener (even when engine members live elsewhere). ProxySQL on that host is reconciled with routes to remote backends over the private path. ProxySQL may also join the consuming environment's spanning network so cross-host consumers resolve it by name.
  3. Binding create/update/delete enqueues managed.ingress.reconcile for the consumer server and cluster member servers so frontend users and servers stay aligned with sealed system user passwords. A binding also writes <PREFIX>_SSL_MODE and, for a container, <PREFIX>_CA_FILE (/run/secrets/<PREFIX>_CA_CERT); a PHP site's CA file is written by the daemon. In the verify-ca and verify-full modes a PostgreSQL URL carries sslrootcert (a container's from the control plane, a PHP site's added by the daemon); a MySQL URL is unchanged. Other variables can read these values with {$db.<prefix>.<field>}, and a Variable Names preset adds the names an app expects. Both read the binding's own values, which point at the server's own database ingress, so they follow a failover. See Reading a database binding from any variable.
  4. Binding create, change and delete are recorded in the organization's audit trail as binding.create, binding.update and binding.delete. An entry names who did it and which binding, never a password or any variable value. Deleting a binding asks the person to confirm it is them first when the organization has turned on that option.

Replicas and failover

ConcernBehavior
PlacementMulti-member clusters walk the local → datacenter → TurboFabric → public ladder between servers; the datacenter rung is the lowest-priority shared trusted datacenter network. Failover replicas never use the public address — an untrusted-only pair rides TurboFabric over the LAN, or is 422 untrusted_network_needs_fabric; only read replicas continue to TurboFabric and then to a TLS-mandatory, address-scoped public listener
Read splitWhen a replica is read_eligible, ProxySQL can route SELECTs to the reader hostgroup
ApplyPrimary managed.apply enqueues immediately; standby applies follow only after primary success (command consumer)
PromoteStop the old primary when its server is online, then promote the replica; the promote command follows the stop. A promote an operator starts continues when the old primary cannot be reached (that member is marked needs_resync); automatic failover refuses instead
Members per serverOne member of a cluster per server (managed_member_exists)
Remove replicaMember stays applying until managed.destroy succeeds; destroy failure leaves the row failed and retryable

Commands

CommandWhoPurpose
managed.apply / .lifecycle / .destroy / .promoteMember hostEngine lifecycle
managed.ingress.reconcileEach server that needs a frontendProxySQL compose, durable cnf, admin apply

HTTP managed routes return command ids immediately; the UI polls Postgres command rows. Dependent follow-ups (standbys, promote after fence, primary re-apply after member destroy) are enqueued by the command consumer on success only.

Edit on GitHub

Last updated on

On this page