factoriotools / factorio-docker

Factorio headless server in a Docker container
https://hub.docker.com/r/factoriotools/factorio/
MIT License
909 stars 220 forks source link

server not listed in public games browser #71

Closed Alino closed 6 years ago

Alino commented 7 years ago

using digitalocean droplet "Ubuntu Docker 17.06.0-ce on 16.04"

steps:

docker run -d -p 34197:34197/udp -p 27015:27015/tcp \
  -v /tmp/factorio:/factorio \
  --name factorio \
  --restart=always  \
  dtandersen/factorio

docker stop factorio docker rm factorio rm /tmp/factorio/saves/*

then edit /tmp/factorio/config/server-settings.json to this:

{
  "name": "Headless Europe Muslim Invasion - all welcome",
  "description": "Mama Merkel invites everyone",
  "tags": ["game", "tags"],
  "max_players": 10,
  "visibility": { "public": true },
  "username": "MySecretUsername",
  "password": "MySecretPassword",
  "token": "MySecretRandomTokenHash",
  "game_password": "",
  "require_user_verification": false,
  "max_upload_in_kilobytes_per_second": 0,
  "minimum_latency_in_ticks": 0,
  "ignore_player_limit_for_returning_players": false,
  "allow_commands": "admins-only",
  "autosave_interval": 10,
  "autosave_slots": 5,
  "afk_autokick_interval": 0,
  "auto_pause": true,
  "only_admins_can_pause_the_game": true,
  "autosave_only_on_server": true,
  "admins": []
}

then start docker container again:

docker run -d -p 34197:34197/udp -p 27015:27015/tcp \
  -v /tmp/factorio:/factorio \
  --name factorio \
  --restart=always  \
  dtandersen/factorio

monitor what's going on:

docker logs -f factorio

outputs:

+ set -e
+ SAVES=/factorio/saves
+ CONFIG=/factorio/config
+ mkdir -p /factorio/saves
+ mkdir -p /factorio/mods
+ mkdir -p /factorio/config
+ [ ! -f /factorio/config/rconpw ]
+ [ ! -f /factorio/config/server-settings.json ]
+ [ ! -f /factorio/config/map-gen-settings.json ]
+ [ ! -f /factorio/config/map-settings.json ]
+ grep -q .
+ find -L /factorio/saves -iname *.zip -mindepth 1 -print
+ cat /factorio/config/rconpw
+ exec /opt/factorio/bin/x64/factorio --port 34197 --start-server-load-latest --server-settings /factorio/config/server-settings.json --server-whitelist /factorio/config/server-whitelist.json --server-banlist /factorio/config/server-banlist.json --rcon-port 27015 --rcon-password aeXoo9Ooghae4ee --server-id /factorio/config/server-id.json
   0.000 2017-08-11 22:22:17; Factorio 0.15.33 (build 30852, linux64, headless)
   0.000 Operating system: Linux
   0.000 Program arguments: "/opt/factorio/bin/x64/factorio" "--port" "34197" "--start-server-load-latest" "--server-settings" "/factorio/config/server-settings.json" "--server-whitelist" "/factorio/config/server-whitelist.json" "--server-banlist" "/factorio/config/server-banlist.json" "--rcon-port" "27015" "--rcon-password" "aeXoo9Ooghae4ee" "--server-id" "/factorio/config/server-id.json" 
   0.000 Read data path: /opt/factorio/data
   0.000 Write data path: /opt/factorio
   0.000 Binaries path: /opt/factorio/bin
   0.011 System info: [CPU:      Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz, 1 core, RAM: 488MB]
   0.012 Running in headless mode
   0.015 Loading mod core 0.0.0 (data.lua)
   0.024 Loading mod base 0.15.33 (data.lua)
   0.147 Loading mod base 0.15.33 (data-updates.lua)
   0.186 Checksum for core: 1161214653
   0.186 Checksum of base: 1503927233
   0.318 Info PlayerData.cpp:60: Local player-data.json unavailable
   0.319 Info PlayerData.cpp:65: Cloud player-data.json unavailable
   0.321 Custom inputs active: 0
   0.323 Factorio initialised
   0.323 Info HttpSharedState.cpp:44: Downloading https://auth.factorio.com/api-login?api_version=2
   1.233 Info HttpSharedState.cpp:111: Status code: 200
   1.234 Info AuthServerConnector.cpp:171: Got token from auth server for username(1alino).
   1.236 Info ServerSynchronizer.cpp:28: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
   1.236 Info ServerMultiplayerManager.cpp:671: mapTick(-1) changing state from(Ready) to(PreparedToHostGame)
   1.237 Info ServerMultiplayerManager.cpp:671: mapTick(-1) changing state from(PreparedToHostGame) to(CreatingGame)
   1.242 Loading map /opt/factorio/saves/_autosave1.zip: 675731 bytes.
   1.317 Loading Level.dat: 934469 bytes.
   1.347 Info Scenario.cpp:135: Map version 0.15.33-1
   1.543 Info BlueprintLibrary.cpp:219: Loaded library shelves:
   1.550 Info BlueprintLibrary.cpp:786: Game shelf: playerIndex = 65535, nextRecordID = 0; timestamp = 1502489063; records:
   1.553 Info BlueprintLibrary.cpp:48: Loaded external blueprint storage: playerIndex = 65535, nextRecordID = 0; timestamp = 1502490138; records:
   1.554 Loading script.dat: 190 bytes.
   1.562 Checksum for script /opt/factorio/temp/currently-playing/control.lua: 282129324
   1.565 Info UDPSocket.cpp:27: Opening socket at (0.0.0.0:34197)
   1.566 Hosting game at 0.0.0.0:34197
   1.566 Info ServerMultiplayerManager.cpp:671: mapTick(0) changing state from(CreatingGame) to(InGame)
   1.567 Info ServerRouter.cpp:579: Asking pingpong servers (pingpong1.factorio.com:34197, pingpong2.factorio.com:34197) for own address
   1.644 Info RemoteCommandProcessor.cpp:122: Starting RCON interface at port 27015
   1.662 Info ServerRouter.cpp:474: Own address is 178.62.241.218:34197
   2.153 Info ServerMultiplayerManager.cpp:600: Matching server connection resumed
jkarnesPerfectCube commented 6 years ago

Interesting that you have the token to come in from the server: AuthServerConnector.cpp:171: Got token from auth server for username(1alino). This at least means that you're logging in correctly.

Have you verified that this issue is related to the docker profile itself and not an issue with your account? Are you able to host a matchmaking based game with this factorio.com username and password outside of the docker config?

Alino commented 6 years ago

Well when I tried to host a game from my computer nobody ever joined. But I believed it might have been issue with port forwarding not configured, which I am not able to do, due to my ISP limitations on my router, they restrict me from port forwarding settings. So I tried to set up the server on digital ocean VPS.

Alino commented 6 years ago

I think it was because of version mismatch. If you have older docker image with older factorio version, and your factorio game client is newer version. Then you cannot see hosted public games which are different version than yours.

I have stopped and removed existing factorio container docker kill factorio && docker rm factorio

I have updated my docker image docker pull dtandersen/factorio

Then recreate the container

docker run -d -p 34197:34197/udp -p 27015:27015/tcp \
  -v /tmp/factorio:/factorio \
  --name factorio \
  --restart=always  \
  dtandersen/factorio

EDIT: I forgot to mention that I am no longer hosting it trough digital ocean but in the meantime I have bought my own passive home server and I made my ISP enable port forwarding on my router.