Open jessielw opened 1 year ago
I wanted to update this. I've messed around with it for a bit and figured out the issue.
In order to properly host multiple servers easily on unRaid/docker we need to be able to use host
mode AND provide only the BIND
command to control the IP:port
.
This image no matter what always sends the port command. So the command fails to execute.
I've tested this with this repo https://github.com/goofball222/factorio
and it works flawlessly. I can launch as many servers as I want.
If we could just disable the -p
variable and rely on BIND
when it is used, specifically for host mode, then this would work great.
You'll see here I've completely removed UDP port rule in an attempt to just use bind. Which works locally on linux CLI, windows CLI, and on the other docker image provided.
Docker Command:****
docker run -d --name='Factorio3' --net='host' -e TZ="America/New_York" -e HOST_OS="Unraid" -e HOST_HOSTNAME="jlw-unRaid" -e HOST_CONTAINERNAME="Factorio3" -e 'BIND'='192.168.1.5:34201' -e 'PUID'='99' -e 'PGID'='100' -l net.unraid.docker.managed=dockerman -l net.unraid.docker.icon='https://raw.githubusercontent.com/ich777/docker-templates/master/ich777/images/factorio.png' -v '/mnt/cache/appdata/factorio2/':'/factorio':'rw' --restart=unless-stopped 'factoriotools/factorio:stable' 023350a3a2e5b97b0d2455443ea3a2ace97df6e1107cb682d6310f6fe9dc392b
0.000 Program arguments: "/opt/factorio/bin/x64/factorio" "--port" "34197" "--server-settings" "/factorio/config/server-settings.json" "--server-banlist" "/factorio/config/server-banlist.json" "--rcon-port" "27015" "--server-whitelist" "/factorio/config/server-whitelist.json" "--use-server-whitelist" "--server-adminlist" "/factorio/config/server-adminlist.json" "--rcon-password" <private> "--server-id" "/factorio/config/server-id.json" "--bind" "192.168.1.5:34201" "--start-server-load-latest"
Notice --port is still being sent?
Error:
1.835 Error CommandLineMultiplayer.cpp:121: Setting both --port and --bind with port is dumb and you should not do it.
I use host mode primarily so I can access the games via the LAN.
But I also do some changes at pfSense.
Here is my docker-compose template
version: '2.2'
services:
factorio:
image: "factoriotools/factorio:${LATEST}"
mem_limit: 16G
restart: unless-stopped
environment:
- PORT=${GAME_PORT}
- RCON_PORT=${RCON_PORT}
- UPDATE_MODS_ON_START=true
container_name: "${CONTAINER_NAME}"
volumes:
- ./volume:/factorio
- ../scenarios:/factorio/scenarios
stdin_open: true
tty: true
entrypoint: ["/docker-entrypoint.sh"]
network_mode: host
I set the variables for those shown above, as I run 6 different servers all based on a single YAML template.
In pfSense, I have a NAT rule for factorio's game (not RCON) ports, and then set up NAT outbound and 1:1
I also have multiple static IPs to my house, plus my DHCP.
I can completely run 1 server perfectly on the default port 34197. I forward the port/set the outbound rules. It's in the server browser, instantly works, connects, as well as with direct IP.
When I attempt to run another container by adjusting the ports with a new set of port forwards/rules in pfsense for ports 34201 it does not work.
Changing
-p '34201:34197/udp'
allows me to direct connect through IP but I cannot connect via the browser. Reading the documentation, you can also use-e 'PORT'='34201'
to change the games UDP port. As as I do this, I can no longer connect at all what so ever, direct/browser. Even though it does show in the browser.I get erros in the logs such as
1.742 Warning ServerRouter.cpp:527: Received own address message reply with conflicting address (got IP ADDR:({x.x.x.x:42370}), expected IP ADDR:({x.x.x.x:24345})) 1.742 Warning ServerMultiplayerManager.cpp:643: Determining own address has failed. Best guess: IP ADDR:({x.x.x.x:24345}) 1.825 Warning ServerRouter.cpp:527: Received own address message reply with conflicting address (got IP ADDR:({x.x.x.x:54553}), expected IP ADDR:({x.x.x.x:24345})) 1.875 Warning ServerRouter.cpp:527: Received own address message reply with conflicting address (got IP ADDR:({x.x.x.x:47326}), expected IP ADDR:({x.x.x.x:24345}))
I've spent quite a long time on this, attempting to change ports, rules etc. Seems like no matter what as soon as I adjust that UDP port it breaks.
I'm running this in net bridged mode.