Commit 5036df3f authored by david's avatar david
Browse files

Initial docker setup for engine. #72

parent 4936b3bf
FROM savonet/liquidsoap:v1.4.3
FROM python:3.8-slim
LABEL maintainer="David Trattnig <david.trattnig@subsquare.at>"
# Engine System Dependencies
# System Dependencies
RUN apt-get update && apt-get -y install \
apt-utils \
ffmpeg \
quelcom \
build-essential \
libmariadbclient-dev \
default-libmysqlclient-dev \
python3.9-dev python3-pip
# Print Debug Information
RUN echo $(python3 -V)
libmariadbclient-dev
# Setup Engine
RUN whoami
RUN mkdir -p /srv
RUN mkdir -p /var/audio
RUN mkdir -p /var/audio/source
RUN mkdir -p /var/audio/station
RUN mkdir -p /var/audio/playlist
COPY . /srv
RUN mkdir -p /srv/src
RUN mkdir -p /srv/config
COPY src /srv/src
COPY requirements.txt /srv
COPY meta.py /srv
COPY run.sh /srv
COPY run.py /srv
WORKDIR /srv
RUN pip3 install -r requirements.txt
VOLUME ["/srv/socket", "/srv/logs", "/var/audio/source", "/var/audio/playlist"]
# Start the Engine
ENTRYPOINT ["./run.sh"]
......@@ -4,7 +4,7 @@
[general]
# Path to the engine-core socket directory relative to the engine project root
socket_dir="../engine-core/socket"
socket_dir="/srv/socket"
# Directory where the log file resides
log_dir="logs"
# Possible values: debug, info, warning, error, critical
......
......@@ -63,24 +63,39 @@ fi
# +++ DOCKER COMMANDS +++ #
if [[ $docker == "true" ]]; then
BASE_D=$(realpath "${BASH_SOURCE%/*}/")
BASE_DIR=$(readlink -f .)
echo "Absolute base dir: " $BASE_DIR
### Runs Engine Core & Liquidsoap ###
if [[ $mode == "engine" ]]; then
if [[ -z "${AURA_ENGINE_CONFIG_PATH}" ]]; then
AURA_ENGINE_CONFIG_PATH="$BASE_DIR/config/engine.docker.ini"
fi
if [[ -z "${AURA_ENGINE_SOCKET_DIR}" ]]; then
AURA_ENGINE_SOCKET_DIR="$BASE_DIR/../engine-core/socket"
fi
if [[ -z "${AURA_ENGINE_AUDIO_SOURCE_DIR}" ]]; then
AURA_ENGINE_AUDIO_SOURCE_DIR="$BASE_DIR/audio/source"
fi
if [[ -z "${AURA_ENGINE_AUDIO_PLAYLIST_DIR}" ]]; then
AURA_ENGINE_AUDIO_PLAYLIST_DIR="$BASE_DIR/audio/playlist"
fi
exec sudo docker run \
--network="host" \
--name aura-engine \
--rm -d \
--rm \
-u $UID:$GID \
-v "$BASE_D":/srv \
-v "$BASE_D/audio/source":/var/audio/source:ro \
-v "$BASE_D/audio/station":/var/audio/station:ro \
-v "$BASE_D/audio/playlist":/var/audio/playlist:ro \
-v "$BASE_D/config/docker":/etc/aura \
-v "/dev/snd":/dev/snd \
--privileged \
--tmpfs /var/log/aura/ \
-v "$AURA_ENGINE_CONFIG_PATH":"/srv/config/engine.ini":ro \
-v "$AURA_ENGINE_SOCKET_DIR":"/srv/socket" \
-v "$AURA_ENGINE_AUDIO_SOURCE_DIR":"/var/audio/source":ro \
-v "$AURA_ENGINE_AUDIO_PLAYLIST_DIR":"/var/audio/playlist" \
-v "$BASE_DIR/logs":"/srv/logs" \
autoradio/engine
fi
......
......@@ -49,7 +49,8 @@ class LiquidSoapClient:
@param socket_path: Der Pfad zum Socket des Liquidsoap-Scripts
"""
self.logger = logging.getLogger("AuraEngine")
self.socket_path = config.get("install_dir") + "/" + config.get("socket_dir") + "/" + socket_filename
socket_path = config.get("socket_dir") + "/" + socket_filename
self.socket_path = config.to_abs_path(socket_path)
self.logger.debug("LiquidSoapClient using socketpath: " + self.socket_path)
......
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