[chronojump-server] Added Compujump services
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump-server] Added Compujump services
- Date: Wed, 9 Aug 2017 18:01:21 +0000 (UTC)
commit 8db7a391bb068d40cd6c3cf1514c9869e21fc897
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Aug 9 20:00:56 2017 +0200
Added Compujump services
howto_compujump_server.txt | 40 ++++++++++++++++++++++++----------------
services/flask.service | 12 ++++++++++++
services/gunicorn.service | 13 +++++++++++++
services/start_flask.sh | 3 +++
services/start_gunicorn.sh | 4 ++++
5 files changed, 56 insertions(+), 16 deletions(-)
---
diff --git a/howto_compujump_server.txt b/howto_compujump_server.txt
index 0f394cb..aac9f1f 100644
--- a/howto_compujump_server.txt
+++ b/howto_compujump_server.txt
@@ -88,24 +88,22 @@ $ . venv/bin/activate
# cd /srv/api-app
# pip install -r requirements.txt
-# vim /usr/local/bin/start_chronojump_server.sh (change the 0.0.0.0 to server IP)
+copy services/start_gunicorn.sh to /usr/local/bin/
-------------------------------
-#!/bin/bash
+# chmod +x /usr/local/bin/start_gunicorn.sh
-killall gunicorn
-cd /srv/api-app
-. venv/bin/activate
-nohup gunicorn --bind=0.0.0.0:8080 --workers=4 --error-logfile=/srv/log/gunicorn/error.log
--access-logfile=/srv/log/gunicorn/access.log main:app > /dev/null 2> /dev/null &
-------------------------------
+-----------------------
+2b. GUNICORN boot start
+-----------------------
+copy services/gunicorn.service to /etc/systemd/system
-# chmod +x /usr/local/bin/start_chronojump_server.sh
+#systemctl enable gunicorn
+#systemctl start gunicorn
---------------------
-2b. GUNICORN start
---------------------
-
-# /usr/local/bin/start_chronojump_server.sh
+-------------------
+2c. GUNICORN check
+Open a browser and go to [ServerIP]:8080
+I should return a autodocumentation of endpoints
-----------------
3. FLASK install
@@ -124,17 +122,27 @@ pip install -e .
copy logo_club.png to /srv/api-app/chronojumpserver/static/images
---------------
-3. FLASK start
+3a. FLASK start
---------------
//don't need to be on venv environment
-//change 0.0.0.0 to server IP
+//It seems that it is not necessary to change 0.0.0.0 to server_IP
# FLASK_APP="chronojumpserver" /srv/api-app/venv/bin/flask run --host 0.0.0.0
Add stations and exercises on the website serverip:5000
Check RFID is working ok
+-----------------------
+3b enable FLASK service at boot
+-----------------------
+
+copy services/start_flask.sh to /usr/local/bin/
+copy services/flask.service to /etc/systemd/system/
+
+#systemctl enable flask.service
+#systemctl start flask
+
--------------------------------
4. compilation of RFID software
--------------------------------
diff --git a/services/flask.service b/services/flask.service
new file mode 100644
index 0000000..a3d2ef9
--- /dev/null
+++ b/services/flask.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Flask
+
+[Service]
+
+ExecStart=/usr/local/bin/start_flask.sh
+Restart=always
+
+[Install]
+WantedBy=network-online.target
+Alias=flask.service
+
diff --git a/services/gunicorn.service b/services/gunicorn.service
new file mode 100644
index 0000000..c8f9922
--- /dev/null
+++ b/services/gunicorn.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Gunicorn
+
+[Service]
+
+ExecStart=/usr/local/bin/start_gunicorn.sh
+Restart=always
+RestartSec=5
+
+[Install]
+WantedBy=network-online.target
+Alias=gunicorn.service
+
diff --git a/services/start_flask.sh b/services/start_flask.sh
new file mode 100644
index 0000000..a6d9ba6
--- /dev/null
+++ b/services/start_flask.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+FLASK_APP="chronojumpserver" /srv/api-app/venv/bin/flask run --host 0.0.0.0
diff --git a/services/start_gunicorn.sh b/services/start_gunicorn.sh
new file mode 100644
index 0000000..95d24d0
--- /dev/null
+++ b/services/start_gunicorn.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+cd /srv/api-app
+. venv/bin/activate
+./venv/bin/gunicorn --bind=0.0.0.0:8080 --workers=4 --error-logfile=/srv/log/gunicorn/error.log
--access-logfile=/srv/log/gunicorn/access.log main:app
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]