OpenFactorioServerManager / factorio-server-manager

A tool to help manage Factorio multiplayer servers including mods and save games.
MIT License
541 stars 130 forks source link

RCON port generated randomly when defined in conf.json #289

Open lipowskm opened 2 years ago

lipowskm commented 2 years ago

So I saw there was a pull request for that, but the RCON port is still randomly generated for me.

I added "rcon_port": xxxxx in conf.json, tried restarting the service a few times and still no luck. Is there something I'm doing wrong or is this feature still not working?

mroote commented 2 years ago

Thanks for reporting the issue, I'll see if I can reproduce the port not getting set to whats configured in the config file.

Mattie112 commented 2 years ago

Hi,

I have a /opt/fsm-data/conf.json in the container that contains the following:

{
        "rcon_port": 34198,
        "rcon_pass": "xx",
        "sq_lite_database_file": "/opt/fsm-data/sqlite.db",
        "cookie_encryption_key": "xx+xx=",
        "settings_file": "server-settings.json",
        "log_file": "/opt/fsm-data/factorio-server-manager.log",
        "secure": false
}

I am expecting the RCON port be: 34198 but when starting the server I see:

5.829 Info RemoteCommandProcessor.cpp:130: Starting RCON interface at IP ADDR:({0.0.0.0:42723})

Is my config correct?

Mattie112 commented 2 years ago

I also see an env var mentioned (https://github.com/OpenFactorioServerManager/factorio-server-manager/blob/develop/src/bootstrap/config.go#L27)

root@f6406466fc9e:/opt# env | grep -i rcon
FSM_RCON_PORT=34198
RCON_PASS=
root@f6406466fc9e:/opt#

But this still seems to use a random port

edit:

2022/01/25 19:11:22 Starting Factorio server with settings: {"bindip":"0.0.0.0","savefile":"Load Latest","port":34197}
2022/01/25 19:11:22 Starting server with command: /opt/factorio/bin/x64/factorio [--bind 0.0.0.0 --port 34197 --server-settings /opt/factorio/config/server-settings.json --rcon-port 42469 --rcon-password xxxx --server-adminlist /opt/factorio/config/server-adminlist.json --start-server-load-latest]
2022/01/25 19:11:22 new state, will also send to correct room
2022/01/25 19:11:22 Factorio Server: 0.000 2022-01-25 19:11:22; Factorio 1.1.53 (build 59373, linux64, headless)
2022/01/25 19:11:22 Factorio Server: 0.000 Operating system: Linux
2022/01/25 19:11:22 Factorio Server: 0.000 Program arguments: "/opt/factorio/bin/x64/factorio" "--bind" "0.0.0.0" "--port" "34197" "--server-settings" "/opt/factorio/config/server-settings.json" "--rcon-port" "42469" "--rcon-password" <private> "--server-adminlist" "/opt/factorio/config/server-adminlist.json" "--start-server-load-latest"
knoxfighter commented 2 years ago

You did everything correctly. That is a bug in the log-manager :(

Mattie112 commented 2 years ago

For funs I tried downloading the source (on windows), couldn't compile the go part (gcc required), started WSL and compiled it from there.

I now have a src/conf.json file:

{
    "rcon_port": 12345,
    "rcon_pass": "xx",
    "sq_lite_database_file": "sqlite.db",
    "cookie_encryption_key": "xx=",
    "settings_file": "server-settings.json",
    "log_file": "factorio-server-manager.log",
    "secure": false,
    "port": 123456,
    "autostart": "true"
}

And yeah WHY is it working now? Perhaps somekind of Linux issue?

matthijs@MATTIE-PC:/mnt/c/Users/Matthijs/GolandProjects/factorio-server-manager/src$ ./factorio-server-manager
2022/01/25 20:32:40 Max upload: 2000000
2022/01/25 20:32:40 Conffile: ./conf.json
/mnt/c/Users/Matthijs/GolandProjects/factorio-server-manager/src/mod_packs
2022/01/25 20:32:40 Loaded Factorio settings from config/server-settings.json
2022/01/25 20:32:40 Starting server with command:  bin/x64/factorio [--bind 0.0.0.0 --port 34197 --server-settings config/server-settings.json --rcon-port 12345 --rcon-password xxx--server-adminlist config/server-adminlist.json --start-server-load-latest]
2022/01/25 20:32:40 new state, will also send to correct room
2022/01/25 20:32:40 Starting server on: 0.0.0.0:12346
2022/01/25 20:32:41 Factorio Server:    0.001 2022-01-25 20:32:41; Factorio 1.1.53 (build 59373, linux64, headless)
2022/01/25 20:32:41 Factorio Server:    0.028 Operating system: Linux (Ubuntu 20.04)
2022/01/25 20:32:41 Factorio Server:    0.028 Program arguments: "bin/x64/factorio" "--bind" "0.0.0.0" "--port" "34197" "--server-settings" "config/server-settings.json" "--rcon-port" "12345" "--rcon-password" <private> "--server-adminlist" "config/server-adminlist.json" "--start-server-load-latest"
2022/01/25 20:32:41 Factorio Server:    0.029 Read data path: /mnt/c/Users/Matthijs/GolandProjects/factorio-server-manager/src/data
2022/01/25 20:32:41 Factorio Server:    0.029 Write data path: /mnt/c/Users/Matthijs/GolandProjects/factorio-server-manager/src [24085/952881MB]
2022/01/25 20:32:41 Factorio Server:    0.032 Binaries path: /mnt/c/Users/Matthijs/GolandProjects/factorio-server-manager/src/bin
2022/01/25 20:32:41 Factorio Server:    0.084 System info: [CPU: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz, 6 cores, RAM: 25601 MB]
2022/01/25 20:32:41 Factorio Server:    0.084 Environment: DISPLAY=<unset> WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=<unset> XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=<unset> __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
2022/01/25 20:32:41 Factorio Server:    0.087 Running in headless mode
2022/01/25 20:32:41 Factorio Server:    0.249 Loading mod core 0.0.0 (data.lua)
2022/01/25 20:32:41 Factorio Server:    0.449 Loading mod base 1.1.53 (data.lua)
2022/01/25 20:32:42 Factorio Server:    1.683 Loading mod base 1.1.53 (data-updates.lua)
2022/01/25 20:32:43 Factorio Server:    1.787 Checksum for core: 1625176034
2022/01/25 20:32:43 Factorio Server:    1.787 Checksum of base: 98178652
2022/01/25 20:32:43 Factorio Server:    2.023 Prototype list checksum: 3034860339
2022/01/25 20:32:43 Factorio Server:    2.098 Info PlayerData.cpp:73: Local player-data.json unavailable
2022/01/25 20:32:43 Factorio Server:    2.098 Info PlayerData.cpp:78: Cloud player-data.json unavailable
2022/01/25 20:32:43 Factorio Server:    2.239 Factorio initialised
2022/01/25 20:32:43 Factorio Server:    2.259 Info ServerSynchronizer.cpp:29: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
2022/01/25 20:32:43 Factorio Server:    2.263 Info ServerMultiplayerManager.cpp:797: updateTick(4294967295) changing state from(Ready) to(PreparedToHostGame)
2022/01/25 20:32:43 Factorio Server:    2.263 Info ServerMultiplayerManager.cpp:797: updateTick(4294967295) changing state from(PreparedToHostGame) to(CreatingGame)
2022/01/25 20:32:43 Factorio Server:    2.280 Loading map /mnt/c/Users/Matthijs/GolandProjects/factorio-server-manager/src/saves/lan2022.zip: 8441806 bytes.
2022/01/25 20:32:44 Factorio Server:    2.884 Loading level.dat: 20277423 bytes.
2022/01/25 20:32:44 Factorio Server:    2.892 Info Scenario.cpp:198: Map version 1.1.53-0
2022/01/25 20:32:44 Factorio Server:    3.505 Loading script.dat: 41608 bytes.
2022/01/25 20:32:44 Factorio Server:    3.601 Checksum for script /mnt/c/Users/Matthijs/GolandProjects/factorio-server-manager/src/temp/currently-playing/control.lua: 3795083680
2022/01/25 20:32:44 Factorio Server:    3.610 Info UDPSocket.cpp:27: Opening socket at (IP ADDR:({0.0.0.0:34197}))
2022/01/25 20:32:44 Factorio Server:    3.610 Hosting game at IP ADDR:({0.0.0.0:34197})
2022/01/25 20:32:44 Factorio Server:    3.611 Info ServerMultiplayerManager.cpp:797: updateTick(724489) changing state from(CreatingGame) to(InGame)
2022/01/25 20:32:44 Factorio Server:    3.611 Info UDPSocket.cpp:39: Opening socket for broadcast
2022/01/25 20:32:44 Factorio Server:    3.615 Info RemoteCommandProcessor.cpp:130: Starting RCON interface at IP ADDR:({0.0.0.0:12345})
2022/01/25 20:32:44 Rcon running on Factorio Server
2022/01/25 20:32:44 rcon session established on 0.0.0.0:12345
2022/01/25 20:32:44 Factorio Server:    3.630 Info RemoteCommandProcessor.cpp:241: New RCON connection from IP ADDR:({127.0.0.1:39264})
knoxfighter commented 2 years ago

It got fixed with commit https://github.com/OpenFactorioServerManager/factorio-server-manager/commit/75ca66769f65361206681502e0b7624aa7ba46a2 So you can use the docker image develop as well.

Mattie112 commented 2 years ago

Ah great! I was looking through the code and didn't see anything wrong (and it worked on WSL). Did not thought that I might be running an old release. I will try out the develop version!

mroote commented 2 years ago

Glad to hear the fix in develop seems to be working. We should likely create a new release soon to move those bug fixes into the main branch.

Mattie112 commented 2 years ago

That sounds like a good plan :)