Commit cc95f31e87f9bbd1269e66cd877cbc5a41f14370

Authored by hitier
1 parent bc7964c5

Complete installation procedures

Showing 1 changed file with 77 additions and 29 deletions   Show diff stats
INSTALL.md
1   -# install
  1 +# Installation de Plan De Charge
2 2  
3   -## make working dir:
  3 +## Prérequis
4 4  
5   - mkdir /path/to/working-directory
6   - git --work-tree=/path/to/working-directory --git-dir=/path/to/the/repo.git checkout -f master
  5 +- python3
7 6  
8   -## set environment
  7 +## Obtenir un répertoire fonctionnel
  8 +
  9 + git clone https://gitlab.irap.omp.eu/PDC-IRAP/pdc-web.git
  10 + cd pdc-web
  11 +
  12 +### Installer l'environment python
9 13  
10 14 python3 -m venv venv
11 15 source venv/bin/activate
12 16 pip install -r requirements.txt
  17 +
  18 +### Configurer l'application
  19 +
13 20 cp resources/pdc_config.py .
14 21 $(EDITOR) pdc_config.py
15 22  
  23 + cp resources/flaskenv .flaskenv
  24 +
  25 +
  26 +### Jouer les tests et exécuter un serveur local
  27 +
  28 + pip install -r requirements-tests.txt
  29 + PYTHONPATH=. pytest
  30 +
  31 + # éventuellement voir le taux de couverture
  32 + PYTHONPATH=. pytest --cov=app --cov-report=xml:"coverage.xml" --cov-report=term --junitxml "tests-report.xml"
  33 +
  34 + # ouvrir un serveur sur localhost:5000
  35 + flask run
  36 +
  37 +## Configurer apache
  38 +
  39 +Les fichiers concernés:
  40 +
  41 +- pdc_web.wsgi
  42 +- pdc_config.py
  43 +
  44 +La procédure:
  45 +
  46 + mkdir /var/www/html/pdc-web
  47 +
  48 + cp ./resources/apache2-virtual-host.conf /etc/apache2/sites-available/pdc-web.conf
  49 + $(EDITOR) /etc/apache2/sites-available/pdc-web.conf # éditer les paramètres
  50 + a2ensite pdc-web
  51 + apachectl restart
  52 +
  53 +
  54 +### Mise à jour
  55 +
16 56 ## git autodeploy
17 57  
  58 +Les fichiers concernés:
  59 +
  60 +- scripts/post-deploy.sh
  61 +- resources/post-receive.git-hook
  62 +
  63 +La procédure:
  64 +
  65 + git --work-tree=/var/www/html/pdc-web --git-dir=/path/to/the/repo.git checkout -f master
  66 +
18 67 # make bare repo
19 68 git clone --bare /path/to/the/repo.git
20 69 # put on hook
... ... @@ -23,31 +72,30 @@
23 72  
24 73 git push to repo
25 74  
26   -## configure apache
27 75  
28   - cp ./resources/apache2-virtual-host.conf /etc/apache2/sites-available/pdc-web.conf
29   - $(EDITOR) /etc/apache2/sites-available/pdc-web.conf # set parameters
30   - $(EDITOR) /etc/hosts # to add your hostname if local install
31   - apachectl restart
32 76  
33   -## To Include in install procedures
  77 +Pycharm Integration
  78 +-------------------
34 79  
35   -- virtual-apage.conf
36   -- pdc_web.py
37   -- pdc_web.wsgi
38   -- .flaskenv
39   -- post-deploy.sh
40   -- git-hook
41   -- git bare repo
42   -- make venv && source activate && pip -r requi..
43   -- picharm requirement
44   -- run with pycharm
45   -- run with apache+wsgi
46   -- run with nginx+uwsgi
47   -- run through docker
48   -- install standalone on your own server
49   -- update your server installation
50   -- ress/flaskenv > .flaskenv
51   -- run tests
52   -- PYTHONPATH=. pytest --cov=app --cov-report=xml:"coverage.xml" --cov-report=term --junitxml "tests-report.xml"
  80 +As this projects makes use of the application factory
  81 +pattern, using pycharm requires some tiny configuration
  82 +effort.
  83 +
  84 +Look at
  85 +https://flask.palletsprojects.com/en/1.1.x/cli/#pycharm-integration
  86 +for more details.
  87 +
  88 +But basically, you just have to Edit the Run Configurations,
  89 +and set the fields:
  90 +
  91 +- select module name, and set it to 'flask'
  92 +- set Parameters to run
  93 +
  94 +
  95 +It should read the environment variables
  96 +- FLASK_ENV
  97 +- FLASK_APP
  98 +
  99 +you have previously set in the file `.flaskenv`
53 100  
  101 +Thats it, run you webapp through PyCharm, enjoy.
... ...