Network
Ports: TCP and UDP beside HTTP
An app's web replicas can publish raw TCP and UDP ports on their servers, for what isn't HTTP: a game server, MQTT, SMTP, SIP, a database of its own.
Setting them
The app's Settings tab (Ports), PUT /api/apps/{id}/ports with the whole
list, or ports in a stackd.toml (Config as code):
[
{ "host_port": 25565 },
{ "host_port": 2525, "container_port": 25, "allow": ["203.0.113.0/24"] },
{ "host_port": 27015, "protocol": "udp" }
]host_portis published on every server running one of the app's web replicas, on all its addresses;container_port(the host port when omitted) is where it goes in the container. Clients reach any of those servers' addresses: point a DNS record at them, as for a domain.protocolistcp(the default) orudp.allow, TCP only, limits it to these addresses and CIDRs; empty is anyone. It applies on every server at once, like databases' external access (Databases).
A host port and protocol is one app's across the fleet. Ports stackd uses on every server are refused: 22, 80, 443, 51820/udp, 5443, 7080, 7090, 8080, 9090, and the ranges its databases, volumes and load balancing take (3306–3405, 13306–13405, 13900–13999, 15432–15531, 16800–16899, 22100–22199, 22379–22478, 23306–24305, 24379–24480, 26379–26478, 30000–32767). Other processes on the server using the port make the replica fail to start, with Docker's reason.
Changes are published at the next deploy; the allowlist applies at once.
Deploys
An app with ports has its web replicas replaced stop-first rather than overlapping, since a port can't be held by the old replica and its replacement at once. Expect a few seconds without the app on each server on a deploy; HTTP to it through its domains is interrupted the same way. Apps without ports are unchanged.