Compare commits

..

37 Commits

Author SHA1 Message Date
7b70d806ad 0.14.20 2016-11-09 18:03:33 -08:00
433155549f 0.14.19 2016-11-04 13:38:12 -07:00
e7afbf7043 Merge branch 'master' of github.com:dtandersen/docker_factorio_server
Conflicts:
	0.14/Dockerfile
2016-11-04 20:28:37 +00:00
66a931efea don't cache 2016-11-04 20:25:41 +00:00
0df69d27ba 0.14.19 2016-11-04 20:25:28 +00:00
8b76ac8c69 minor text changes 2016-11-04 13:21:30 -07:00
39569f1ea2 minor text changes 2016-11-03 12:40:17 -07:00
8042aed70f minor text changes 2016-11-03 12:26:29 -07:00
52b9a5a0a5 0.14 is stable 2016-11-03 12:10:08 -07:00
bad5c783d7 minor text changes 2016-11-03 08:02:43 -07:00
72798cda20 minor text changes 2016-11-03 00:50:03 -07:00
57b221d308 minor text changes 2016-11-03 00:41:04 -07:00
7dd16c1e3a didn't need factorio.crt 2016-11-03 01:12:01 +00:00
7fe00ee1e1 0.4.18 2016-11-02 17:50:00 -07:00
2600a90c4e minor text changes 2016-11-02 16:48:00 -07:00
67e6e928a6 minor text changes 2016-11-02 16:42:24 -07:00
3643eebca1 minor text changes 2016-11-02 16:40:27 -07:00
012180bae6 proxy details 2016-11-02 15:37:22 -07:00
ff2bfae329 keep it simple 2016-11-02 12:20:47 -07:00
0309a94ed9 add 0.13 version 2016-11-01 14:01:30 -07:00
d10a30c01f experimental 0.13 version 2016-11-01 20:47:26 +00:00
52840aff65 clean /tmp/factorio 2016-11-01 20:32:57 +00:00
07b066754d show contents of /tmp/factorio 2016-11-01 20:32:37 +00:00
c6c76b5a41 Merge branch '0.14-dev' of github.com:dtandersen/docker_factorio_server into 0.14-dev 2016-11-01 20:32:00 +00:00
9fbd7d92bc use sh instead of bash 2016-11-01 20:31:24 +00:00
ef731d433a minor text changes 2016-11-01 10:15:18 -07:00
35ee88bf7f more on save files 2016-10-31 13:30:08 -07:00
fb0d9e444b first save is _autosave1.zip 2016-10-31 13:28:13 -07:00
b99b296865 first save is _autosave1.zip 2016-10-31 20:27:11 +00:00
7bedca570d pretty up tree 2016-10-31 13:20:47 -07:00
9a0de68628 rcon docs 2016-10-31 13:15:24 -07:00
08a2732ee3 update docs for rcon 2016-10-31 13:07:26 -07:00
c8d64cc1db set rcon password 2016-10-31 19:59:57 +00:00
f096877853 run with tini 2016-10-31 19:55:01 +00:00
bf83c650bc minor text changes 2016-10-27 16:14:16 -07:00
7205f9fb2a fix links 2016-10-27 16:07:35 -07:00
f9fbd2a59f updated to 0.14.17 2016-10-27 22:37:09 +00:00
12 changed files with 131 additions and 46 deletions

28
0.13/Dockerfile Normal file
View File

@ -0,0 +1,28 @@
FROM frolvlad/alpine-glibc:alpine-3.4
MAINTAINER https://github.com/dtandersen/docker_factorio_server
COPY ./factorio.crt /opt/factorio.crt
ENV VERSION=0.13.20 \
SHA1=59ed0edb3f62f0f41a01fc291959b0a8b44cf631
RUN apk --no-cache add curl tini pwgen && \
curl -sSL --cacert /opt/factorio.crt \
https://www.factorio.com/get-download/$VERSION/headless/linux64 \
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
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 && \
apk del curl && \
ln -s /factorio/saves /opt/factorio/saves && \
ln -s /factorio/mods /opt/factorio/mods
VOLUME /factorio
EXPOSE 34197/udp 27015/tcp
COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/docker-entrypoint.sh"]

1
0.13/build.sh Executable file
View File

@ -0,0 +1 @@
sudo docker build -t dtandersen/factorio:0.13-dev .

1
0.13/clean.sh Executable file
View File

@ -0,0 +1 @@
sudo rm -rf /tmp/factorio

35
0.13/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh -x
set -e
SAVES=/factorio/saves
CONFIG=/factorio/config
mkdir -p $SAVES
mkdir -p /factorio/mods
mkdir -p $CONFIG
if [ ! -f $CONFIG/rconpw ]; then
echo $(pwgen 15 1) > $CONFIG/rconpw
fi
if [ ! -f $CONFIG/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
fi
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $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/_autosave1.zip \
--map-gen-settings $CONFIG/map-gen-settings.json
fi
exec /opt/factorio/bin/x64/factorio \
--port 34197 \
--start-server-load-latest \
--server-settings $CONFIG/server-settings.json \
--rcon-port 27015 \
--rcon-password "$(cat $CONFIG/rconpw)"

5
0.13/run.sh Executable file
View File

@ -0,0 +1,5 @@
sudo docker run --rm -it \
-v /tmp/factorio:/factorio \
--name factorio \
dtandersen/factorio:0.13-dev "$@"
find /tmp/factorio -type f

View File

@ -2,23 +2,19 @@ FROM frolvlad/alpine-glibc:alpine-3.4
MAINTAINER https://github.com/dtandersen/docker_factorio_server MAINTAINER https://github.com/dtandersen/docker_factorio_server
COPY ./factorio.crt /opt/factorio.crt ENV VERSION=0.14.20 \
SHA1=d7c93754b543270aaa170aee01d8fd75fcc32c58
ENV VERSION=0.14.16 \ RUN mkdir /opt && \
SHA1=e27c658bf8a7579b662a1c34815daa223e57bc90 apk --no-cache add curl tini pwgen && \
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
RUN apk --update --no-cache add bash curl && \
curl -sSL --cacert /opt/factorio.crt \
https://www.factorio.com/get-download/$VERSION/headless/linux64 \
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \ -o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \ echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt && \ tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt && \
rm /tmp/factorio_headless_x64_$VERSION.tar.gz && \ rm /tmp/factorio_headless_x64_$VERSION.tar.gz && \
apk --no-cache del curl && \ apk del curl && \
ln -s /factorio/saves /opt/factorio/saves && \ ln -s /factorio/saves /opt/factorio/saves && \
ln -s /factorio/mods /opt/factorio/mods && \ 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 /factorio VOLUME /factorio
@ -26,4 +22,5 @@ EXPOSE 34197/udp 27015/tcp
COPY ./docker-entrypoint.sh / COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/docker-entrypoint.sh"] CMD ["/docker-entrypoint.sh"]

2
0.14/build.sh Normal file → Executable file
View File

@ -1 +1 @@
sudo docker build -t factorio . sudo docker build --no-cache -t factorio .

1
0.14/clean.sh Executable file
View File

@ -0,0 +1 @@
sudo rm -rf /tmp/factorio

29
0.14/docker-entrypoint.sh Normal file → Executable file
View File

@ -1,28 +1,35 @@
#!/bin/bash -x #!/bin/sh -x
set -e set -e
SAVES=/opt/factorio/saves SAVES=/factorio/saves
CONFIG=/factorio/config
mkdir -p /factorio/saves mkdir -p $SAVES
mkdir -p /factorio/mods mkdir -p /factorio/mods
mkdir -p /factorio/config mkdir -p $CONFIG
if [ ! -f /factorio/config/server-settings.json ]; then if [ ! -f $CONFIG/rconpw ]; then
cp /opt/factorio/data/server-settings.example.json /factorio/config/server-settings.json echo $(pwgen 15 1) > $CONFIG/rconpw
fi fi
if [ ! -f /factorio/config/map-gen-settings.json ]; then if [ ! -f $CONFIG/server-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json /factorio/config/map-gen-settings.json cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
fi
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
fi fi
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
/opt/factorio/bin/x64/factorio \ /opt/factorio/bin/x64/factorio \
--create $SAVES/save.zip \ --create $SAVES/_autosave1.zip \
--map-gen-settings /opt/factorio/data/map-gen-settings.json --map-gen-settings $CONFIG/map-gen-settings.json
fi fi
exec /opt/factorio/bin/x64/factorio \ exec /opt/factorio/bin/x64/factorio \
--port 34197 \ --port 34197 \
--start-server-load-latest \ --start-server-load-latest \
--server-settings /opt/factorio/data/server-settings.json --server-settings $CONFIG/server-settings.json \
--rcon-port 27015 \
--rcon-password "$(cat $CONFIG/rconpw)"

6
0.14/run.sh Normal file → Executable file
View File

@ -1,9 +1,5 @@
#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 \ sudo docker run --rm -it \
-v /tmp/factorio:/factorio \ -v /tmp/factorio:/factorio \
--name factorio \ --name factorio \
factorio "$@" factorio "$@"
find /tmp/factorio -type f

View File

@ -1,7 +1,8 @@
# Factorio [![Docker Pulls](https://img.shields.io/docker/pulls/dtandersen/factorio.svg)](https://hub.docker.com/r/dtandersen/factorio/) [![Docker Stars](https://img.shields.io/docker/stars/dtandersen/factorio.svg)](https://hub.docker.com/r/dtandersen/factorio/) # Factorio [![Docker Pulls](https://img.shields.io/docker/pulls/dtandersen/factorio.svg)](https://hub.docker.com/r/dtandersen/factorio/) [![Docker Stars](https://img.shields.io/docker/stars/dtandersen/factorio.svg)](https://hub.docker.com/r/dtandersen/factorio/)
* `0.14.16`, `0.14`, `latest` [(0.14.16/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/0.14.16/Dockerfile) * `0.14.20`, `0.14`, `latest` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.14/Dockerfile)
* `0.14.19`, `stable` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/0.14.19/0.14/Dockerfile)
* `0.13.20`, `0.13` [(0.13/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.13/Dockerfile)
# What is Factorio? # What is Factorio?
@ -21,14 +22,19 @@ NOTE: This is only the server. The game is available at [factorio.com](https://w
Run the server to create the necessary folder structure and configuration files. For this example data is stored in `/tmp/factorio`. Run the server to create the necessary folder structure and configuration files. For this example data is stored in `/tmp/factorio`.
``` ```
docker run -d -P -v /tmp/factorio:/factorio --name factorio dtandersen/factorio docker run -d -p 34197:34197/udp -p 27015:27015/tcp \
-v /tmp/factorio:/factorio \
--name factorio \
--restart=always \
dtandersen/factorio
``` ```
For those new to Docker, here is an explanation of the options: For those new to Docker, here is an explanation of the options:
* `-d` - Run as a daemon ("detached"). * `-d` - Run as a daemon ("detached").
* `-P` - Expose all ports. * `-p` - Expose ports.
* `-v` - Mount `/tmp/factorio` on the local file system to `/factorio` in the container. * `-v` - Mount `/tmp/factorio` on the local file system to `/factorio` in the container.
* `--restart` - Restart the server if it crashes and at system start
* `--name` - Name the container "factorio" (otherwise it has a funny random name). * `--name` - Name the container "factorio" (otherwise it has a funny random name).
Check the logs to see what happened: Check the logs to see what happened:
@ -54,9 +60,9 @@ Try to connect to the server. Check the logs if it isn't working.
## Saves ## Saves
A new map named `save.zip` is generated the first time the server is started. The `map-gen-settings.json` file in `/tmp/factorio/config` is used for the map settings. On subsequent runs the newest save is used. A new map named `_autosave1.zip` is generated the first time the server is started. The `map-gen-settings.json` file in `/tmp/factorio/config` is used for the map settings. On subsequent runs the newest save is used.
To load an old save stop the server and run the command `touch oldsave.zip`. This resets the date. Then restart the server. To load an old save stop the server and run the command `touch oldsave.zip`. This resets the date. Then restart the server. Another option is to delete all saves except one.
To generate a new map stop the server, delete all of the saves and restart the server. To generate a new map stop the server, delete all of the saves and restart the server.
@ -66,16 +72,20 @@ To generate a new map stop the server, delete all of the saves and restart the s
Copy mods into the mods folder and restart the server. Copy mods into the mods folder and restart the server.
## Remote Console ## RCON
RCON is currently disabled. Set the RCON password in the `rconpw` file. A random password is generated if `rconpw` doesn't exist.
To change the password stop the server, modify `rconpw`, and restart the server.
To "disable" RCON don't expose port 27015, i.e. start the server with `-p 34197:34197/udp` instead of `-P`. RCON still runs, but nobody is able to connect to it.
# Container Details # Container Details
The philosophy is to keep things simple. The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple).
* Self-configure to a minimal working state. * The server should bootstrap itself.
* Prefer configuration files over environment variables. * Prefer configuration files over environment variables.
* Use one volume for data. * Use one volume for data.
@ -86,13 +96,13 @@ To keep things simple, the container uses a single volume mounted at `/factorio`
factorio factorio
|-- config |-- config
| |-- server-settings.json | |-- map-gen-settings.json
| +-- map-gen-settings.json | |-- rconpw
| `-- server-settings.json
|-- mods |-- mods
| |-- fancymod.zip | `-- fancymod.zip
+-- saves `-- saves
|-- _autosave1.zip `-- _autosave1.zip
+-- save.zip
## Ports ## Ports
@ -103,9 +113,13 @@ To keep things simple, the container uses a single volume mounted at `/factorio`
## Troubleshooting ## Troubleshooting
**Server is listed in the in-game server browser, but users can't connect** **My server is listed in the server browser, but nobody can connect**
Run Docker with the `--userland-proxy=false` option. The source UDP port is changed by docker-proxy when the server pings "pingpong" servers. See [Incorrect port detected for docker hosted server](https://forums.factorio.com/viewtopic.php?f=49&t=35255). Check the logs. If there is the line `Own address is RIGHT IP:WRONG PORT`, then this could be caused by the Docker proxy. If the the IP and port is correct it's probably a port forwarding or firewall issue instead.
By default, Docker routes traffic through a proxy. The proxy changes the source UDP port, so the wrong port is detected. See the forum post *[Incorrect port detected for docker hosted server](https://forums.factorio.com/viewtopic.php?f=49&t=35255)* for details.
To fix the incorrect port, start the Docker service with the `--userland-proxy=false` switch. Docker will route traffic with iptables rules instead of a proxy. Add the switch to the `DOCKER_OPTS` environment variable or `ExecStart` in the Docker systemd service definition. The specifics vary by operating system.
# Credits # Credits