Search…
Serve Traffic on Multiple Ports
How to setup a service that accepts traffic on two different ports
Release 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.
1
hostnames:
2
- rcon: rcon-${env_id}-${domain}
3
4
services:
5
- name: rcon
6
image: itzg/rcon
7
ports:
8
- type: node_port
9
target_port: '4326'
10
port: '4326'
11
- type: node_port
12
target_port: '4327'
13
port: '4327'
Copied!
By default, Release will ignore the second port and route all HTTP traffic to port 4326. You can work around this limitation by duplicating the service in Release.
1
hostnames:
2
- rcon: rcon-${env_id}-${domain}
3
- websocket: websocket-${env_id}-${domain}
4
5
services:
6
- name: rcon
7
image: itzg/rcon
8
ports:
9
- type: node_port
10
target_port: '4326'
11
port: '4326'
12
13
- name: websocket
14
image: itzg/rcon
15
ports:
16
- type: node_port
17
target_port: '4327'
18
port: '4327'
Copied!
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.
Copy link