Commit 8461ab11 authored by David Trattnig's avatar David Trattnig
Browse files

Modularized installation for avoid issues.

parent 7ac1b355
......@@ -2,6 +2,7 @@
*.pyc
*.log
logs
tmp
.vscode/tags
configuration/engine.ini
web/css/aura-clock-bundle.css
......@@ -9,4 +10,5 @@ web/css/aura-player-bundle.css
web/js/aura-clock-bundle.js
web/js/aura-player-bundle.js
web/clock.html
web/trackservice.html
\ No newline at end of file
web/trackservice.html
script/.engine.install-db.lock
\ No newline at end of file
......@@ -13,14 +13,12 @@ if [ $mode == "prod" ]; then
echo "[Installing AURA ENGINE for Production]"
fi
echo "Installation System Packages ..."
bash script/install-system-packages.sh
# Development and Production
echo "Installation OPAM Packages ..."
bash script/install-opam-packages.sh
echo "Installing Web Application Packages ..."
bash script/install-web.sh
......@@ -31,81 +29,43 @@ python3.7 $(which pip3) install -r requirements.txt
# Development
if [ $mode == "dev" ]; then
# Set LOCK file location
LOCKFILE_DB=configuration/.engine.install-db.lock
echo "Create local Logs Folder ..."
echo "Create local 'logs' Folder ..."
mkdir -p logs
echo "Copy configuration to './configuration/engine.ini'"
cp -n configuration/sample.engine.ini configuration/engine.ini
cp -n configuration/sample-development.engine.ini configuration/engine.ini
fi
# Production
if [ $mode == "prod" ]; then
# Set LOCK file location
LOCKFILE_DB=/etc/aura/.engine.install-db.lock
if getent passwd 'engineuser' > /dev/null 2>&1; then
echo "User 'engineuser' exists already.";
else
echo "Creating Engine User ..."
adduser engineuser
adduser engineuser sudo
fi
echo "Copy Supervisor Config to '/etc/supervisor/conf.d'"
cp configuration/supervisor/* /etc/supervisor/conf.d/
echo "Refresh Supervisor Config"
supervisorctl reread
echo "Create Log Directory '/var/log/aura/'"
mkdir -p /var/log/aura
echo "Create Configuration Directory '/etc/aura/'"
mkdir -p /etc/aura
echo "Create local 'tmp' Folder ..."
mkdir -p tmp
echo "Copy configuration to '/etc/aura/engine.ini'"
cp -n configuration/sample.engine.ini /etc/aura/engine.ini
echo "Set Ownership of '/opt/aura/engine', '/var/log/aura/' and '/etc/aura/engine.ini' to Engine User"
chown -R engineuser:engineuser .
chown -R engineuser:engineuser /var/log/aura/
chown -R engineuser:engineuser /etc/aura/engine.ini
fi
cp -n configuration/sample-production.engine.ini /etc/aura/engine.ini
# echo "Copy Supervisor Config to '/etc/supervisor/conf.d'"
# cp configuration/supervisor/* /etc/supervisor/conf.d/
# echo "Refresh Supervisor Config"
# supervisord -c /opt/aura/engine/configuration/supervisor/supervisord.conf reread
# echo "Update Supervisor Configuration"
# supervisorctl -c /opt/aura/engine/configuration/supervisor/supervisord.conf update
echo "Refresh Supervisor Config"
supervisord reread
echo "Update Supervisor Configuration"
supervisorctl update
# Setup Database
# Check if databases are already set-up
if test -f "$LOCKFILE_DB"; then
echo "Aura Engine Databases are already existing! Skipping..."
else
echo "Setting up database ..."
echo
echo "Which database system do you want to use? (Press '1' or '2')"
echo " [1] MariaDB"
echo " [2] Other / Manually"
echo
while true; do
read -rsn1 input
if [ "$input" = "1" ]; then
echo "Creating DB for MariaDB ..."
bash script/init-db-mariadb.sh
break
fi
if [ "$input" = "2" ]; then
echo "Manual database setup selected."
break
fi
done
# Create lockfile to avoid accidential re-creation of the database
touch $LOCKFILE_DB
fi
echo
echo "+++ Installation of AURA Engine finished! +++"
echo
\ No newline at end of file
#!/bin/bash
echo "Building AURA Clock ..."
......
#!/bin/bash
if getent passwd 'engineuser' > /dev/null 2>&1; then
echo "User 'engineuser' exists already.";
else
echo "Creating Engine User ..."
adduser engineuser
adduser engineuser sudo
fi
\ No newline at end of file
#!/bin/bash
#
# Prepare folders and permissions for installing engine on production.
#
echo "Create Log Directory '/var/log/aura/'"
mkdir -p /var/log/aura
echo "Create Configuration Directory '/etc/aura/'"
mkdir -p /etc/aura
echo "Set Ownership of '/opt/aura/engine', '/var/log/aura/' and '/etc/aura/engine.ini' to Engine User"
chown -R engineuser:engineuser /opt/aura/
chown -R engineuser:engineuser /etc/aura/
chown -R engineuser:engineuser /var/log/aura/
chown -R engineuser:engineuser /var/log/supervisor/
\ No newline at end of file
File mode changed from 100644 to 100755
#!/bin/bash
sudo apt install -y \
supervisor \
redis-server \
libsndfile1 ffmpeg \
quelcom \
\ No newline at end of file
#!/bin/bash
#
# Setup Database
#
# Set LOCK file location
LOCKFILE_DB=.engine.install-db.lock
# Check if databases are already set-up
if test -f "$LOCKFILE_DB"; then
echo "Aura Engine Databases are already existing! Skipping..."
else
echo "Setting up database ..."
echo
echo "Which database system do you want to use? (Press '1' or '2')"
echo " [1] MariaDB"
echo " [2] Other / Manually"
echo
while true; do
read -rsn1 input
if [ "$input" = "1" ]; then
echo "Creating DB for MariaDB ..."
bash init-db-mariadb.sh
break
fi
if [ "$input" = "2" ]; then
echo "Manual database setup selected."
break
fi
done
# Create lockfile to avoid accidential re-creation of the database
touch $LOCKFILE_DB
fi
Supports Markdown
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