Commit ed89afba authored by Jan Grewe's avatar Jan Grewe
Browse files

initial commit

parents
#
# nQuakeSV - The nQuake Server
#
# docker run --name nquakesv \
# -p 28501:28501/udp -p 28501:28501 -p 28000:28000 -p 30000:30000/udp \
# -v /local/path/to/pak1.pak:/nquakesv/id1/pak1.pak \
# -e HOSTNAME=nQuakeSV -e HOSTDNS=qw.example.com \
# -e ADMINNAME="John Doe" -e ADMINEMAIL="john.doe@example.com" \
# -e RCON=changeme -e QTVPW=changeme -e FFA=1 \
# registry.faked.org/nquakesv
#
FROM ubuntu:latest
MAINTAINER Jan Grewe <jan@faked.org>
# msdsv
EXPOSE 28501/udp
# qtv
EXPOSE 28501/tcp
# qtv web
EXPOSE 28000/tcp
# qwfwd
EXPOSE 30000/udp
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -qq update && \
apt-get install -qqy --no-install-recommends \
ca-certificates \
curl \
supervisor \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ARG HOSTNAME
ENV HOSTNAME ${HOSTNAME:-nQuakeSV}
ARG HOSTDNS
ENV HOSTDNS ${HOSTDNS:-qw.example.com}
ARG QTV
ENV QTV ${QTV:-y}
ARG QWFWD
ENV QWFWD ${QWFWD:-y}
ARG ADMINNAME
ENV ADMINNAME ${ADMINNAME:-John Doe}
ARG ADMINEMAIL
ENV ADMINEMAIL ${ADMINEMAIL:-john.doe@example.com}
ARG RCON
ENV RCON ${RCON:-changeme}
ARG QTVPW
ENV QTVPW ${QTVPW:-changeme}
ARG SEARCHPAK
ENV SEARCHPAK ${SEARCHPAK:-n}
ARG FFA
ENV FFA ${FFA:-0}
ENV PORTS 1
RUN curl -kL https://github.com/nQuake/server-linux/blob/master/releases/nquakesv_installer-linux-latest.tar.gz?raw=true | tar xvz \
&& printf "/nquakesv\n$HOSTNAME\n$HOSTDNS\n$PORTS\n$QTV\n$QWFWD\n$ADMINNAME\n$ADMINEMAIL\n$RCON\n$QTVPW\n$SEARCHPAK\n\n" | /bin/bash /install_nquakesv.sh
COPY start.sh /nquakesv/start.sh
COPY supervisord.conf /etc/supervisor/supervisord.conf
WORKDIR /nquakesv
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
#!/bin/bash
dir='/nquakesv'
remote_ip=$(curl http://myip.dnsomatic.com)
[ -n "$hostdns" ] || hostdns=$remote_ip
echo "===== nQuakeSV Configuration ====="
echo "Setting server name: ${HOSTNAME}"
echo $hostname > ~/.nquakesv/hostname
/bin/sed -i "s/hostname .*/hostname ${HOSTNAME}/" ktx/port1.cfg
/bin/sed -i "s/.* k_motd1 .*/set k_motd1 \"${HOSTNAME}\"/" ktx/port1.cfg
/bin/sed -i "s/hostname .*/hostname ${HOSTNAME}/" qtv/qtv.cfg
/bin/sed -i "s/set hostname .*/set hostname \"${HOSTNAME}\"/" qwfwd/qwfwd.cfg
echo "Setting server hostname: ${HOSTDNS}"
echo $hostdns > ~/.nquakesv/hostdns
echo $remote_ip > ~/.nquakesv/ip
#/bin/sed -i "s/qtv .*/qtv ${HOSTDNS}:28501/" qtv/qtv.cfg
/bin/sed -i "s/qtv .*/qtv 127.0.0.1:28501/" qtv/qtv.cfg
/bin/sed -i "s/sv_serverip .*/sv_serverip \"${remote_ip}:28501\"/" ktx/port1.cfg
echo "Setting server admin: ${ADMINNAME} <${ADMINEMAIL}>"
echo "${ADMINNAME} <${ADMINEMAIL}>" > ~/.nquakesv/admin
/bin/sed -i "s/sv_admininfo .*/sv_admininfo \"${ADMINNAME} <${ADMINEMAIL}>\"/" ktx/port1.cfg
echo "Setting rcon password: ${RCON}"
/bin/sed -i "s/rcon_password \".*\".*/rcon_password \"${RCON}\"/" ${dir}/ktx/pwd.cfg
echo "Setting Qtv password: ${QTVPW}"
/bin/sed -i "s/admin_password .*/admin_password ${QTVPW}/" qtv/qtv.cfg
echo "Enabled FFA: ${FFA}"
/bin/sed -i "s/set k_matchless .*/set k_matchless ${FFA}/" ktx/port1.cfg
if [ ${FFA} == 1 ]; then
/bin/sed -i "s/set k_use_matchless_dir .*/set k_use_matchless_dir 0/" ktx/port1.cfg
/bin/sed -i "s/set k_defmode .*/set k_defmode ffa/" ktx/port1.cfg
/bin/sed -i "s/set k_mode .*/set k_mode 3/" ktx/port1.cfg
echo "samelevel 0" >> ktx/port1.cfg
echo 'set k_ml_0 "dm1"' >> ktx/port1.cfg
echo 'set k_ml_0 "dm2"' >> ktx/port1.cfg
echo 'set k_ml_0 "dm3"' >> ktx/port1.cfg
echo 'set k_ml_0 "dm4"' >> ktx/port1.cfg
echo 'set k_ml_0 "dm5"' >> ktx/port1.cfg
echo 'set k_ml_0 "dm6"' >> ktx/port1.cfg
fi
echo "=================================="
/usr/bin/supervisorctl start nquakesv:*
exit 0
[supervisord]
nodaemon=true
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[unix_http_server]
file = /tmp/supervisor.sock
[inet_http_server]
port=28999
[supervisorctl]
serverurl = unix:///tmp/supervisor.sock
[group:nquakesv]
programs=mvdsv,qwfwd,qtv
[program:start]
command=/nquakesv/start.sh
startsecs=0
autostart=true
autorestart=false
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
[program:mvdsv]
command=/nquakesv/mvdsv -port 28501 -game ktx +exec port1.cfg
directory=/nquakesv
autostart=false
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true
[program:qwfwd]
command=/nquakesv/qwfwd/qwfwd.bin
directory=/nquakesv/qwfwd
autostart=false
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true
[program:qtv]
command=/nquakesv/qtv/qtv.bin +exec qtv.cfg
directory=/nquakesv/qtv
autostart=false
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment