Giter VIP home page Giter VIP logo

docker_factorio_server's Introduction

Factorio Build Status Docker Pulls

Factorio Server in docker

Versions

Please checkout the different tags

What's new ?

Factorio

See factorio's site

Docker image

  • New semver for version !!!Tags have changed now!!!
  • Automated build with travis

How to use ?

I just want to play !

This runs factorio with default settings, and your save will be kept :

docker run -d \
  -v [PATH]:/opt/factorio/saves \
  -p [PORT]:34197/udp \
  zopanix/factorio
  • Where [PATH] is a folder where you'll put your saves, if there already is a save in it with the string "save", that one will be taken by default, otherwize, a new one will be made.
  • Where [PORT] is the port number you choose, if you're going to launch it on your local machine, don't use the port 34197, take another one at random.

Advanced usage

Without map persistence

docker run -d \
  -p [PORT]:34197/udp \
  zopanix/factorio

This will generate a new random map with default settings.

With map persistence

docker run -d \
  -v [PATH]:/opt/factorio/saves \
  -p [PORT]:34197/udp \
  zopanix/factorio

This will generate a new random map with default settings and save it onto the volume. Replace [PATH] with a path to a folder on the host where the map will be saved. If existing saves exist it will take the latest one.

Autosave interval

You can set the autosave interval. By default it is set at 2 minutes bud you can change it by launching the container with the "FACTORIO_AUTOSAVE_INTERVAL" variable to whatever suits you best.

docker run -d \
  --env FACTORIO_AUTOSAVE_INTERVAL=[NUMBER] \
  -p [PORT]:34197/udp  \
  zopanix/factorio

Where [NUMBER] is the number of minutes between autosaves.

Autosave slots

You can set the number of autosave slots. By default it is set at 3 slots bud you can change it by launching the container with the "FACTORIO_AUTOSAVE_SLOTS" variable to whatever suits you best.

docker run -d \
  --env FACTORIO_AUTOSAVE_SLOTS=[NUMBER] \
  -p [PORT]:34197/udp  \
  zopanix/factorio

Where [NUMBER] is the number of autosave slots.

Mounting mod volume

As everybody knows about factorio is you can add mods to it. Now you can also do it in this docker image by mounting a volume.

docker run -d \
  -v [PATH]:/opt/factorio/mods \
  -p [PORT]:34197/udp \
  zopanix/factorio

Where [PATH] is the path to the folder with your mods.

Allowing in-game commands

I've always disabled in-game commands because I think it is like cheating, however, you can enable them by setting the the "FACTORIO_ALLOW_COMMANDS" variable to "true".

docker run -d \
  --env FACTORIO_ALLOW_COMMANDS=true \
  -p [PORT]:34197/udp \
  zopanix/factorio

Activating no-auto-pause in the game when no one is on the server

I do not recommend this feature, bud it can make the game more difficult if you're up for a challenge :-). Just set the "FACTORIO_NO_AUTO_PAUSE" variable to "true".

docker run -d \
  --env FACTORIO_NO_AUTO_PAUSE=true \
  -p [PORT]:34197/udp \
  zopanix/factorio

Change latency option

I do not know what the real impact is, ut has always worked very well on default, but you can change the latency option in ms.

docker run -d \
  --env FACTORIO_LATENCY_MS=[number] \
  -p [PORT]:34197/udp \
  zopanix/factorio

Factorio Mode

I don't know what it is, possibilities are : heavy, complete or none (don't do anything...)

docker run -d \
  --env FACTORIO_MODE=[MODE] \
  -p [PORT]:34197/udp \
  zopanix/factorio

Factorio Server Name

Set Factorio Server Name (defaults to "Factorio Server")

docker run -d \
  --env FACTORIO_SERVER_NAME=[NAME]
  -p [PORT]:34197/udp \
  zopanix/factorio

Factorio Server Description

Set Factorio Server Description (if not specified, no description will be set)

docker run -d \
  --env FACTORIO_SERVER_DESCRIPTION=[DESCRIPTION]
  -p [PORT]:34197/udp \
  zopanix/factorio

Factorio Server Max Players

Set Factorio Server Max Players count (if not specified, maximum players is set to 255)

docker run -d \
  --env FACTORIO_SERVER_MAX_PLAYERS=[NUMBER]
  -p [PORT]:34197/udp \
  zopanix/factorio

Factorio Server Visibility

//: # (Set Factorio Server Visibility (if set to public, factorio.com User Login and Password or Token are required)) Set Factorio Server Visibility (if set to public, factorio.com User Login and Password are required)

docker run -d \
  --env FACTORIO_SERVER_VISIBILITY=[hidden,lan,public]
  -p [PORT]:34197/udp \
  zopanix/factorio

Factorio Server factorio.com Login

Set factorio.com User Login and Password required for public server visibility

docker run -d \
  --env FACTORIO_USER_USERNAME=[USERNAME]
  --env FACTORIO_USER_PASSWORD=[PASSWORD]
  -p [PORT]:34197/udp \
  zopanix/factorio

Factorio Server Game Password

Set Factorio Server Game Password (if not specified, no password will be set)

docker run -d \
  --env FACTORIO_SERVER_GAME_PASSWORD=[GAME-PASSWORD]
  -p [PORT]:34197/udp \
  zopanix/factorio

Factorio Server Verify User Identity

Set Verify User Identity to true to require factorio.com account for user to login (defaults to false)

docker run -d \
  --env FACTORIO_SERVER_VERIFY_IDENTITY=[false,true]
  -p [PORT]:34197/udp \
  zopanix/factorio

Factorio RCON Console Port

This allows you to expose a RCON Console

docker run -d \
  -p [PORT]:34197/udp \
  -p [PORT_RCON]:27015/tcp \
  zopanix/factorio

Where PORT_RCON is the port you want to use. By default a random password is set bud ... see below

Factorio RCON Console Password

This allows you to set a password for RCON (if not specified, it will be random)

docker run -d \
  --env FACTORIO_RCON_PASSWORD=[PASSWORD] \
  -p [PORT]:34197/udp \
  zopanix/factorio

Authorization Error

If your container exits with the following error:

Info HttpSharedState.cpp:83: Status code: 401
Info AuthServerConnector.cpp:40: Error in communication with auth server: code(401) message({
  "message": "Username and password don't match",
  "status": 401
})
Info AuthServerConnector.cpp:68: Auth server authorization error (Username and password don't match)
Error Util.cpp:57: Unknown error

Check supplied Username and Password for mistakes.

Waiting for ready

This is a beta feature which has nothing to do with factorio... leave it as it is for the moment. I'm working with some collegues on something new which should work very well and please a lot of people.

More to come

docker_factorio_server's People

Contributors

alphasite avatar bkuhl avatar guyspronck avatar hub23 avatar psykzz avatar salzig avatar supersandro2000 avatar zfarrell avatar zopanix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker_factorio_server's Issues

Couldn't establish network communication

Thanks for putting together this image - on alpine of all distros! I use Rancher so I appreciate the ability to quickly spin up a game server. I understand you won't provide support for running a server, but I'm curious if you've seen this issue before.

I'm redirecting port 3000 to 34197 on the host but am unable to establish a connection. I'm having trouble determining the cause of the issue. It keeps saying connection is already in progress.

Have you seen this before?

//cc @alexknutson

https://www.reddit.com/r/factorio/comments/486my5/issues_with_factorio_servers/ was an interesting read, but you suggested changing the port if running locally so I'm guessing you've successfully redirected the port?

5/15/2016 11:12:24 PM 487.271 Connection request from 74.134.247.255:34197
5/15/2016 11:12:24 PM 487.272 Refusing connection for address(74.134.247.255:34197). Another connection from this peer is in progress.
5/15/2016 11:12:25 PM 488.005 Info Synchronizer.cpp:444: NetworkTick(29138) peer(1) drop detection state(100/600).
5/15/2016 11:12:26 PM 489.671 Info Synchronizer.cpp:444: NetworkTick(29138) peer(1) drop detection state(200/600).
5/15/2016 11:12:28 PM 491.338 Info Synchronizer.cpp:444: NetworkTick(29138) peer(1) drop detection state(300/600).
5/15/2016 11:12:30 PM 493.004 Info Synchronizer.cpp:444: NetworkTick(29138) peer(1) drop detection state(400/600).
5/15/2016 11:12:31 PM 494.671 Info Synchronizer.cpp:444: NetworkTick(29138) peer(1) drop detection state(500/600).
5/15/2016 11:12:33 PM 496.338 Info Synchronizer.cpp:444: NetworkTick(29138) peer(1) drop detection state(600/600).
5/15/2016 11:12:33 PM 496.354 Info Synchronizer.cpp:590: NetworkTick(29138) peer(1) peerHeartbeatsEmpty(true) is not responding, dropping.
5/15/2016 11:12:33 PM 496.454 Info MultiplayerManager.cpp:1433: Received peer info for peer(0) username(<server>).
5/15/2016 11:12:33 PM 496.454 Info MultiplayerManager.cpp:1060: networkTick(29143) mapTick(34) received stateChanged peerID(0) oldState(InGame) newState(InGame)
5/15/2016 11:12:33 PM 496.471 Info Router.cpp:741: Received onPeerConnected for already connected peer(1)
5/15/2016 11:12:33 PM 496.471 Info MultiplayerManager.cpp:1495: Peer dropout for peer (1) by peer (0) -- removing now
5/15/2016 11:12:33 PM 496.471 Info MultiplayerManager.cpp:1010: networkTick(29144) mapTick(35) removing peer(1) dropout(true)
5/15/2016 11:12:33 PM 496.471 Info Synchronizer.cpp:516: networkTick(29144) removing peer(1) success(false).
5/15/2016 11:12:33 PM 496.471 Info MultiplayerManager.cpp:913: networkTick(29144) mapTick(35) changing state from(InGame) to(InGameAligning)
5/15/2016 11:12:33 PM 496.471 Info MultiplayerManager.cpp:1719: networkTick(29144) mapTick(35) starting mapAlign
5/15/2016 11:12:33 PM 496.471 Info MultiplayerManager.cpp:1633: networkTick(29144) mapTick(35) adding mapAlignTask(RemovePlayerAlignTask)
5/15/2016 11:12:33 PM 496.571 Info MultiplayerManager.cpp:1060: networkTick(29150) mapTick(35) received stateChanged peerID(0) oldState(InGame) newState(InGameAligning)
5/15/2016 11:12:33 PM 496.571 Info MultiplayerManager.cpp:1653: networkTick(29150) mapTick(35) sending mapAlignAction
5/15/2016 11:12:33 PM 496.671 Info MultiplayerManager.cpp:1307: networkTick(29156) mapTick(35) received MapAlignAction from peer(0), mapAlignTick(36) appliedTickClosuresCount(0)
5/15/2016 11:12:33 PM 496.671 Info MultiplayerManager.cpp:1735: networkTick(29157) mapTick(35) mapAlign finished targetTick(36) updating map and running the tasks ...
5/15/2016 11:12:33 PM 496.671 Info MultiplayerManager.cpp:1607: networkTick(29157) mapTick(35) peerID(0) fullStateLog: local state(InGameAligning) local peers(((peerID(0) state(InGameAligning) mapAlignTick(36))
5/15/2016 11:12:33 PM)
5/15/2016 11:12:33 PM 496.673 Info MultiplayerManager.cpp:1754: maptick(36) crc before applying all ticks: -486121007
5/15/2016 11:12:33 PM 496.673 Info NetworkInputHandler.cpp:661: applyAllTickClosures: expectedMapTick(36) lastTickApplied(27) referenceMapTick(36) networkTick(29157)
5/15/2016 11:12:33 PM 496.673 Info MultiplayerManager.cpp:1762: maptick(36) crc after applying all ticks: -486121007
5/15/2016 11:12:33 PM 496.673 Info MultiplayerManager.cpp:913: networkTick(29157) mapTick(36) changing state from(InGameAligning) to(InGameAligned)
5/15/2016 11:12:33 PM 496.788 Info MultiplayerManager.cpp:1060: networkTick(29163) mapTick(36) received stateChanged peerID(0) oldState(InGameAligning) newState(InGameAligned)
5/15/2016 11:12:33 PM 496.789 Info MultiplayerManager.cpp:913: networkTick(29163) mapTick(36) changing state from(InGameAligned) to(InGameWaitingForOthers)
5/15/2016 11:12:34 PM 496.888 Info MultiplayerManager.cpp:1060: networkTick(29169) mapTick(36) received stateChanged peerID(0) oldState(InGameAligned) newState(InGameWaitingForOthers)
5/15/2016 11:12:34 PM 496.888 Info MultiplayerManager.cpp:1259: networkTick(29169) mapTick(36) stopping mapAlign
5/15/2016 11:12:34 PM 496.888 Info MultiplayerManager.cpp:1785: performing map align task (RemovePlayerAlignTask)
5/15/2016 11:12:34 PM 496.888 Info MultiplayerManager.cpp:1809: networkTick(29169) mapTick(36) finishing removing peer(1) hasPeer(false)
5/15/2016 11:12:34 PM 496.888 Info NetworkInputHandler.cpp:544: expectedMapTick(36) removing peer(1) success(false).
5/15/2016 11:12:34 PM 496.888 Info Synchronizer.cpp:516: networkTick(29169) removing peer(1) success(false).
5/15/2016 11:12:34 PM 496.888 Info MultiplayerManager.cpp:913: networkTick(29169) mapTick(36) changing state from(InGameWaitingForOthers) to(InGame)
5/15/2016 11:12:34 PM 496.888 Info MultiplayerManager.cpp:1607: networkTick(29169) mapTick(36) peerID(0) fullStateLog: local state(InGame) local peers(((peerID(0) state(InGameWaitingForOthers) mapAlignTick(-1))
5/15/2016 11:12:34 PM)
5/15/2016 11:12:34 PM 496.988 Info MultiplayerManager.cpp:1060: networkTick(29175) mapTick(36) received stateChanged peerID(0) oldState(InGameWaitingForOthers) newState(InGame)

Thank you for making this!

Just wanted to let you know I appreciate you making this. It's working great for me (with a little customization.) Saved me a lot of time getting a server up and running today.

Thanks again!

๐Ÿ‘

Automating Factorio Docker Builds

I'm interested in automating the factorio docker container production. I didn't find your docker containers before beginning some of this work. But now that I've found your repo and seeing the extensive work you've put into the docker images (well done btw) I think the community benefits the most if we work together.

I've written a micro-service that is intended to automate building these kinds of images using github/travis-ci. Here's how it works:

  • Microservice checks a github repo's tags against the full game release list. Any versions that don't already have a github release will receive github releases, regardless of how old they are.
  • Travis-CI would get kicked off to build the docker image, tag it and push it up to Dockerhub automatically.

Rather than fork this repo, I'd prefer to apply these updates to this existing repo if you're up for it. Here's what I would need and what would change:

  • Non-stable releases would be tagged as x.x.x-experimental and only stable builds would remain x.x.x. In this case, it would create duplicates since there are experimental releases without this additional flag.
  • Travis-CI would need environment variables configured with a docker username, password and email so images could be automatically tagged and pushed up. Docker automated builds don't allow dynamic tagging in this fashion.
  • A github token I can use that will be used to create releases on this repo. I'd be happy to use mine if I can be granted permission

What are your thoughts?

Received malformed packet

when i start this with ubuntu LTS 16.04 server on Docker version 1.13.1, build 092cba3 and factorio 0.14.22 and i try to connect the server says:

19625.896 Info Router.cpp:230: Received malformed packet from 98.226.58.18:54920 (Couldn't read from input file. File could be corrupted.)

and i cant login.

#!/bin/bash
docker run \
  -v /home/factorio/saves:/opt/factorio/saves \
  -v /home/factorio/mods:/opt/factorio/mods \
  --env FACTORIO_SERVER_VISIBILITY=lan \
  --env FACTORIO_AUTOSAVE_INTERVAL=5 \
  --env VERSION=0.14.22 \
  --env FACTORIO_SERVER_GAME_PASSWORD="mypassword" \
  -p 34197:34197/udp \
  zopanix/factorio

when i run factorio directly on host everything is fine and i can connect.

!/bin/bash
./bin/x64/factorio --port 34197 --start-server saves/newmp.zip

Version out of date

Hey it looks like the version is starting to lag behind that of the release.
Is there any reason not to update to the latest version?

unrecognised option '--disallow-commands'

I think something may be wrong with the flags passed to factorio:

docker run -d   -p 5000:34197/udp   zopanix/factorio
f6255137e4d9ae3f072e28138c6cf946eae577168c84120bd0b7991bef7c0d1f
>docker logs f62
###
# Creating a new map [save.zip]
###
   0.000 2016-06-28 23:59:44; Factorio 0.13.0 (Build 22782, linux64, headless)
   0.000 Operating system: Linux
   0.000 Not rotating logs.
   0.000 Program arguments: "/opt/factorio/bin/x64/factorio" "--create" "save.zip" 
   0.000 Read data path: /opt/factorio/data
   0.000 Write data path: /opt/factorio
   0.000 Binaries path: /opt/factorio/bin
   0.028 Running in headless mode
   0.033 Loading mod core 0.0.0 (data.lua)
   0.042 Loading mod base 0.13.0 (data.lua)
   0.262 Checksum for core: 1399339455
   0.262 Checksum for mod base: 2039900801
   1.247 Custom inputs active: 0
   1.248 Factorio initialised
   1.249 Info Main.cpp:557: Creating new map save.zip
  18.078 Info Scenario.cpp:129: Map version 0.13.0-93
  18.210 Checksum for script /opt/factorio/temp/currently-playing/control.lua: 900459546
  18.211 Error Util.cpp:57: boost::filesystem::create_directory: No such file or directory
###
# New map created [save.zip]
###
###
# Launching Game
###
unrecognised option '--disallow-commands'

General options:
  -h [ --help ]                 display help
  --version                     show version information
  -v [ --verbose ]              enable verbose logging
  -c [ --config ] PATH          config file to use
  --no-log-rotation             don't rotate log file

Running options:
  -s [ --map2scenario ] arg     map to scenario conversion
  -m [ --scenario2map ] arg     scenario to map conversion
  --apply-update arg            immediately apply update package
  --create SAVE                 create a new map
  --map-gen-settings FILE       Map generation settings for use with --create. 
                                See data/map-gen-settings.example.json
  --start-server SAVE           start a multiplayer server
  --start-server-load-latest    start a multiplayer server and load the latest 
                                available save
  --until-tick TICK             run a save until given map tick
  --heavy                       run the game in heavy mode
  --complete                    run the game in complete heavy mode

Server options:
  --latency N                   multiplayer server latency, in ticks
  --latency-ms N                multiplayer server latency, in milliseconds
  --autosave-interval N (=2)    server autosave interval, in minutes
  --autosave-slots N (=3)       server autosave slots
  --allow-commands arg (=true)  allow (true), disallow (false), or restrict 
                                (admins-only) use of the command console
  --no-auto-pause               don't automatically pause when no players are 
                                connected
  --port N                      network port to use
  --rcon-port N                 Port to use for RCON
  --rcon-password PASSWORD      Password for RCON
  --server-settings FILE        Path to file with server settings. See 
                                data/server-settings.example.json

  --autoupdate-stage2 arg       internal use only
  --autoupdate-finished         internal use only
  --join-game-by-id ID          internal use only

Travis CI

I'd like to use travis CI to build the image.

Honestly, it's my first time using it. Wouldn't mind to get some help on this (or I'll probably figure it out by myself :p)

Thanks for any advice you can give me

alpine + ssl + sha1 hashing?

Hey Zopanix,

Let me know if you are interested in any of these changes (master...dtandersen:master) and I'll do a pull request. If not, thanks for the dockerfile :) smart_launch.sh was a good idea! That's why I used this image instead of the others.

  • sha1 verification of download
  • enable SSL verification when downloading
  • alpine linux (smaller sized)
  • a couple of changes to reduce amount of layers

Headless-mode bug: OPENSSL_load_builtin_modules called. Aborting

If I try to start a fresh container, server shows this error message:
Headless-mode bug: OPENSSL_load_builtin_modules called. Aborting
Server is crashing at container starup.

###
# Launching Game
###
Headless-mode bug: OPENSSL_load_builtin_modules called. Aborting
Headless-mode bug: OPENSSL_load_builtin_modules called. Aborting

Reproduce:

sudo docker rmi zopanix/factorio
sudo docker run -d \
  -v /home/username/factorio-saves:/opt/factorio/saves \
  -p 34197:34197/udp \
  --env FACTORIO_SERVER_NAME="test" \
  --env FACTORIO_SERVER_DESCRIPTION="" \
  --env FACTORIO_SERVER_MAX_PLAYERS=8 \
  --env FACTORIO_SERVER_VERIFY_IDENTITY=false \
  --env FACTORIO_SERVER_VISIBILITY=public \
  --env FACTORIO_USER_USERNAME=hub \
  --env FACTORIO_USER_PASSWORD=obfuscatedpassword \
  --env FACTORIO_AUTOSAVE_INTERVAL=15 \
  --restart=on-failure:10 \
  --name=factorio-test \
  zopanix/factorio

sudo docker logs -f factorio-test

OS and Docker Version:

Linux HOST 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"

Docker version 1.12.0, build 8eab29e
Docker version 1.11.2, build b9f10c9

I tested this on 2 different Systems, same OS and Kernel but different Docker build Versions.
Can anybody confirm this?

factorio.com login token

The usage of the server-settings.json value token seems to be broken.

Eventually the corresponding container switch and related variables should be disabled temporarily till fixed.

Including server-settings.json

I tried to set up a factorio 0.13.5 server using the options visibility, game_password and verify_user_identity. I ended up cloning this repo, adding the prepared server-settings.json and these messy lines:

Dockerfile:
COPY ./server-settings.json /opt/server-settings.json

new_smart_launch.sh:
factorio_command="$factorio_command --server-settings /opt/server-settings.json"

It would be great if these options are passable via docker run arguments.

Unable to run latest builds

We're unable to run the 0.14 build. --latency-ms is no longer an option for the client given the rework of networking on Factorio. It looks like server-settings.json format may have changed as the smart launch is not building a usable file leading to the error Error util.cpp:57: /opt/factorio/server-settings.json(22): expected value when run.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.