create default config from environment variables
This commit is contained in:
parent
4c299b9656
commit
628aa462ea
10 changed files with 127 additions and 79 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
conf/cluster_token.txt
|
cluster_token.txt
|
||||||
|
docker-compose.yml
|
||||||
|
|
||||||
|
|
10
Dockerfile
10
Dockerfile
|
@ -1,5 +1,15 @@
|
||||||
FROM zombi/steam:latest
|
FROM zombi/steam:latest
|
||||||
|
|
||||||
|
ENV \
|
||||||
|
DST_CLUSTER_TOKEN=changeme \
|
||||||
|
DST_GAME_MODE=survival \
|
||||||
|
DST_MAX_PLAYERS=6 \
|
||||||
|
DST_PVP=false \
|
||||||
|
DST_PAUSE_WHEN_EMPTY=true \
|
||||||
|
DST_CLUSTER_DESCRIPTION=Don't\ Starve\ server \
|
||||||
|
DST_CLUSTER_NAME=Don't\ Starve\ Server \
|
||||||
|
DST_CLUSTER_INTENTION=cooperative
|
||||||
|
|
||||||
RUN dpkg --add-architecture i386
|
RUN dpkg --add-architecture i386
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y libcurl4-gnutls-dev:i386
|
RUN apt-get install -y libcurl4-gnutls-dev:i386
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
[NETWORK]
|
|
||||||
server_port = 11001
|
|
||||||
|
|
||||||
|
|
||||||
[SHARD]
|
|
||||||
is_master = false
|
|
||||||
name = Caves
|
|
||||||
|
|
||||||
|
|
||||||
[STEAM]
|
|
||||||
master_server_port = 27019
|
|
||||||
authentication_port = 8769
|
|
|
@ -1,4 +0,0 @@
|
||||||
return {
|
|
||||||
override_enabled = true,
|
|
||||||
preset = "DST_CAVE",
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
[NETWORK]
|
|
||||||
server_port = 11000
|
|
||||||
|
|
||||||
|
|
||||||
[SHARD]
|
|
||||||
is_master = true
|
|
||||||
|
|
||||||
|
|
||||||
[STEAM]
|
|
||||||
master_server_port = 27018
|
|
||||||
authentication_port = 8768
|
|
|
@ -1 +0,0 @@
|
||||||
KU_W-8duuIH
|
|
|
@ -1,25 +0,0 @@
|
||||||
[GAMEPLAY]
|
|
||||||
game_mode = survival
|
|
||||||
max_players = 6
|
|
||||||
pvp = false
|
|
||||||
pause_when_empty = true
|
|
||||||
|
|
||||||
|
|
||||||
[NETWORK]
|
|
||||||
cluster_description = Don't Starve server of the Zom.bi community
|
|
||||||
cluster_name = Zom.bi
|
|
||||||
cluster_intention = cooperative
|
|
||||||
cluster_password = banana
|
|
||||||
server_password = banana
|
|
||||||
|
|
||||||
|
|
||||||
[MISC]
|
|
||||||
console_enabled = true
|
|
||||||
|
|
||||||
|
|
||||||
[SHARD]
|
|
||||||
shard_enabled = true
|
|
||||||
bind_ip = 127.0.0.1
|
|
||||||
master_ip = 127.0.0.1
|
|
||||||
master_port = 10889
|
|
||||||
cluster_key = paul
|
|
|
@ -1,21 +0,0 @@
|
||||||
version: '2'
|
|
||||||
|
|
||||||
services:
|
|
||||||
server:
|
|
||||||
build: .
|
|
||||||
stdin_open: true
|
|
||||||
tty: true
|
|
||||||
environment:
|
|
||||||
- "CLUSTER_TOKEN=pds-g^KU_W-8duuIH^mHR5MxsqERUXwCO6RsRx0CBPADHhtk1mem6U43jTGn8="
|
|
||||||
ports:
|
|
||||||
- 11000:11000
|
|
||||||
- 11000:11000/udp
|
|
||||||
- 27018:27018
|
|
||||||
- 27018:27018/udp
|
|
||||||
- 8768
|
|
||||||
#volumes:
|
|
||||||
#- /data/steam-games/:/home/steam/games/:rw
|
|
||||||
#- world:/home/steam/.klei/DoNotStarveTogether/Zom.bi/save
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
world:
|
|
27
docker-compose.yml.dist
Normal file
27
docker-compose.yml.dist
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
version: '2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
server:
|
||||||
|
build: .
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
environment:
|
||||||
|
- "DST_CLUSTER_TOKEN=setmesetmesetmesetmesetme"
|
||||||
|
- "DST_GAME_MODE=survival"
|
||||||
|
- "DST_MAX_PLAYERS=6"
|
||||||
|
- "DST_PVP=false"
|
||||||
|
- "DST_PAUSE_WHEN_EMPTY=true"
|
||||||
|
- "DST_CLUSTER_DESCRIPTION=Don't Starve server running in a container"
|
||||||
|
- "DST_CLUSTER_NAME=Contained world"
|
||||||
|
- "DST_CLUSTER_INTENTION=cooperative"
|
||||||
|
- "DST_CLUSTER_PASSWORD=set"
|
||||||
|
ports:
|
||||||
|
- 11000:11000
|
||||||
|
- 11000:11000/udp
|
||||||
|
- 27018:27018
|
||||||
|
- 27018:27018/udp
|
||||||
|
- 8768
|
||||||
|
#volumes:
|
||||||
|
#- server:/home/steam/.klei/DoNotStarveTogether/
|
||||||
|
#- /data/steam-games/:/home/steam/games/:rw
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
function fail {
|
||||||
|
# Write to stderr
|
||||||
|
echo "ERROR: $@" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# what are we trying to install?
|
# what are we trying to install?
|
||||||
game_nm="DST"
|
game_nm="DST"
|
||||||
game_id=343050
|
game_id=343050
|
||||||
|
|
||||||
cluster_name="Zom.bi"
|
DST_SERVER_DIR=${DST_SERVER_DIR:-'server'}
|
||||||
dontstarve_dir="$HOME/.klei/DoNotStarveTogether"
|
dontstarve_dir="$HOME/.klei/DoNotStarveTogether"
|
||||||
|
|
||||||
# install game to this directory
|
# install game to this directory
|
||||||
|
@ -27,9 +33,86 @@ else
|
||||||
echo "Skipped game installation."
|
echo "Skipped game installation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f ${dontstarve_dir}/${cluster_name}/cluster_token.txt ]]
|
# if game dir does not exist, create it
|
||||||
|
mkdir -p ${dontstarve_dir}/${DST_SERVER_DIR}
|
||||||
|
|
||||||
|
if [[ ! -w ${dontstarve_dir}/${DST_SERVER_DIR} ]]
|
||||||
then
|
then
|
||||||
echo "${CLUSTER_TOKEN}" > ${dontstarve_dir}/${cluster_name}/cluster_token.txt
|
fail "Not allowed to write to game dir as user $(id -u)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f ${dontstarve_dir}/${DST_SERVER_DIR}/cluster_token.txt ]]
|
||||||
|
then
|
||||||
|
mkdir -p ${dontstarve_dir}/${DST_SERVER_DIR}
|
||||||
|
echo "${DST_CLUSTER_TOKEN}" > ${dontstarve_dir}/${DST_SERVER_DIR}/cluster_token.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f ${dontstarve_dir}/${DST_SERVER_DIR}/cluster.ini ]]
|
||||||
|
then
|
||||||
|
mkdir -p ${dontstarve_dir}/${DST_SERVER_DIR}
|
||||||
|
cat <<- EOF > ${dontstarve_dir}/${DST_SERVER_DIR}/cluster.ini
|
||||||
|
[GAMEPLAY]
|
||||||
|
game_mode = ${DST_GAME_MODE}
|
||||||
|
max_players = ${DST_MAX_PLAYERS}
|
||||||
|
pvp = ${DST_PVP}
|
||||||
|
pause_when_empty = ${DST_}
|
||||||
|
|
||||||
|
[NETWORK]
|
||||||
|
cluster_description = ${DST_CLUSTER_DESCRIPTION}
|
||||||
|
cluster_name = ${DST_CLUSTER_NAME}
|
||||||
|
cluster_intention = ${DST_CLUSTER_INTENTION}
|
||||||
|
cluster_password = ${DST_CLUSTER_PASSWORD}
|
||||||
|
|
||||||
|
[MISC]
|
||||||
|
console_enabled = true
|
||||||
|
|
||||||
|
[SHARD]
|
||||||
|
shard_enabled = true
|
||||||
|
bind_ip = 127.0.0.1
|
||||||
|
master_ip = 127.0.0.1
|
||||||
|
master_port = 10889
|
||||||
|
cluster_key = paul
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f ${dontstarve_dir}/${DST_SERVER_DIR}/Master/server.ini ]]
|
||||||
|
then
|
||||||
|
mkdir -p ${dontstarve_dir}/${DST_SERVER_DIR}/Master
|
||||||
|
cat <<- EOF > ${dontstarve_dir}/${DST_SERVER_DIR}/Master/server.ini
|
||||||
|
[NETWORK]
|
||||||
|
server_port = 11000
|
||||||
|
|
||||||
|
[SHARD]
|
||||||
|
is_master = true
|
||||||
|
|
||||||
|
[STEAM]
|
||||||
|
master_server_port = 27018
|
||||||
|
authentication_port = 8768
|
||||||
|
|
||||||
|
[ACCOUNT]
|
||||||
|
encode_user_path = true
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f ${dontstarve_dir}/${DST_SERVER_DIR}/Caves/server.ini ]]
|
||||||
|
then
|
||||||
|
mkdir -p ${dontstarve_dir}/${DST_SERVER_DIR}/Caves
|
||||||
|
cat <<- EOF > ${dontstarve_dir}/${DST_SERVER_DIR}/Caves/server.ini
|
||||||
|
[NETWORK]
|
||||||
|
server_port = 11001
|
||||||
|
|
||||||
|
[SHARD]
|
||||||
|
is_master = false
|
||||||
|
name = Caves
|
||||||
|
id = 2521590582
|
||||||
|
|
||||||
|
[STEAM]
|
||||||
|
master_server_port = 27019
|
||||||
|
authentication_port = 8769
|
||||||
|
|
||||||
|
[ACCOUNT]
|
||||||
|
encode_user_path = true
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +121,7 @@ cd $installdir/bin
|
||||||
|
|
||||||
run_shared=(./dontstarve_dedicated_server_nullrenderer)
|
run_shared=(./dontstarve_dedicated_server_nullrenderer)
|
||||||
run_shared+=(-console)
|
run_shared+=(-console)
|
||||||
run_shared+=(-cluster "$cluster_name")
|
run_shared+=(-cluster "$DST_SERVER_DIR")
|
||||||
run_shared+=(-monitor_parent_process $$)
|
run_shared+=(-monitor_parent_process $$)
|
||||||
|
|
||||||
"${run_shared[@]}" -shard Caves | sed 's/^/Caves: /' &
|
"${run_shared[@]}" -shard Caves | sed 's/^/Caves: /' &
|
||||||
|
|
Loading…
Reference in a new issue