mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2024-12-25 10:28:22 +01:00
Merge remote-tracking branch 'remotes/origin/0.14.16'
# Conflicts: # Dockerfile # README.md
This commit is contained in:
commit
667bd97388
10
Dockerfile
10
Dockerfile
@ -14,11 +14,13 @@ RUN apk --update --no-cache add bash curl && \
|
||||
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
|
||||
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt && \
|
||||
rm /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||
cp /opt/factorio/data/server-settings.example.json /opt/factorio/data/server-settings.json && \
|
||||
cp /opt/factorio/data/map-gen-settings.example.json /opt/factorio/data/map-gen-settings.json && \
|
||||
apk --no-cache del curl
|
||||
apk --no-cache del curl && \
|
||||
ln -s /factorio/saves /opt/factorio/saves && \
|
||||
ln -s /factorio/mods /opt/factorio/mods && \
|
||||
ln -s /factorio/config/server-settings.json /opt/factorio/data/server-settings.json && \
|
||||
ln -s /factorio/config/map-gen-settings.json /opt/factorio/data/map-gen-settings.json
|
||||
|
||||
VOLUME /opt/factorio/saves /opt/factorio/mods
|
||||
VOLUME /factorio
|
||||
|
||||
EXPOSE 34197/udp 27015/tcp
|
||||
|
||||
|
121
README.md
121
README.md
@ -19,88 +19,73 @@ The game is very stable and optimized for building massive factories. You can cr
|
||||
|
||||
NOTE: This is only the server. The game is available on [Steam](http://store.steampowered.com/app/427520/).
|
||||
|
||||
# Features
|
||||
|
||||
* Configurable via ```server-config.json```.
|
||||
* Automatically loads the last save.
|
||||
* Volumes for saves and mods.
|
||||
* Small size. Based on Alpine Linux.
|
||||
|
||||
# How to use this image?
|
||||
# Usage
|
||||
|
||||
## Quick Start
|
||||
|
||||
Start the server in interactive mode for debugging. The game isn't saved.
|
||||
Begin by running the server to create the necessary folder structure and configuration files. For this example we'll use ```/tmp/factorio``` to store our data.
|
||||
|
||||
```
|
||||
docker run --rm -it -P dtandersen/factorio
|
||||
docker run -d -P -v /tmp/factorio:/factorio --name factorio dtandersen/factorio
|
||||
```
|
||||
|
||||
* ```--rm``` - Remove container after stopping
|
||||
* ```-it``` - Interactive mode, i.e. you can see the console
|
||||
Here is an explanation of the options:
|
||||
|
||||
* ```--d``` - Run as a daemon (detached).
|
||||
* ```-P``` - Expose all ports.
|
||||
* ```-v``` - Mount ```/tmp/factorio``` on the local file system to ```/factorio``` in the container.
|
||||
* ```--name``` - Name the container ```factorio``` (otherwise it has a random name).
|
||||
|
||||
## Usage
|
||||
|
||||
Normally the server runs as a daemon and a configuration file is specified. Volumes are mounted for saves and mods.
|
||||
|
||||
Create ```server-config.json``` and modify it to your liking.
|
||||
|
||||
```
|
||||
docker run -d -P \
|
||||
-v /path/to/server-config.json:/opt/factorio/data/server-config.json \
|
||||
-v /path/to/saves:/opt/factorio/saves \
|
||||
-v /path/to/mods:/opt/factorio/mods \
|
||||
--name factorio \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
* ```-d``` - Start the server as a daemon.
|
||||
* ```-P``` - Expose all ports.
|
||||
* ```-v``` - Mount volumes for config, mods, and saves.
|
||||
* ```--name``` - Give the container a name (otherwise it'll be random).
|
||||
|
||||
## Saves
|
||||
|
||||
The first time the server is started a new map is generated and saved as ```save.zip```. On subsequent runs the newest save is used. To load an old save ```touch save.zip``` and restart the server.
|
||||
|
||||
## Mods
|
||||
|
||||
Copy them into the mods folder and restart the server.
|
||||
|
||||
## Start/Stopping
|
||||
|
||||
Assuming the server is named ```factorio```, to stop the server:
|
||||
|
||||
```
|
||||
docker stop factorio
|
||||
```
|
||||
|
||||
To restart the server:
|
||||
|
||||
```
|
||||
docker start factorio
|
||||
```
|
||||
|
||||
## Volumes
|
||||
|
||||
* ```/opt/factorio/saves``` - Saves (recommened)
|
||||
* ```/opt/factorio/mods``` - Mods (optional)
|
||||
* ```/opt/factorio/data/server-config.json``` - Configuration (recommended)
|
||||
|
||||
## Ports
|
||||
|
||||
* ```34197/udp``` - Client (required)
|
||||
* ```27015/tcp``` - Remote console (optional)
|
||||
|
||||
## Logs
|
||||
|
||||
Sometimes it's useful to see the logs of a running container:
|
||||
Check the logs to see what happened:
|
||||
|
||||
```
|
||||
docker logs factorio
|
||||
```
|
||||
|
||||
Stop the server:
|
||||
|
||||
```docker stop factorio```
|
||||
|
||||
Now there's a ```server-settings.json``` file in the folder ```/tmp/factorio/config```. Modify this to your liking.
|
||||
|
||||
Restart the server:
|
||||
|
||||
```docker start factorio```
|
||||
|
||||
Try to connect to the server. Check the logs if it isn't working.
|
||||
|
||||
## Saves
|
||||
|
||||
A new map (```save.zip```) is generated the first time the server is started. On subsequent runs the newest save is used.
|
||||
|
||||
To load an old save ```touch save.zip``` and restart the server.
|
||||
|
||||
To generate a new map delete all of the saves and restart the server.
|
||||
|
||||
For custom map settings edit ```map-gen-settings.json``` in ```/tmp/factorio/config```. Then generate a new map.
|
||||
|
||||
## Mods
|
||||
|
||||
Copy the mods into the mods folder and restart the server.
|
||||
|
||||
# Container Details
|
||||
|
||||
## Volumes
|
||||
|
||||
The container has one volume located at ```/factorio```. Under this folder there are sub-folders for configuration, mods, and saves.
|
||||
|
||||
* ```/factorio```
|
||||
* ```/config```
|
||||
* ```server-settings.json```
|
||||
* ```map-gen-settings.json```
|
||||
* ```/mods```
|
||||
* ```/saves```
|
||||
|
||||
## Ports
|
||||
|
||||
* ```34197/udp``` - Factorio clients (required).
|
||||
* ```27015/tcp``` - RCON (optional).
|
||||
|
||||
# Credits
|
||||
|
||||
Based on [Zopanix' Factorio Server](https://github.com/zopanix/docker_factorio_server).
|
||||
|
@ -1,9 +1,22 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
set -e
|
||||
|
||||
SAVES=/opt/factorio/saves
|
||||
|
||||
if ! find $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
||||
#if [ -z $(find $SAVES -iname \*.zip -mindepth 1 -print | grep -q .) ]; then
|
||||
mkdir -p /factorio/saves
|
||||
mkdir -p /factorio/mods
|
||||
mkdir -p /factorio/config
|
||||
|
||||
if [ ! -f /factorio/config/server-settings.json ]; then
|
||||
cp /opt/factorio/data/server-settings.example.json /factorio/config/server-settings.json
|
||||
fi
|
||||
|
||||
if [ ! -f /factorio/config/map-gen-settings.json ]; then
|
||||
cp /opt/factorio/data/map-gen-settings.example.json /factorio/config/map-gen-settings.json
|
||||
fi
|
||||
|
||||
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
||||
/opt/factorio/bin/x64/factorio \
|
||||
--create $SAVES/save.zip \
|
||||
--map-gen-settings /opt/factorio/data/map-gen-settings.json
|
||||
|
@ -1,18 +0,0 @@
|
||||
{
|
||||
"_comment": "Sizes can be specified as none, very-low, low, normal, high, very-high",
|
||||
"terrain_segmentation": "normal",
|
||||
"water": "normal",
|
||||
"width": 0,
|
||||
"height": 0,
|
||||
"starting_area": "normal",
|
||||
"peaceful_mode": false,
|
||||
"autoplace_controls":
|
||||
{
|
||||
"coal": {"frequency": "very-low", "size": "high", "richness": "high"},
|
||||
"copper-ore": {"frequency": "very-low", "size": "high", "richness": "high"},
|
||||
"crude-oil": {"frequency": "normal", "size": "high", "richness": "high"},
|
||||
"enemy-base": {"frequency": "low", "size": "normal", "richness": "normal"},
|
||||
"iron-ore": {"frequency": "very-low", "size": "high", "richness": "high"},
|
||||
"stone": {"frequency": "very-low", "size": "normal", "richness": "normal"}
|
||||
}
|
||||
}
|
15
run.sh
15
run.sh
@ -1,12 +1,9 @@
|
||||
mkdir -p /tmp/factorio
|
||||
mkdir -p /tmp/factorio/mods
|
||||
mkdir -p /tmp/factorio/saves
|
||||
cp -n server-settings.example.json /tmp/factorio/server-settings.json
|
||||
cp -n map-gen-settings.example.json /tmp/factorio/map-gen-settings.json
|
||||
#mkdir -p /tmp/factorio/config
|
||||
#mkdir -p /tmp/factorio/mods
|
||||
#mkdir -p /tmp/factorio/saves
|
||||
#cp -n server-settings.example.json /tmp/factorio/config/server-settings.json
|
||||
#cp -n map-gen-settings.example.json /tmp/factorio/config/map-gen-settings.json
|
||||
sudo docker run --rm -it \
|
||||
-v /tmp/factorio/server-settings.json:/opt/factorio/data/server-settings.json \
|
||||
-v /tmp/factorio/map-gen-settings.json:/opt/factorio/data/map-gen-settings.json \
|
||||
-v /tmp/factorio/mods:/opt/factorio/mods \
|
||||
-v /tmp/factorio/saves:/opt/factorio/saves \
|
||||
-v /tmp/factorio:/factorio \
|
||||
--name factorio \
|
||||
factorio "$@"
|
||||
|
@ -1,57 +0,0 @@
|
||||
{
|
||||
"name": "Name of the game as it will appear in the game listing",
|
||||
"description": "Description of the game that will appear in the listing",
|
||||
"tags": ["game", "tags"],
|
||||
|
||||
"_comment_max_players": "Maximum number of players allowed, admins can join even a full server. 0 means unlimited.",
|
||||
"max_players": 0,
|
||||
|
||||
"_comment_visibility": ["public: Game will be published on the official Factorio matching server",
|
||||
"lan: Game will be broadcast on LAN"],
|
||||
"visibility":
|
||||
{
|
||||
"public": true,
|
||||
"lan": true
|
||||
},
|
||||
|
||||
"_comment_credentials": "Your factorio.com login credentials. Required for games with visibility public",
|
||||
"username": "",
|
||||
"password": "",
|
||||
|
||||
"_comment_token": "Authentication token. May be used instead of 'password' above.",
|
||||
"token": "",
|
||||
|
||||
"game_password": "",
|
||||
|
||||
"_comment_require_user_verification": "When set to true, the server will only allow clients that have a valid Factorio.com account",
|
||||
"require_user_verification": true,
|
||||
|
||||
"_comment_max_upload_in_kilobytes_per_second" : "optional, default value is 0. 0 means unlimited.",
|
||||
"max_upload_in_kilobytes_per_second": 0,
|
||||
|
||||
"_comment_ignore_player_limit_for_returning_players": "Players that played on this map already can join even when the max player limit was reached.",
|
||||
"ignore_player_limit_for_returning_players": false,
|
||||
|
||||
"_comment_allow_commands": "possible values are, true, false and admins-only",
|
||||
"allow_commands": "admins-only",
|
||||
|
||||
"_comment_autosave_interval": "Autosave interval in minutes",
|
||||
"autosave_interval": 10,
|
||||
|
||||
"_comment_autosave_slots": "server autosave slots, it is cycled through when the server autosaves.",
|
||||
"autosave_slots": 5,
|
||||
|
||||
"_comment_afk_autokick_interval": "How many minutes until someone is kicked when doing nothing, 0 for never.",
|
||||
"afk_autokick_interval": 0,
|
||||
|
||||
"_comment_auto_pause": "Whether should the server be paused when no players are present.",
|
||||
"auto_pause": true,
|
||||
|
||||
"only_admins_can_pause_the_game": true,
|
||||
|
||||
"_comment_autosave_only_on_server": "Whether autosaves should be saved only on server or also on all connected clients. Default is true.",
|
||||
"autosave_only_on_server": true,
|
||||
|
||||
"_comment_admins": "List of case insensitive usernames, that will be promoted immediately",
|
||||
"admins": []
|
||||
}
|
Loading…
Reference in New Issue
Block a user