This repository contains files needed to set up multi-instance Factorio servers running under systemd.
-
Clone:
$ git clone https://github.com/oko/factorio-systemd
-
Install files:
$ cd factorio-systemd $ sudo make install
-
Initialize a Factorio game:
$ sudo factorio-init myserver <...various script output...> Next steps: 1. Edit /etc/factorio/test2/config.ini to tweak server network config 2. Edit /etc/factorio/test2/server-settings.json to tweak server game config 3. Edit /etc/factorio/test2/map-gen-settings.json to tweak server mapgen config 4. Enable server with 'systemctl start factorio@test2' 5. Start server with 'systemctl start factorio@test2'
-
Tweak configuration and enable/start the server as explained by
factorio-init
-
If you need to reset the game, use
factorio-reset
(which stops the server, removes the game file, and restarts the server to letfactorio-init@$instance.service
recreate it)
Each instance $instance
runs under its own systemd service named factorio@$instance.service
, in the following environment:
- Each instance has its own config directory under
/etc/factorio/$instance
- Each instance has its own data directory under
/var/lib/factorio/$instance
- All instances run as the
factorio
user (created automatically byfactorio-init@$instance.service
if necessary) - All instances run sandboxed with
ProtectSystem=strict
andProtectHome=yes
- All instances run with read-write access to their own data directory only