Search…
⌃K
Links

Serve traffic on multiple ports

How to setup a service that accepts traffic on two different ports
ReleaseHub currently only supports serving HTTP traffic from the first port defined by your service. In the following example, the service RCON listens on port 4326 for the web user interface, and port 4327 is used for websocket traffic from the web application.
hostnames:
- rcon: rcon-${env_id}-${domain}
services:
- name: rcon
image: itzg/rcon
ports:
- type: node_port
target_port: '4326'
port: '4326'
- type: node_port
target_port: '4327'
port: '4327'
By default, ReleaseHub will ignore the second port and route all HTTP traffic to port 4326. You can work around this limitation by duplicating the service in ReleaseHub.
hostnames:
- rcon: rcon-${env_id}-${domain}
- websocket: websocket-${env_id}-${domain}
services:
- name: rcon
image: itzg/rcon
ports:
- type: node_port
target_port: '4326'
port: '4326'
- name: websocket
image: itzg/rcon
ports:
- type: node_port
target_port: '4327'
port: '4327'
This workaround requires your application container to be stateless, and you will need to configure your environment variables to let the web UI know which URL to talk to for websocket traffic. See Environment Variables for more information about environment-specific environment variables.