Newer
Older
#
# Run Script for AURA Engine
#
# Call with one of these parameters:
#
if [[ $* =~ ^(init|env|engine|core|lqs)$ ]]; then
# Find the correct Python version (3.8 or 3.9)
if hash python3.9 2>/dev/null; then
PYTHON_EXEC="python3.9"
echo "[ Using Python 3.9 ]"
else
PYTHON_EXEC="python3.8"
echo "[ Using Python 3.8 ]"
fi
### Initializes the environment & installs dependencies ###
if [[ $mode == "init" ]]; then
mkdir -p logs
pip3 install -r requirements.txt
fi
/usr/bin/env $PYTHON_EXEC run.py --without-lqs
fi
### Runs Liquidsoap only ###
if [[ $mode == "lqs" ]]; then
lqs=$(/usr/bin/env $PYTHON_EXEC run.py --get-lqs-command)
### CAUTION: This deletes everything in your database ###
if [[ $mode == "recreate-database" ]]; then
/usr/bin/env $PYTHON_EXEC run.py --recreate-database
# +++ DOCKER COMMANDS +++ #
if [[ $docker == "true" ]]; then
BASE_D=$(realpath "${BASH_SOURCE%/*}/")
### Runs Engine Core & Liquidsoap ###
if [[ $mode == "engine" ]]; then
exec sudo docker run \
--network="host" \
--name aura-engine \
--rm -d \
-v "$BASE_D/audio/source":/var/audio/source:ro \
-v "$BASE_D/config/docker":/etc/aura \
-v "/dev/snd":/dev/snd \
--privileged \
### Create Docker Image from local project ###
if [[ $mode == "build" ]]; then
### Pushes the latest Docker Image to Docker Hub ###
if [[ $mode == "push" ]]; then
exec sudo docker push autoradio/engine
fi