Selaa lähdekoodia

automatizing deploy

Kora 6 kuukautta sitten
vanhempi
commit
6c0f9f0f0b

+ 1 - 0
.gitignore

@@ -5,3 +5,4 @@
 .idea/*
 __pycache__/
 flask_be/nohup.out
+flask_be/pid.nohup

+ 0 - 3
flask_be/requirements.txt

@@ -1,3 +0,0 @@
-Flask==2.3.2
-flask_cors==3.0.10
-pandas==2.0.1

+ 15 - 21
flask_be/requirements_freezed.txt

@@ -1,22 +1,16 @@
-# Created with: Python 3.10.6, pip 22.0.2
-
-certifi==2022.12.7
-charset-normalizer==3.1.0
-click==8.1.3
-docopt==0.6.2
-Flask==2.2.3
-Flask-Cors==3.0.10
-idna==3.4
-itsdangerous==2.1.2
-Jinja2==3.1.2
-MarkupSafe==2.1.2
-numpy==1.24.2
-pandas==1.5.3
-pipreqs==0.4.11
-python-dateutil==2.8.2
-pytz==2023.3
-requests==2.28.2
+# Created with Python 3.12 on Ubuntu 24.04 LTS
+blinker==1.8.2
+click==8.1.7
+Flask==3.0.3
+Flask-Cors==4.0.1
+itsdangerous==2.2.0
+Jinja2==3.1.4
+MarkupSafe==2.1.5
+numpy==1.26.4
+pandas==2.2.2
+python-dateutil==2.9.0.post0
+pytz==2024.1
 six==1.16.0
-urllib3==1.26.15
-Werkzeug==2.2.3
-yarg==0.1.9
+tzdata==2024.1
+waitress==3.0.0
+Werkzeug==3.0.3

+ 22 - 0
site2/deploy/deploy.bash

@@ -0,0 +1,22 @@
+#!/usr/bin/bash
+
+# MUST USE SUDO
+
+
+TIGRO_DIR=/home/kora/Codes/Progetto_2023-OVI
+FE_DIR=${TIGRO_DIR}/site2
+BE_DIR=${TIGRO_DIR}/flask_be
+
+if test -f ${BE_DIR}/pid.nohup ; then
+    kill $(cat ${BE_DIR}/pid.nohup)
+fi
+
+cp -r ${FE_DIR}/* /var/www/html/
+cp ${FE_DIR}/js/config_alt.js /var/www/html/js/config.js
+
+
+cd ${BE_DIR}
+source venv/bin/activate
+nohup waitress-serve --host 127.0.0.42 --port 5000 app:app >&nohup.out & echo $! > pid.nohup
+
+exit

+ 1 - 1
site2/js/config.js

@@ -1 +1 @@
-export const flask_be_address = 'http://127.0.0.1:5000';
+export const flask_be_address = 'http://' + location.hostname + ':5000/';

+ 1 - 0
site2/js/config_alt.js

@@ -0,0 +1 @@
+export const flask_be_address = 'http://' + location.hostname + '/data';