Skip to content
Snippets Groups Projects
Commit 3ca42567 authored by David Trattnig's avatar David Trattnig
Browse files

Start docker from run script. #17

parent e6033d65
No related branches found
No related tags found
No related merge requests found
......@@ -7,19 +7,18 @@ docker="false"
#
# Call with one of these parameters:
#
# - init
# - engine
# - core
# - lqs
# - recreate-database
# - docker:engine
# - docker:core
# - docker:lqs
# - docker:recreate-database
# - docker:build
# - docker:push
#
if [[ $* =~ ^(engine|core|lqs)$ ]]; then
if [[ $* =~ ^(init|env|engine|core|lqs)$ ]]; then
mode=$1
fi
......@@ -38,9 +37,17 @@ echo "[ Docker=$docker ]"
if [[ $docker == "false" ]]; then
### Initializes the environment & installs dependencies ###
if [[ $mode == "init" ]]; then
mkdir -p logs
pip3 install -r requirements.txt
fi
### Runs Engine Core & Liquidsoap ###
if [[ $mode == "engine" ]]; then
eval $(opam env)
/usr/bin/env python3.7 engine-core.py
fi
......@@ -74,49 +81,18 @@ if [[ $docker == "true" ]]; then
### Runs Engine Core & Liquidsoap ###
if [[ $mode == "engine" ]]; then
exec sudo docker run --name aura-engine --rm -it \
-u $UID:$GID \
-p 127.0.0.1:8050:5000 \
-v "$BASE_D":/srv \
-v "$BASE_D/configuration/":/etc/aura \
--tmpfs /var/log/aura/ autoradio/engine /srv/engine-core.py
fi
### Runs Engine Core only ###
if [[ $mode == "core" ]]; then
exec sudo docker run --name aura-engine-core --rm -it \
exec sudo docker run \
--network="host" \
--name aura-engine \
--rm -d \
-u $UID:$GID \
-p 127.0.0.1:8050:5000 \
-v "$BASE_D":/srv \
-v "$BASE_D/configuration/":/etc/aura \
--tmpfs /var/log/aura/ autoradio/engine /srv/engine-core.py "--without-lqs"
fi
### Runs Liquidsoap only ###
if [[ $mode == "lqs" ]]; then
lqs=$(/usr/bin/env python3.7 engine-core.py --get-lqs-command)
eval "$lqs"
exec sudo docker run --name aura-engine-liquidsoap --rm -it \
-u 1000:1000 \
-v "$BASE_D":/srv \
-v "$BASE_D/configuration/":/etc/aura \
-v "$BASE_D/audio/source":/home/opam/audio/source:ro \
-v "$BASE_D/configuration/docker":/etc/aura \
-v "/dev/snd":/dev/snd \
--privileged \
--tmpfs /var/log/aura/ \
--device /dev/snd autoradio/engine /bin/bash \
-c "cd /srv/modules/liquidsoap && liquidsoap --debug --verbose engine.liq"
fi
### CAUTION: This deletes everything in your database ###
if [[ $mode == "recreate-database" ]]; then
exec sudo docker run --rm -it \
-u $UID:$GID \
-v "$BASE_D":/srv \
-v "$BASE_D/configuration/":/etc/aura \
--tmpfs /var/log/aura/ autoradio/engine /srv/engine-core.py --recreate-database
autoradio/engine
fi
### Create Docker Image from local project ###
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment