diff --git a/README.md b/README.md index 500845c..c796718 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,4 @@ No guarantee for completeness or functionality. |[dragonchaser/webtest](https://hub.docker.com/r/dragonchaser/webtest)|webtest|A small container running ruby WebRick and serves static content from /web|x|x| |[dragonchaser/nginx-matrix](https://hub.docker.com/r/dragonchaser/nginx-matrix)|nginx-matrix|A modification of the nginx:latest image that exposes tcp ports 80,443 and 8448 for use as reverse proxy with a matrix server (e.g. synapse)|x|x| |[dragonchaser/matrix-synapse](https://hub.docker.com/r/dragonchaser/matrix-synapse)|matrix-synapse|**WIP** A container running the matrix reference server synapse|x|x| +|[dragonchaser/motsognir](https://hub.docker.com/r/dragonchaser/motsognir) |motsognir|A container for the motsognir gopher server|x|x| diff --git a/motsognir/Dockerfile b/motsognir/Dockerfile new file mode 100644 index 0000000..04c7269 --- /dev/null +++ b/motsognir/Dockerfile @@ -0,0 +1,18 @@ +FROM debian:latest +LABEL maintainer="dragonchaser " +ENV TARBALL=motsognir-1.0.12.tar.xz +EXPOSE 70 +RUN apt-get update \ + && apt-get -y install wget build-essential rsyslog +WORKDIR /build +RUN wget "https://downloads.sourceforge.net/project/motsognir/v1.0.12/${TARBALL}" \ + && tar xfv "${TARBALL}" +RUN cd $(echo "${TARBALL}" | sed -e "s/.tar.xz//g") && make all && make install +RUN apt-get -y purge wget build-essential +RUN rm -Rfv /etc/apt/sources.list.* +RUN rm -Rfv /build +RUN useradd -ms /bin/bash -d /gopher gopher +WORKDIR /gopher +COPY entrypoint.sh / +COPY rsyslog.conf /etc +ENTRYPOINT ["/entrypoint.sh"] diff --git a/motsognir/Dockerfile.arm32v7 b/motsognir/Dockerfile.arm32v7 new file mode 100644 index 0000000..75bdb30 --- /dev/null +++ b/motsognir/Dockerfile.arm32v7 @@ -0,0 +1,18 @@ +FROM arm32v7/debian:buster-slim +COPY qemu-arm-static /usr/bin +ENV TARBALL=motsognir-1.0.12.tar.xz +EXPOSE 70 +RUN apt-get update \ + && apt-get -y install wget build-essential rsyslog +WORKDIR /build +RUN wget "https://downloads.sourceforge.net/project/motsognir/v1.0.12/${TARBALL}" \ + && tar xfv "${TARBALL}" +RUN cd $(echo "${TARBALL}" | sed -e "s/.tar.xz//g") && make all && make install +RUN apt-get -y purge wget build-essential +RUN rm -Rfv /etc/apt/sources.list.* +RUN rm -Rfv /build +RUN useradd -ms /bin/bash -d /gopher gopher +WORKDIR /gopher +COPY entrypoint.sh / +COPY rsyslog.conf /etc +ENTRYPOINT ["/entrypoint.sh"] diff --git a/motsognir/README.md b/motsognir/README.md new file mode 100644 index 0000000..f277048 --- /dev/null +++ b/motsognir/README.md @@ -0,0 +1,25 @@ +# motsognir + +A container for the motsognir gopher server http://motsognir.sourceforge.net/ + +## Running locally + +**x86_64** + +``` +$> docker run -p 70:70 -v /path/to/you/local/gopherfolder:/gopher dragonchaser/motsognir:latest +``` + +**arm32v7** + +``` +$> docker run -p 70:70 -v /path/to/you/local/gopherfolder:/gopher dragonchaser/motsognir:latest-arm32v7 +``` + +**Notes:** +- `motsognir.conf` needs to live in `/gopher` +- I suggest serving files from a subdirectory of `/gopher` +- I suggest also to use the `gopher` user in the `RunAsUser` variable in `/gopher/motsognir.conf` +- the container uses a bare minimal of an operating system needed to run + motsognir, for debugging it might make sense to run `apt-get install procps` + in the container diff --git a/motsognir/entrypoint.sh b/motsognir/entrypoint.sh new file mode 100755 index 0000000..08da195 --- /dev/null +++ b/motsognir/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash +CONFIGFILE=${CONFIGFILE:-/gopher/motsognir.conf} +if [ ! -f ${CONFIGFILE} ]; then + echo "${CONFIGFILE} can not be found; bailing out!"; exit 1; +fi +echo "Using ${CONFIGFILE} to start motsognir" +trap "echo TRAPed signal" HUP INT QUIT TERM +touch /var/log/syslog +rsyslogd -n & sleep 20 && +motsognir --config "${CONFIGFILE}" +tail -f /var/log/syslog diff --git a/motsognir/hooks/post_checkout b/motsognir/hooks/post_checkout new file mode 100644 index 0000000..5c42267 --- /dev/null +++ b/motsognir/hooks/post_checkout @@ -0,0 +1,2 @@ +#!/bin/bash +curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static . && pwd && ls diff --git a/motsognir/hooks/pre_build b/motsognir/hooks/pre_build new file mode 100644 index 0000000..2c34175 --- /dev/null +++ b/motsognir/hooks/pre_build @@ -0,0 +1,4 @@ +#!/bin/bash +#register qemu-*-static for all supported processors except the +# current one, but also remove all registered binfmt_misc before +docker run --rm --privileged multiarch/qemu-user-static:register --reset diff --git a/motsognir/rsyslog.conf b/motsognir/rsyslog.conf new file mode 100644 index 0000000..62e437f --- /dev/null +++ b/motsognir/rsyslog.conf @@ -0,0 +1,92 @@ +# /etc/rsyslog.conf configuration file for rsyslog +# +# For more information install rsyslog-doc and see +# /usr/share/doc/rsyslog-doc/html/configuration/index.html + + +################# +#### MODULES #### +################# + +module(load="imuxsock") # provides support for local system logging +#module(load="imklog") # provides kernel logging support +#module(load="immark") # provides --MARK-- message capability + +# provides UDP syslog reception +#module(load="imudp") +#input(type="imudp" port="514") + +# provides TCP syslog reception +#module(load="imtcp") +#input(type="imtcp" port="514") + + +########################### +#### GLOBAL DIRECTIVES #### +########################### + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# +# Where to place spool and state files +# +$WorkDirectory /var/spool/rsyslog + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + + +############### +#### RULES #### +############### + +# +# First some standard log files. Log by facility. +# +auth,authpriv.* /var/log/auth.log +*.*;auth,authpriv.none -/var/log/syslog +#cron.* /var/log/cron.log +daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +lpr.* -/var/log/lpr.log +mail.* -/var/log/mail.log +user.* -/var/log/user.log + +# +# Logging for the mail system. Split it up so that +# it is easy to write scripts to parse these files. +# +mail.info -/var/log/mail.info +mail.warn -/var/log/mail.warn +mail.err /var/log/mail.err + +# +# Some "catch-all" log files. +# +*.=debug;\ + auth,authpriv.none;\ + news.none;mail.none -/var/log/debug +*.=info;*.=notice;*.=warn;\ + auth,authpriv.none;\ + cron,daemon.none;\ + mail,news.none -/var/log/messages + +# +# Emergencies are sent to everybody logged in. +# +*.emerg :omusrmsg:*