Sign inSign up

gotenxiao/factorio-clusterio

By gotenxiao

Updated about 8 years ago

A Factorio Clusterio container

Image
5

423

gotenxiao/factorio-clusterio repository overview

Volumes

  • /factorioClusterio/database/linvodb - where the master keeps its database
  • /factorioClusterio/instances - this is where all Factorio game instances will keep their data
  • /factorioClusterio/sharedMods - mods shared between clustered servers
  • /factorioClusterio/sharedPlugins - plugins shared between clustered servers - you will need to grab these from the factorioClusterio repository
  • /factorioClusterio/existing-saves - if you want to use an existing save file, mount a volume here and the save specified by FACTORIO_EXISTING_SAVE (see below) will be copied into the instance's save folder

Environment variables

  • CLUSTERIO_MODE - set to master or client

  • INSTANCE - set this to a string that represents the instance you wish to run

  • FACTORIOPORT - set this to a port number you want the Factorio server to run on, or leave unset to have a random port selected

  • RCONPORT - set this to a port number you want the Factorio server to listen for RCON traffic on, or leave unset to have a random port selected

  • FACTORIO_USERNAME - set to your Factorio.com username

  • FACTORIO_TOKEN or FACTORIO_TOKEN_FILE - either provide your Factorio.com token in the former, or mount a file (or use a Docker secret) that contains your token (without trailing newlines)

  • FACTORIO_PUBLIC_IP - the public IP address of your Factorio server; not needed on master nodes

  • FACTORIO_MASTER_IP - the public address (name or IP) of your master node; not needed on master nodes

  • FACTORIO_MASTER_PORT - the port that the master node will listen on (default 8080)

  • FACTORIO_MASTER_SSL_PORT - only used on master nodes in conjunction with FACTORIO_MASTER_SSL_CERTIFICATE_FILE and FACTORIO_MASTER_SSL_KEY_FILE to make the master listen on SSL (default 0 - leave it as this value to disable this). Only useful for protecting user access to the web UI. You may also put the master behind a proxy server (e.g. Traefik), but do not force redirection to SSL, as the client currently only expects HTTP.

  • FACTORIO_MASTER_AUTH_SECRET or FACTORIO_MASTER_AUTH_SECRET_FILE - this needs to be a randomly generated 256 byte string, URL-safe base64 encoded. Either run the master once, and take the value from /factorioClusterio/config.json, or generate one using the command below:

    dd if=/dev/urandom bs=256 count=1 | base64 -w0 | sed 's/\+/-/g; s/\//_/g; s/=//g' >> master-auth-secret
    
  • FACTORIO_MASTER_AUTH_TOKEN or FACTORIO_MASTER_AUTH_TOKEN_FILE - after the first run of the master, take the value of /factorioClusterio/secret-api-token.txt. Note that this value is valid for a year from generation.

  • FACTORIO_VERSION - used for checking mod compatibility (default 0.16)

  • FACTORIO_VERIFY_USER_IDENTITY - set to true or false to verify all users connecting have valid Factorio.com accounts (default false)

  • FACTORIO_VISIBILITY_PUBLIC - set to either true or false if you want your server to be visible to the public (default true)

  • FACTORIO_VISIBILITY_LAN - set to either true or false if you want your server to be visible on a LAN (default true)

  • FACTORIO_ALLOW_REMOTE_COMMAND_EXECUTION - set to either true or false

  • FACTORIO_ENABLE_CROSS_SERVER_SHOUT - set to either true or false (default true)

  • FACTORIO_MIRROR_ALL_CHAT - set to either true or false to enable chat mirroring between clustered servers (default false)

  • FACTORIO_EXISTING_SAVE - if you have an existing save file, mount the directory containing it under /factorioClusterio/existing-saves and put the name of the save (including the .zip extension) in this variable (default unset) to load it in, instead of having a new save generated

  • FACTORIO_GAME_PASSWORD - set a value for this if you want to password-protect your game

Example docker-compose.yml

version: '2.3'

services:
  master:
    image: gotenxiao/factorio-clusterio:latest
    init: true
    volumes:
      - ./data/instances:/factorioClusterio/instances
      - ./data/sharedMods:/factorioClusterio/sharedMods
      - ./data/sharedPlugins:/factorioClusterio/sharedPlugins
      - ./data/database:/factorioClusterio/database/linvodb
      - ./data/auth-secret.txt:/run/secrets/clusterio-master-auth-secret:ro
      - ./data/auth-token.txt:/run/secrets/clusterio-master-auth-token:ro
      - ./data/factorio-token:/run/secrets/factorio-token:ro
    ports:
      - '8080:8080'
    environment:
      - CLUSTERIO_MODE=master
      - INSTANCE=master
      - FACTORIO_MASTER_PORT=8080
      - FACTORIO_MASTER_AUTH_SECRET_FILE=/run/secrets/clusterio-master-auth-secret
      - FACTORIO_MASTER_AUTH_TOKEN_FILE=/run/secrets/clusterio-master-auth-token
      - FACTORIO_USERNAME=your-username-here
      - FACTORIO_TOKEN_FILE=/run/secrets/factorio-token

  bootstrap:
    image: gotenxiao/factorio-clusterio:latest
    init: true
    network_mode: host
    volumes:
      - ./data/instances:/factorioClusterio/instances
      - ./data/sharedMods:/factorioClusterio/sharedMods
      - ./data/sharedPlugins:/factorioClusterio/sharedPlugins
      - ./data/auth-token.txt:/run/secrets/clusterio-master-auth-token:ro
      - ./data/factorio-token:/run/secrets/factorio-token:ro
      - ./data/existing-saves:/factorioClusterio/existing-saves
    environment:
      - CLUSTERIO_MODE=client
      - INSTANCE=bootstrap
      - FACTORIOPORT=34198
      - RCONPORT=27016
      - FACTORIO_PUBLIC_IP=your-factorio-servers-public-ip
      - FACTORIO_MASTER_IP=your-master-address
      - FACTORIO_MASTER_PORT=8080
      - FACTORIO_MASTER_AUTH_TOKEN_FILE=/run/secrets/clusterio-master-auth-token
      - FACTORIO_USERNAME=your-username-here
      - FACTORIO_TOKEN_FILE=/run/secrets/factorio-token
      - FACTORIO_EXISTING_SAVE=special-save.zip
      - FACTORIO_GAME_PASSWORD=supersecretpassword

Tag summary

Content type

Image

Digest

Size

355.3 MB

Last updated

about 8 years ago

docker pull gotenxiao/factorio-clusterio