commit e9ec6fbcabf8d96319e45160ff6c70bcc8d45017 Author: Julian Ospald Date: Thu Jun 7 14:49:58 2018 +0200 Initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8ccc133 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM alpine:latest +MAINTAINER Julian Ospald + + +##### PACKAGE INSTALLATION ##### + +RUN apk --no-cache add \ + bash \ + umurmur + +################################ + +COPY ./config/umurmur.conf /etc/umurmur/umurmur.conf +RUN mkdir /umurmurconfig +COPY ./config/channels.conf /umurmurconfig/ + +COPY ./setup.sh /setup.sh +RUN chmod +x /setup.sh + +EXPOSE 64738 + +CMD /setup.sh && exec /usr/bin/umurmurd -d -c /etc/umurmur/umurmur.conf diff --git a/README.md b/README.md new file mode 100644 index 0000000..a96a321 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +## Installation + +```sh +docker build -t hasufell/alpine-umurmur . +``` + +## Configuration + +All configuration variables (except channel configuration) +from the [config file](https://code.google.com/p/umurmur/wiki/Configuring02x) +can simply be set when starting the container via the `-e` switches. E.g. +if you want to set `password = "abc";` in `umurmur.conf` you just pass +`-e password=abc` to the `docker run` command. + +If you don't like the `-e`-foo just modify `config/umurmur.conf` and +`config/channels.conf` in-place in this repository or mount them into +the container from the host. + +### Channels + +Either modify `config/channels.conf` directly or mount your own `channels.conf` +in from the host. It must be in the container at the location +`/umurmurconfig/channels.conf`! So e.g.: + +```sh + -v /var/lib/umurmurconf/channels.conf:/umurmurconfig/channels.conf +``` + +### Certificates + +Mount in your private key and certificate from the host into the container, +e.g. at `/etc/ssl/` and then pass the environment variables `certificate` +and `private_key` to `docker run`. + +E.g.: + +```sh + -v /ets/ssl/mydomain:/etc/ssl/mydomain \ + -e certificate=/etc/ssl/mydomain/foo.crt \ + -e private_key=/etc/ssl/mydomain/foo.key +``` + +## Running + +A full command could look like this: + +```sh +docker run -ti -d \ + --name=umurmur \ + -v /var/lib/umurmurconf/channels.conf:/umurmurconfig/channels.conf \ + -v /ets/ssl/mydomain:/etc/ssl/mydomain \ + -e certificate=/etc/ssl/mydomain/foo.crt \ + -e private_key=/etc/ssl/mydomain/foo.key \ + -e password=blah \ + -e admin_password=foo \ + -e username=murmur \ + -e groupname=murmur \ + -p 64738:64738 \ + hasufell/alpine-umurmur +``` + + diff --git a/config/channels.conf b/config/channels.conf new file mode 100644 index 0000000..cc63862 --- /dev/null +++ b/config/channels.conf @@ -0,0 +1,34 @@ +channels = ( { + name = "Root"; + parent = ""; + description = "The Root of all channels"; + noenter = true; + }, + { + name = "Lobby"; + parent = "Root"; + description = "Lobby channel"; + }, + { + name = "Red team"; + parent = "Lobby"; + description = "The Red team channel"; + }, + { + name = "Blue team"; + parent = "Lobby"; + description = "The Blue team channel"; + } +); +# Channel links configuration. +channel_links = ( { + source = "Lobby"; + destination = "Red team"; + }, + { + source = "Lobby"; + destination = "Blue team"; + } +); + +default_channel = "Lobby"; diff --git a/config/supervisord.conf b/config/supervisord.conf new file mode 100644 index 0000000..2b6f99d --- /dev/null +++ b/config/supervisord.conf @@ -0,0 +1,6 @@ +[supervisord] +nodaemon=true + +[program:umurmur] +command=/usr/bin/umurmurd -d -c /etc/umurmur/umurmur.conf -r +autorestart=true diff --git a/config/umurmur.conf b/config/umurmur.conf new file mode 100644 index 0000000..fde2429 --- /dev/null +++ b/config/umurmur.conf @@ -0,0 +1,39 @@ +# This configuration is based on the official example configuration. +# More information can be found at +# http://code.google.com/p/umurmur/wiki/Configuring02x + +max_bandwidth = 60000; +welcometext = "Welcome to uMurmur!"; +# certificate = "/etc/umurmur/cert.crt"; +# private_key = "/etc/umurmur/key.key"; +# ca_path = "/path/to/ca/certificates/"; # Location of CA certificate. Relevant for OpenSSL only. + +password = ""; +# admin_password = ""; +# ban_length = 0; # Length in seconds for a ban. Default is 0. 0 = forever. +# enable_ban = false; # Default is false +# banfile = "/etc/umurmur/banfile.txt"; # File to save bans to. Default is to not save bans to file. +# sync_banfile = false; # Keep banfile synced. Default is false, which means it is saved to at shutdown only. +# allow_textmessage = true; # Default is true +# opus_threshold = 100; # Required percentage of users that support Opus codec for it to be chosen +max_users = 10; + +# Specify port and/or address to bind to. Typically not needed. +# Default is '*' for address and 64738 for port. +# Can also be specified on the command line, which takes precedence if +# both are specified. +# bindport = 64738; +# bindaddr = "192.168.1.1"; + +# bindport6 = 64738; +# bindaddr6 = "fde4:8dba:82e1::/48"; + +# Log to file option. Default is logging to syslog. +# umurmurd will close and reopen the logfile if SIGHUP is received. +# logfile = "/var/log/umurmurd.log"; + +# Specify this for privilege dropping. If username is specified but not +# the groupname, the user's login group is used. +username = "murmur"; +groupname = "murmur"; + diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..a8530f8 --- /dev/null +++ b/setup.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e + +# strings +for i in welcometext certificate private_key ca_path password \ + admin_password banfile bindaddr bindaddr6 logfile \ + username groupname; do + if [[ ${!i} ]] ; then + sed -i \ + -e "s|${i} = .*|${i} = \"${!i}\";|" \ + -e "s|# ${i} = .*|${i} = \"${!i}\";|" \ + -e "s|#${i} = .*|${i} = \"${!i}\";|" \ + /etc/umurmur/umurmur.conf + fi +done + +unset i + +# integers and booleans +for i in max_bandwidth ban_length enable_ban sync_banfile allow_textmessage \ + opus_threshold max_users bindport bindport6; do + if [[ ${!i} ]] ; then + sed -i \ + -e "s|${i} = .*|${i} = ${!i};|" \ + -e "s|# ${i} = .*|${i} = ${!i};|" \ + -e "s|#${i} = .*|${i} = ${!i};|" \ + /etc/umurmur/umurmur.conf + fi +done + +unset i + +if ! grep -E '^channels =.*' /etc/umurmur/umurmur.conf ; then + cat /umurmurconfig/channels.conf >> /etc/umurmur/umurmur.conf +fi