This document and associated files describe a very simple procedure to push a Dokku application that will launch a Factorio Multiplayer Server. This are the actual files used to launch my Factorio server, so you should trust that it works.
In order for the instructions on this document to work, you need to use Dokku v0.5.0 or greater.
Setting up and configuring Dokku is out of scope of this document, but there are plenty of resources online to do so. I personally use the DigitalOcean's One-click Dokku Droplet, but you may use any provider you want.
Before we push the application to Dokku, it's a good idea to configure a few things to make it work correctly:
-
Create the application:
dokku apps:create factorio
-
Define a storage volume for the saves directory so your map persists across deploys:
dokku storage:mount factorio /var/lib/dokku/data/storage/factorio/saves:/opt/factorio/saves
-
Disable Nginx proxying, as we're not using HTTP for anything:
dokku proxy:disable factorio
-
Set up port forwarding:
dokku docker-options:add '-p 34197:34197/udp'
If you intend to use RCON, remember to also forward the RCON (TCP) port.
In order to deploy, you just need to clone this Gist, add the Dokku remote and push. As simple as that.
You might want to check the Dockerfile
and modify the Factorio version or the list of mods, though.
There are, however, a few configuration values you might want to set via dokku config:set
:
FCT_SERVER_NAME
: The server name, as shown in the server browser.FCT_SERVER_DESCRIPTION
: The server description, as shown in the server browser.FCT_SERVER_MAX_PLAYERS
: The server maximum number of players. Defaults to0
.FCT_SERVER_VISIBILITY
: The visibiility of the server:public
,lan
orhidden
. Defaults tohidden
.FCT_SERVER_PASSWORD
: The game password needed to access the server.FCT_SERVER_VERIFY
: Whether to verify connected players for a valid factorio.com account.FCT_SERVER_PORT
: Port in which the server will be bound. Defaults to34197
. NOTE This is the internal port, not really useful with port forwarding.FCT_SERVER_COMMANDS
: Whether to allow commands in the game:true
,false
oradmins-only
. Defaults toadmins-only
.FCT_SERVER_AUTOSAVE_SLOTS
: Number of slots of autosaved games. Defaults to5
.FCT_SERVER_AUTOSAVE_INTERVAL
: Number of minutes between autosaves of the game. Defaults to3
.FCT_SERVER_LATENCY
: Latency of the game, in milliseconds. Defaults to150
.FCT_SERVER_AUTOKICK_INTERVAL
: Number of minutes until an AFK player is kicked. Defaults to0
(no AFK kicks).FCT_ACCOUNT_USERNAME
: Your factorio.com username, necessary for public games.FCT_ACCOUNT_PASSWORD
: Your factorio.com password, necessary for public games.FCT_ACCOUNT_TOKEN
: Your factorio.com authentication token, which can be used instead of the password.FCT_RCON_PORT
: The port in which to listen for RCON connections and commands. NOTE This is the internal port, not really useful with port forwarding.FCT_RCON_PASSWORD
: Password for RCON connections.