This the back-end of the Arborator-Grew redevelopement of the arborator-server.
git clone [email protected]:Arborator/arborator-flask.git
cd arborator-flask
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
get the keys folder and place it at the root copy auth_config.py into arborator-flask/app/controllers/auth/
export FLASK_APP=run.py; export FLASK_CONFIG=development; flask run --cert=adhoc
if you want autoreload when code changes add export FLASK_DEBUG=1
as so:
export FLASK_APP=run.py; export FLASK_CONFIG=development; export FLASK_DEBUG=1; flask run --cert=adhoc
sudo pip3 uninstall flask_sqlalchemy flask_migrate flask_login sqlalchemy_utils flask_wtf authomatic flask_bootstrap
sudo pip3 install flask_sqlalchemy flask_migrate flask_login sqlalchemy_utils flask_wtf authomatic flask_bootstrap
pip3 install sqlathanor
pip3 install flask-cors
pip3 install pyopenssl
Goal: install arborator-flask so that it servers in httpS on https://arboratorgrew.xxx.fr:5000/api/home/projects/
Internally, flask will run on 5001. Externally it will run on 5000
New server arboratorgrew.xxx.fr (small vps)
ssh [email protected]
adduser arborator
nginx installed?
Use arborator-flask/deployment/arborator-flask.nginx.conf
service nginx restart
supervisor installed?
apt install supervisor
cp deployment/arborator-flask.conf /etc/supervisor/conf.d/`
certbot installed?
apt-get install certbot python-certbot-nginx
certbot --nginx
Toutes les module python installed?
python3 -m pip install flask_sqlalchemy flask_migrate flask_login sqlalchemy_utils flask_wtf authomatic flask_bootstrap flask-cors pyopenssl uwsgi
ssh [email protected]
git clone https://github.com/Arborator/arborator-flask.git
cd /home/arborator/arborator-flask/
python3 wsgi.py
gunicorn -b localhost:5001 -w 4 wsgi
(by default it looks for “application”. If it’s not called “application”, add it: gunicorn -b localhost:5001 -w 4 wsgi:myapp)
gunicorn -c gunicorn.conf.py wsgi
check the content of the supervisor file in arborator-flask/deployment/arborator-flask.conf, in particular directory = /home/arborator/arborator-flask
If this is where your code is copy the file to /etc/supervisor/conf.d/arborator-flask.conf
sudo cp deployment/arborator-flask.conf /etc/supervisor/conf.d/arborator-flask.conf
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl avail
sudo supervisorctl restart arborator-flask
Is it working on https://arboratorgrew.xxx.fr:5000/api/home/projects/ ?
Test locally with
curl localhost:5001/api/home/projects/
Check who’s running on port 5000 and 5001:
lsof -i:5000
lsof -i:5001
From remote (note that strangely, it doesn’t work with https as in the browser)
curl http://arboratorgrew.xxx.fr:5000/api/home/projects/
If address already in use for second run:
killall python3
killall gunicorn
- As arborator (ssh [email protected]):
cd arborator-flask
git pull origin master
- Then as root:
supervisorctl restart arborator-flask
- And, as root, watch the logs in real time to see if any errors occurred:
tail -f /var/log/nginx/arborator-flask.log
deux routes :
home/views :
/ (rien) --> template : home/index.html
/q --> template: home/quickie.html
auth/views : /login etc
authomatic: auth/views.py auth/auth_config.py : par provider
modif
new install :
Create a local python environment (with python venv module for instance) (python 3.6 and above required)
python3 -m venv venv
Activate the local environment
source venv/bin/activate
Install wheel and then the requirements packages
pip install wheel
pip install -r requirements.txt
Put the keys/
folder at the root
of the project and the auth_config.py
in app/controllers/auth/
Export the local environment variable for flask
export FLASK_APP=run.py; export FLASK_CONFIG=development;
If the database migration folder is present, delete it
rm -r migrations/
Create database
flask db init
init créé le dossier migration (pas la peine de relancer chaque fois)
Export the local environment variable for flask
export FLASK_APP=run.py; export FLASK_CONFIG=development;
Run the dev app
flask run --cert=adhoc
For creating a project, click on the purple "PLUS" button on this page. Give it a name (best practice is to give your_name_test
as a name)
Then, click on the project card to navigate to the Project Page. On this page, you can upload a valid conllu file sample (file that end with .conll)
Then, click on the sample name to navigate to the Sample Page.
On this page, you should see all the different sentence card. Click on your tab name for opening the sentenceSVG
flask db stamp head
flask db migrate
si on a modifié models.py, il crée une nouveau script 123456xxxx.py dans migrations/versions
flask db upgrade
s'il y a un nouveau script dans migrations/versions il crée une meilleure version de la bdd, en conservant toute info encore utile. le nom et l'emplacement de la base est dans config.py
- Login form for site admins(testing purposes also)
- Complete project functions conversions (25/5/18)
- Set redirect urls for oauth providers
- in-app edit of project config(ini) files or find alternative
- correct dead links on project page
- css corrections/additions/subtractions
Check out the guide on the Wiki page.