-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* v2-alpha refactor * simplify directory structure. * Install SteamCMD to its own directory. * Move control script to system root for simplicity. * Use serverconfig.xml from server install so I don't have to maintain kv's.
- Loading branch information
Showing
6 changed files
with
77 additions
and
147 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
PARAMS=$@ | ||
LIVINGDEAD_HOME=/home/livingdead | ||
# This script manages the 7 days to Die server. | ||
# $DATA_HOME and $STEAM_HOME are set in Dockerfile | ||
|
||
cd $LIVINGDEAD_HOME | ||
PARAMS="$@" | ||
|
||
echo "Downloading Steam Cmd" | ||
su -l livingdead -c "wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz -O steamcmd_linux.tar.gz" | ||
su -l livingdead -c "tar -zxf steamcmd_linux.tar.gz -C ./bin" | ||
if [ ! -d ${DATA_HOME}/log ]; then | ||
mkdir ${DATA_HOME}/log | ||
fi | ||
|
||
echo "Downloading 7 Days to Die Server" | ||
su -l livingdead -c "mkdir -p ${LIVINGDEAD_HOME}/server" | ||
su -l livingdead -c "${LIVINGDEAD_HOME}/bin/steamcmd.sh \ | ||
+login anonymous \ | ||
+force_install_dir ${LIVINGDEAD_HOME}/server \ | ||
+app_update 294420 \ | ||
+quit" | ||
LOGFILE="${DATA_HOME}/log/7dtd-launcher-$(date +%Y%m%d).log" | ||
|
||
echo "Launching 7 Days to Die" | ||
export LD_LIBRARY_PATH=$LIVINGDEAD_HOME/server | ||
su -l livingdead -c "${LIVINGDEAD_HOME}/server/7DaysToDieServer.x86_64 \ | ||
-configfile=${LIVINGDEAD_HOME}/serverconfig.xml \ | ||
-logfile ${LIVINGDEAD_HOME}/server/output.log \ | ||
-quit -batchmode -nographics -dedicated $PARAMS" | ||
echo $(date -u) "Checking for server updates" >> ${LOGFILE} | ||
${STEAM_HOME}/steamcmd.sh \ | ||
+login anonymous \ | ||
+force_install_dir ${DATA_HOME}/server \ | ||
+app_update 294420 \ | ||
+quit >> ${LOGFILE} | ||
|
||
if [ ! -f ${DATA_HOME}/serverconfig.xml ]; then | ||
echo $(date -u) "Installing default serverconfig.xml into ${DATA_HOME}/serverconfig.xml" >> ${LOGFILE} | ||
echo $(date -u) "Make sure to update the configuration and restart your server." >> ${LOGFILE} | ||
cp ${DATA_HOME}/server/serverconfig.xml ${DATA_HOME}/serverconfig.xml | ||
fi | ||
|
||
echo $(date -u) "Launching 7 Days to Die Server" >> ${LOGFILE} | ||
export LD_LIBRARY_PATH=${DATA_HOME}/server:$LD_LIBRARY_PATH | ||
${DATA_HOME}/server/7DaysToDieServer.x86_64 \ | ||
-configfile=${DATA_HOME}/serverconfig.xml \ | ||
-logfile ${DATA_HOME}/log/7dtd-server-$(date +%Y%m%d).log \ | ||
-quit -batchmode -nographics -dedicated ${PARAMS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
|
||
FROM debian:latest | ||
LABEL maintainer="mudfly <mudfly@gmail.com>" | ||
|
||
RUN dpkg --add-architecture i386 && \ | ||
apt-get update && \ | ||
apt-get install -y \ | ||
curl \ | ||
lib32gcc1 \ | ||
xmlstarlet && \ | ||
apt-get clean all | ||
|
||
ENV STEAM_HOME="/steam" | ||
ENV DATA_HOME="/data" | ||
|
||
MAINTAINER mudfly | ||
RUN /usr/sbin/useradd -d ${DATA_HOME} -M -s /bin/bash zed && \ | ||
/bin/mkdir ${STEAM_HOME} && \ | ||
/bin/chown -R zed:zed ${STEAM_HOME} | ||
|
||
# Install dependencies | ||
RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y \ | ||
lib32gcc1 \ | ||
wget \ | ||
xmlstarlet \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
USER zed | ||
|
||
# Creates 7dtd server as a service | ||
RUN useradd -ms /bin/bash livingdead | ||
WORKDIR /home/livingdead | ||
COPY serverconfig.xml serverconfig.xml | ||
COPY 7dtd.sh bin/7dtd | ||
RUN chown -R livingdead:livingdead /home/livingdead | ||
RUN curl -s https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz | tar xvz -C ${STEAM_HOME} | ||
|
||
# Expose the default 7dtd server port | ||
EXPOSE 8080/tcp 8081/tcp | ||
EXPOSE 26900 26901 26902 | ||
COPY --chown=zed:zed 7dtd.sh /7dtd.sh | ||
|
||
CMD ["/home/livingdead/bin/7dtd"] | ||
VOLUME ["/data"] | ||
EXPOSE 8080/tcp 8081/tcp 26900 26901 26902 | ||
CMD ["/bin/bash", "/7dtd.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
#Docker file for a 7 Days To Die Server | ||
# 7 Days To Die Server in a Docker Container | ||
|
||
##Maintainers | ||
## Maintainers | ||
Mudfly <mudfly@gmail.com> | ||
|
||
##Build and Run Server | ||
1. Clone this repository, and change into the directory | ||
2. Copy `server.xml.example` to `server.xml`, and edit to your linking | ||
3. Build the Docker image `docker build --build-arg STEAM_USER=<user> --build-arg STEAM_PASS=<password> --build-arg STEAM_GUARD=<steam guard code> -t 7dtd .` | ||
4. Start the 7 Days To Die server `./7dtd-server.run` | ||
## Prerequisites | ||
1. Docker Engine | ||
2. docker-compose | ||
|
||
## Build and Run Server | ||
1. Clone this repository, and change into the cloned directory | ||
2. Build the Docker image `docker-compose build` | ||
3. Start the 7 Days To Die server `docker-compose up -d` | ||
|
||
Note: This container makes use of a data volume under /srv/7dtd on the docker host, in order to persist the generated worlds between container restarts. If you would like to move this to another location, update docker-compose.yaml before launching the container. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '2.1' | ||
|
||
services: | ||
7dtd: | ||
build: | ||
context: . | ||
container_name: 7dtd | ||
image: 7dtd:latest | ||
restart: unless-stopped | ||
ports: | ||
- "8080:8080" | ||
- "8081:8081" | ||
- "26900:26900/udp" | ||
- "26901:26901/udp" | ||
- "26902:26902/udp" | ||
volumes: | ||
- /srv/7dtd:/data |
This file was deleted.
Oops, something went wrong.