Serveur Factorio (vanilla, FSM ou collector seul) avec le collector FactoriCord
1.3K
English | Français
Headless Factorio server bundled with the FactoriCord collector, which sends the in-game events written by the FactoriCord mod (joins, deaths, research, rocket launches, victory...) to the FactoriCord API.
Source code: github.com/OcelusPRO/FactoriCordDocker · Support: FactoriCord Discord
docker run -d --name factoricord \
-p 34197:34197/udp \
-e FACTORICORD_API_URL=https://api.example.com \
-e FACTORICORD_TOKEN=my-token \
-e FACTORICORD_SERVER_NAME="My server" \
-v factorio-game:/opt/factorio \
-v factorio-data:/factorio \
--stop-timeout 60 \
ocelus/factoricord
On first start, the container:
Later restarts reuse the game that is already installed.
services:
factoricord:
image: ocelus/factoricord:latest
container_name: factoricord
restart: unless-stopped
stop_grace_period: 1m # gives Factorio time to save the map on shutdown
environment:
SERVER_MODE: vanilla # vanilla | fsm | none
FACTORIO_VERSION: stable # stable | latest | 2.0.77
FACTORICORD_API_URL: https://api.example.com
FACTORICORD_TOKEN: my-token
FACTORICORD_SERVER_NAME: My server
# MODS_LIST: even-distribution, Squeak Through
# FACTORIO_USERNAME: my-username
# FACTORIO_TOKEN: my-factorio-token
ports:
- "34197:34197/udp"
volumes:
- factorio-game:/opt/factorio
- factorio-data:/factorio
- ./mods:/factorio/mods
volumes:
factorio-game:
factorio-data:
The mode is selected with the SERVER_MODE variable.
SERVER_MODE | What runs | Game downloaded |
|---|---|---|
vanilla (default) | Headless Factorio server + FactoriCord collector | yes |
fsm | Factorio Server Manager (web UI) + Factorio server + collector | yes |
none | FactoriCord collector only, on the volume of an existing server | no |
vanilla: regular serverThe server loads the latest save (LOAD_LATEST_SAVE=true), or SAVE_NAME. If there is no save, a map is generated
from config/map-gen-settings.json and config/map-settings.json, or from a preset (PRESET). Arguments given
after the image name are passed to the Factorio binary.
fsm: Factorio Server Managerdocker run -d --name factoricord \
-e SERVER_MODE=fsm \
-p 34197:34197/udp -p 8080:80/tcp \
-e FACTORICORD_API_URL=https://api.example.com \
-e FACTORICORD_TOKEN=my-token \
-v factorio-game:/opt/factorio \
-v factorio-data:/factorio \
ocelus/factoricord
The web UI listens on the container's FSM_PORT (80 by default).
Credentials: on first start, FSM creates the admin user and prints its password in the logs. To find it:
docker logs factoricord 2>&1 | grep -A1 "Username: admin"
Remember to change this password from the web UI.
FSM_AUTOSTART=true (default): the server starts on the latest save together with the container. With false,
it is started from the web UI.
The game port is set in the FSM web UI (34197 by default): the PORT variable is not used.
Behind an HTTPS reverse proxy, set FSM_SECURE_COOKIE=true.
FSM data (users, configuration, mod packs, factorio.com login) is stored in /factorio/fsm.
This mode only works on amd64.
none: collector onlyTo add FactoriCord to a Factorio server that already runs elsewhere, for example in another container. Mount that
server's data volume on /factorio. The collector reads the events in script-output/factoricord-logs, sends them
to the API, then deletes the files it sent.
services:
factoricord-collector:
image: ocelus/factoricord:latest
restart: unless-stopped
environment:
SERVER_MODE: none
FACTORICORD_API_URL: https://api.example.com
FACTORICORD_TOKEN: my-token
PUID: 845 # same user as the Factorio server, so the collector can delete the files it read
PGID: 845
volumes:
- factorio-data:/factorio # data volume of the existing Factorio server
The FactoriCord mod must be installed on that server. This mode downloads nothing.
| Path | Content |
|---|---|
/opt/factorio | The game: binary, data/, config/config.ini. Downloaded on first start |
/factorio | Server data, detailed below |
/factorio/mods | Mods and mod-list.json. Can be mounted separately (a host folder, for example) |
Content of /factorio:
saves/: the maps;config/: server-settings.json, map-gen-settings.json, map-settings.json, server-adminlist.json,
server-banlist.json, server-whitelist.json, rconpw;script-output/: files written by mods, including the FactoriCord events;factoricord/: the FactoriCord client and its config.json;fsm/: Factorio Server Manager data.Configuration files are created from the game's examples if they don't exist. Edit them and restart the container,
for example to name the server, make it public or set a password in server-settings.json.
FACTORIO_VERSION accepts three forms:
stable (default): the latest stable version;latest: the latest experimental version;2.0.77.On each start, the game is downloaded again only if the installed version is not the requested one. If factorio.com is unreachable, the installed version is kept. To go back to an older version, set that version.
The Space Age DLC mods (space-age, quality, elevated-rails) are enabled by default. This is controlled with
DLC_SPACE_AGE:
false disables the DLC;DLC_SPACE_AGE="quality elevated-rails".On each start (vanilla and fsm modes):
MODS_LIST: listed mods that are missing are downloaded from the mod portal,
together with their required dependencies. Names are comma-separated, for example
MODS_LIST="even-distribution, Squeak Through". A factorio.com account is required (see below).mod-list.json and enabled, whether it is a
name_x.y.z.zip file or an unpacked folder. A mod already listed keeps its state: a mod disabled by hand in
mod-list.json stays disabled. Only FactoriCord is always re-enabled.To add a mod by hand, drop its zip into the mods folder and restart the container.
UPDATE_MODS_ON_START=true also updates all enabled mods to their latest compatible version. Some mods can be
excluded with UPDATE_IGNORE (comma-separated names).
factorio.com credentials: downloading mods requires your username and token, shown on factorio.com/profile. They are read in this order of priority:
username and token;FACTORIO_USERNAME and FACTORIO_TOKEN variables;username and token fields of server-settings.json.The collector is configured with environment variables. Its config.json is generated in /factorio/factoricord
on each start:
The client updates itself from the FactoriCord API. The update is kept in the volume: it survives container recreation and image updates, as long as the image does not ship a newer version. After an update, the collector is restarted automatically.
If FACTORICORD_TOKEN or FACTORICORD_API_URL is missing, the collector is not started. The server still runs in
vanilla and fsm modes, whereas none mode stops with an error.
General
| Variable | Default | Description |
|---|---|---|
SERVER_MODE | vanilla | vanilla, fsm or none |
FACTORIO_VERSION | stable | stable, latest (experimental) or a specific version (2.0.77) |
PUID / PGID | 845 / 845 | UID/GID of the user running the server and the collector |
DEBUG | false | true prints every command run by the scripts |
FactoriCord
| Variable | Default | Description |
|---|---|---|
FACTORICORD_API_URL | FactoriCord API URL (required) | |
FACTORICORD_TOKEN | Server token (required). Alternatives: FACTORICORD_TOKEN_FILE (path to a file) or the Docker secret factoricord_token | |
FACTORICORD_SERVER_NAME | Server name | |
FACTORICORD_UPDATE_INTERVAL | 10 | Interval between event uploads, in seconds |
FACTORICORD_UPDATE_CHECK_INTERVAL | 3600 | Interval between client update checks, in seconds |
FACTORICORD_LOGS_DIR | /factorio/script-output/factoricord-logs | Event folder read by the collector |
FACTORICORD_HOME | /factorio/factoricord | Location of the client and its config.json |
Server (vanilla and fsm modes)
| Variable | Default | Description |
|---|---|---|
PORT | 34197 | Game UDP port (vanilla mode) |
RCON_PORT | 27015 | RCON port (password in config/rconpw) |
LOAD_LATEST_SAVE | true | Loads the most recent save. With false, loads SAVE_NAME |
SAVE_NAME | Name of the save to load or generate | |
GENERATE_NEW_SAVE | false | Generates the SAVE_NAME map if it doesn't exist |
PRESET | Map generation preset (rich-resources, death-world, rail-world...) | |
BIND | IP address the server listens on | |
CONSOLE_LOG_LOCATION | File to write the server console to | |
DLC_SPACE_AGE | true | true, false or a list of DLC mods |
MODS_LIST | Mod portal mods to install, comma-separated | |
FACTORIO_USERNAME / FACTORIO_TOKEN | factorio.com credentials, to download mods | |
UPDATE_MODS_ON_START | false | Updates the enabled mods on each start |
UPDATE_IGNORE | Mods excluded from updates, comma-separated |
Factorio Server Manager (fsm mode)
| Variable | Default | Description |
|---|---|---|
FSM_PORT | 80 | Web UI port inside the container |
FSM_AUTOSTART | true | Starts the Factorio server together with the container |
FSM_SECURE_COOKIE | false | true behind an HTTPS reverse proxy |
| Port | Usage |
|---|---|
34197/udp | Game |
27015/tcp | RCON (no need to publish it to use the container's rcon command) |
80/tcp | FSM web UI (fsm mode) |
# Server console through RCON
docker exec factoricord rcon /players
docker exec factoricord rcon "/c game.print('Hello')"
# Exit code 75 if players are online (watchtower pre-update hook)
docker exec factoricord /opt/factoricord/scripts/players-online.sh
# Start a scenario, or convert a scenario into a map
docker run --rm -v factorio-game:/opt/factorio -v factorio-data:/factorio \
--entrypoint /opt/factoricord/scripts/scenario2map.sh ocelus/factoricord my-scenario
When the container stops (docker stop), the server receives the stop signal and saves the map before exiting.
Give it enough time: --stop-timeout 60 with docker run, or stop_grace_period: 1m with Compose.
Each version tag combines the version of the FactoriCord client (the agent) and the version of the FactoriCord
mod: <client>-<mod>.
| Tag | Content |
|---|---|
latest | The latest published version |
1.0.1-1.1.1 | FactoriCord client 1.0.1 + FactoriCord mod 1.1.1 (rebuilt if the image changes without a version change) |
sha-<commit> | Build of a specific commit, immutable |
To pin an installation, use a <client>-<mod> tag rather than latest.
Images are published for linux/amd64 and linux/arm64. On arm64, Factorio runs through the
box64 emulator (slower) and fsm mode is not available.
The image is built from FactoriCordClient.zip (the client, extracted during the build) and
FactoriCord_x.y.z.zip (the mod). To move to a new version:
FactoriCordClient.zip, then update ARG FACTORICORD_CLIENT_VERSION in the Dockerfile;FactoriCord_x.y.z.zip. The repository must contain a single mod zip, and the version in its
info.json must match the file name.docker build -t ocelus/factoricord:1.0.1-1.1.1 .
| Build argument | Default | Description |
|---|---|---|
FACTORICORD_CLIENT_VERSION | 1.0.1 | Version of the client in FactoriCordClient.zip |
FSM_IMAGE | ofsm/ofsm:develop | Image the FSM binary is taken from |
BASE_IMAGE | python:3.12-slim-trixie | Base image |
PUID / PGID | 845 | Default UID/GID of the factorio user |
tests/smoke-test.sh runs the image in all three modes against a fake FactoriCord API. It checks the game
installation, collector registration, event upload, RCON, the FSM web UI and clean shutdown:
docker build -t factoricord:test . && bash tests/smoke-test.sh factoricord:test
main: the image is built and
tested, then published for amd64 and arm64 with the <client>-<mod>, latest and sha-<commit> tags. A
pre-release does not move latest. The release name is free, but v1.0.1-1.1.1 is recommended.main and on
every release.Secrets to define in the GitHub repository (Settings > Secrets and variables > Actions):
| Secret | Value |
|---|---|
DOCKER_USERNAME | Docker Hub account that owns (or administers) ocelus/factoricord |
DOCKER_PASSWORD | Account password, or an access token with the Read, Write, Delete scope (a Read & Write token is enough to push the image, but not to update the description) |
If it fails, the Docker Hub description workflow reports the cause: rejected credentials, insufficient permissions on the repository, or README content blocked by the Docker Hub firewall.
Content type
Image
Digest
sha256:d2787ea60…
Size
69.3 MB
Last updated
29 days ago
docker pull ocelus/factoricord