From 92fe086d899add90a6019baa45d84ac442ee7067 Mon Sep 17 00:00:00 2001
From: David Trattnig <david.trattnig@o94.at>
Date: Tue, 8 Sep 2020 19:53:00 +0200
Subject: [PATCH] Cleanup API artifacts. #27

---
 .gitignore       |  3 ---
 Dockerfile       |  5 -----
 README.md        |  9 +++------
 install.sh       | 11 -----------
 requirements.txt |  8 --------
 run.sh           | 36 +-----------------------------------
 6 files changed, 4 insertions(+), 68 deletions(-)

diff --git a/.gitignore b/.gitignore
index b179bf0..37e2980 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,8 +5,5 @@ logs
 tmp
 .vscode/tags
 configuration/engine.ini
-configuration/gunicorn.conf.py
-web/clock.html
-web/trackservice.html
 script/.engine.install-db.lock
 .engine.install-db.lock
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index d7df05e..44f3267 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -72,7 +72,6 @@ RUN pip3 install -r /tmp/requirements.txt
 # Default configuration
 
 COPY configuration/sample-docker.engine.ini /srv/configuration/engine.ini
-COPY configuration/sample-docker.gunicorn.conf.py /srv/configuration/gunicorn.conf.py
 
 # Update OPAM
 
@@ -86,7 +85,3 @@ RUN opam install depext -y
 RUN opam depext taglib mad lame vorbis flac opus cry samplerate pulseaudio bjack alsa ssl liquidsoap -y 
 RUN opam install taglib mad lame vorbis flac opus cry samplerate pulseaudio bjack alsa ssl liquidsoap -y
 RUN eval $(opam env)
-
-# Expose the API
-
-EXPOSE 3333
\ No newline at end of file
diff --git a/README.md b/README.md
index 5b7f001..36afba3 100644
--- a/README.md
+++ b/README.md
@@ -28,11 +28,9 @@ the requirements of community radios.
 - Multichannel Line-out
 - Blank Detenction / Silence Detecter
 - Auto Pilot a.k.a. Fallback Handling
-- API to query Track-Service
-- API to query monthly reports
-- API to query data for a studio clock
-- Web Application for displaying the Track-Service
-- Web Application for displaying the studio clock
+- API to query Track-Service, monthly reports and information for displaying the Studio Clock (see [Engine API](https://gitlab.servus.at/aura/engine-api))
+- Web Application for displaying the Track-Service (see [AURA Player](https://gitlab.servus.at/aura/player))
+- Web Application for displaying the Studio Clock (see [Engine Clock](https://gitlab.servus.at/aura/engine-clock))
 
 Read more on the [Engine Features](docs/engine-features.md) page.
 
@@ -50,7 +48,6 @@ To learn more, checkout the [Engine Developer Guide](docs/developer-guide.md) or
 - [Installation for Production](docs/installation-production.md)
 - [Running with Docker](docs/running-docker.md)
 - [Setup the Audio Store](docs/setup-audio-store.md)
-- [Configuration Guide](docs/configuration-guide.md)
 
 ## Read more
 
diff --git a/install.sh b/install.sh
index 10027f6..a7718e2 100755
--- a/install.sh
+++ b/install.sh
@@ -33,8 +33,6 @@ if [ $mode == "dev" ]; then
     echo "Copy configuration to './configuration/engine.ini'"
     cp -n configuration/sample-development.engine.ini configuration/engine.ini
 
-    echo "Installing Web Application Packages ..."
-    bash script/install-web.sh
 fi
 
 
@@ -48,15 +46,6 @@ if [ $mode == "prod" ]; then
     echo "Copy default Engine configuration to '/etc/aura/engine.ini'"
     cp -n configuration/sample-production.engine.ini /etc/aura/engine.ini
 
-    echo "Copy default Gunicorn configuration to '/etc/aura/engine.ini'"
-    cp -n configuration/sample-production.gunicorn.conf.py configuration/gunicorn.conf.py
-
-    echo "Create Virtual Env for Gunicorn"
-    virtualenv -p /usr/bin/python3.7 ../python-env
-    source ../python-env/bin/activate
-
-    echo "Install Requirements to Virtual Env"
-    pip3 install -r requirements.txt
 fi
 
 
diff --git a/requirements.txt b/requirements.txt
index 7db9e59..1c13bea 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,13 +1,6 @@
 sqlalchemy==1.3.13
 Flask==1.1.1
-Flask-Caching==1.8.0
 Flask-SQLAlchemy==2.4.1
-Flask-RESTful==0.3.8
-flask-marshmallow==0.11.0
-flask-cors==3.0.8
-marshmallow-sqlalchemy==0.22.2
-apispec==3.3.0
-apispec-webframeworks==0.5.2
 mysqlclient==1.3.12
 redis==3.5.3
 mutagen==1.44.0
@@ -15,5 +8,4 @@ validators==0.12.1
 simplejson==3.17.0
 accessify==0.3.1
 librosa==0.7.2
-gunicorn==20.0.4
 pyyaml==5.3.1
\ No newline at end of file
diff --git a/run.sh b/run.sh
index e7cf5ab..1a76981 100755
--- a/run.sh
+++ b/run.sh
@@ -10,8 +10,6 @@ docker="false"
 # - engine
 # - core
 # - lqs
-# - api-dev
-# - api
 # - recreate-database
 
 # - docker:engine
@@ -19,10 +17,9 @@ docker="false"
 # - docker:lqs
 # - docker:recreate-database
 # - docker:build
-# - docker:api
 # 
 
-if [[ $* =~ ^(engine|core|lqs|api-dev|api)$ ]]; then 
+if [[ $* =~ ^(engine|core|lqs)$ ]]; then 
 	mode=$1 
 fi
 
@@ -60,24 +57,6 @@ if [[ $docker == "false" ]]; then
 		eval "$lqs"
 	fi
 
-	### Runs the API Server (Development) ###
-
-	if [[ $mode == "api-dev" ]]; then
-		echo "Building Web Applications"
-		sh ./script/build-web.sh
-		echo "Starting API Server"
-		/usr/bin/env python3.7 engine-api.py
-	fi
-
-	### Runs the API Server (Production) ###
-
-	if [[ $mode == "api" ]]; then
-		echo "Activating Python Environment"
-		source ../python-env/bin/activate
-		echo "Starting API Server"
-		gunicorn -c configuration/gunicorn.conf.py engine-api:app
-	fi
-
 	### CAUTION: This deletes everything in your database ###
 
 	if [[ $mode == "recreate-database" ]]; then
@@ -130,19 +109,6 @@ if [[ $docker == "true" ]]; then
 
 	fi
 
-	### Runs Engine API using Gunicorn ###
-
-	if [[ $mode == "api" ]]; then
-		exec sudo docker run --name aura-engine-api --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-api.py \
-			--device autoradio/engine /bin/bash \
-			-c "gunicorn -c configuration/gunicorn.conf.py engine-api:app"
-	fi
-
 	### CAUTION: This deletes everything in your database ###
 
 	if [[ $mode == "recreate-database" ]]; then
-- 
GitLab