Page 1 of 1

Showing off new server

Posted: Wed Feb 06, 2019 9:41 pm
by adam_bise
Hi, I just ordered parts for a factorio server in preparation for 17.x/1.0

Let me know what you think?

ASRock Deskmini 310 - Intel H310 STX

Crucial DDR4 2666 2x8G cl16

Samsung 970 Evo 256GB

Intel G5600 CPU


I plan to run CentOS7. I may have a few micro services running, but it will primarily be dedicated for factorio =)

The SSD is overkill, but I can't justify not getting it due to the price.

The CPU was the biggest single thread bang for buck I could find. At least according to this benchmark.

I may try running 2 instances, one for each CPU core. I'm anxious to see how this will turn out. I wanted the server to be private, but if all goes well I may open up the 2nd instance to the public.

This will all run behind a 100Mbit connection.

Re: Showing off new server

Posted: Sun Feb 10, 2019 7:19 am
by adam_bise
Thought I would share my config in case anyone is interested in running multiple headless instances with systemd

Basically I extracted the headless server archive to 2 separate folders under /opt. I have /opt mounted to a SSD and / is on a mechanical disk.

So I have /opt/factorio/pub and /opt/factorio/prv I copied sample-server-settings.json from data to each root folder and named them prv.json and pub.json, then coped config/config.ini to config/pub.ini and config/prv.ini and filled out the settings.

Then I create 2 files in /etc/systemd/system/ .. factorio-prv.service and factorio-pub.service

Here is prv:
[Unit]
Description=Factorio Private Server

[Service]
Type=simple
User=adam
CPUAffinity=0

ExecStart=/opt/factorio/prv/bin/x64/factorio --start-server /opt/factorio/prv/saves/prv.zip --config /opt/factorio/prv/config/prv.ini --server-settings /opt/factorio/prv/prv.json --server-id /opt/factorio/prv/prv-id

and pub:
[Unit]
Description=Factorio Public Server

[Service]
Type=simple
User=adam
CPUAffinity=1

ExecStart=/opt/factorio/pub/bin/x64/factorio --start-server /opt/factorio/pub/saves/pub.zip --config /opt/factorio/pub/config/pub.ini --server-settings /opt/factorio/pub/pub.json --server-id /opt/factorio/pub/pub-id

ofc you want to specify separate ports in each ini

My CPU is 2 core 4 thread, so I check /sys/devices/system/cpu/cpu#/topology/thread_siblings to find HT pairs, and dedicate each service to a separate physical core. thread_siblings will have a number and other siblings will have the same number, those are logical threads of the same physical core, so I pick any 2 with different data in the siblings file.

Then use sudo systemctl start factorio-pxx.service and can close ssh window, logout etc. and the servers will continue to run. You can also choose to enable the service on startup, but I elected not to.

BTW in my original post I said I would use CentOS but choose Debian because CentOS7 glibc version is too old and I didn't want to mess with installing a side by side version when I wouldn't have to do so in Debian.

Re: Showing off new server

Posted: Fri Mar 08, 2019 5:15 pm
by squiddog
I run Ubuntu 18.04 on an old Mac Pro (upgraded to 6-core Xeon).

But all of my apps/games (including 3 Factorio servers) run in Docker containers. This way you don't care about glibc or whatever that are in the base OS. The container includes all possible libraries needed by the factorio executable.

Currently I use the image created by https://github.com/dtandersen/docker_factorio_server (the developer is a good guy) but may be switching over to https://github.com/goofball222/factorio just based on some things I like about how he constructed it.

Containers are the future for packaging and running apps, in large part to avoid the problems with conflicting/old libraries. Your base OS stays clean, very few things loaded in it, while the apps and all of their required libraries end up in the containers.

Re: Showing off new server

Posted: Fri Mar 08, 2019 5:20 pm
by squiddog
Here is my docker-compose.yml file for using the image by dtandersen.

Note that this is not usable by itself, one has to set the environment variables accordingly. External to this I'm setting the CPU to get affinity on different physical cores just like suggested above.

Code: Select all

version: '2.2'
services:
  factorio:
    image: "dtandersen/factorio:${LATEST}"
    cpus: 1
    cpuset: $MYCPU
    mem_limit: 6G
    mem_reservation: 4G
    restart: always
    network_mode: bridge
    ports:
     - "${GAME_PORT}:${GAME_PORT}/udp"
     - "${RCON_PORT}:${RCON_PORT}/tcp"
    environment:
      - PORT=${GAME_PORT}
      - RCON_PORT=${RCON_PORT}
    container_name: "${CONTAINER_NAME}"
    volumes:
     - ./volume:/factorio:delegated
     - ${PWD}/volume/config/config.ini:/opt/factorio/config/config.ini:delegated
    stdin_open: true
    tty: true