serveurs:installation:web-srv:monitorer-gunicorn

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
serveurs:installation:web-srv:monitorer-gunicorn [2020/02/18 14:21] jpmilcentserveurs:installation:web-srv:monitorer-gunicorn [2023/06/01 19:01] (Version actuelle) jpmilcent
Ligne 1: Ligne 1:
 ====== Monitorer Gunicorn GeoNature ====== ====== Monitorer Gunicorn GeoNature ======
-  * Modifier la //stack// //Docker// //monitor// du serveur //web-srv// :+  * Modifier la //stack// //Docker// //telegraf// du serveur //web-srv// :
     * Modifier la configuration de //Telegraf// pour le serveur //web-srv// en ajoutant le support de //statsd// comme indiquer dans [[https://github.com/influxdata/telegraf/blob/master/plugins/inputs/statsd/README.md|la doc du plugin]].     * Modifier la configuration de //Telegraf// pour le serveur //web-srv// en ajoutant le support de //statsd// comme indiquer dans [[https://github.com/influxdata/telegraf/blob/master/plugins/inputs/statsd/README.md|la doc du plugin]].
-    * Ajouter la publication du port UDP 8125 sur l'hôte uniquement en local (//127.0.0.1//) dans le fichier ''docker-compose.yml'' de //monitor.silene.eu//+    * Ajouter la publication du port UDP 8125 sur l'hôte uniquement en local (//127.0.0.1//) dans le fichier ''docker-compose.yml'' de //telegraf//
     * Envoyer sur le serveur les modification à l'aide de //rsync//     * Envoyer sur le serveur les modification à l'aide de //rsync//
-  * Se connecter au serveur en tant qu'//admin// et se rendre dans le dossier //~/docker// : ''ssh -t admin@web-paca-sinp 'cd docker; exec bash -l' '' +  * Se connecter au serveur en tant qu'//admin// et se rendre dans le dossier //~/docker// : ''ssh -t admin@web-<region>-sinp 'cd docker; exec bash -l' '' 
-    * Arrêter puis redémarrer le stack //monitor// pour prendre en compte les changement : ''docker-compose down ; docker-compose up -d'' +    * Arrêter puis redémarrer le stack //telegraf// pour prendre en compte les changement : ''docker-compose down ; docker-compose up -d'' 
-  * Se connecter au serveur en tant que //geonat// et se rendre dans le dossier // ~/www/geonature/backend/ // : ''ssh -t geonat@web-<region>-sinp 'cd www/geonature/backend/; exec bash -l' '' +  * Se connecter au serveur en tant que //admin// : '' ssh admin@web-<region>-sinp '' 
-    * Éditer le fichier de démarrage de //Gunicorn// : ''vi gunicorn_start.sh'' +    * Passer en root : ''sudo -i'' 
-      * Ajouter les options suivantes à ligne de démarrage de //Gunicorn// : <code bashexec gunicorn  wsgi:app --statsd-host=localhost:8125 --statsd-prefix=geonature </code> +    * Nous allons surcoucher les fichiers service Systemd de GeoNature, UsersHub, TaxHub et Atlas: 
-      * En //root//relancer le serveur //Gunicorn// à l'aide de //Supervisor// : ''supervisorctl restart geonature2'' +      * Créer une fichier //overide// : ''systemctl edit geonature.service'' 
-  * Vérifier la prise en compte des nouvelles métriques dans //InfluxDB//. Leurs noms doivent débuter par "geonature_..." +      * Ajouter le contenu suivant (nous ajoutons aussi des options de redémarrage auto) : <code properties> 
-    * Pour le Dashboard, nous avons adapté à InfluxDB le Dashboard Gunicorn suivant initialement prévu pour Prometheus :  +[Unit] 
-      * https://gist.github.com/dmyerscough/59896aa752ba48794d2aef4c7a0fdd6e +StartLimitIntervalSec=6min 
-      * https://github.com/pilosus/prometheus-client-python-app-grafana-dashboard/blob/master/flask-web-app.json+StartLimitBurst=5 
 + 
 +[Service] 
 +ExecStart= 
 +ExecStart=/home/geonat/www/geonature/backend/venv/bin/gunicorn geonature:create_app() \ 
 +                --statsd-host "localhost:8125"
 +                --statsd-prefix "geonature" 
 +                --name "${GUNICORN_PROC_NAME}" --workers "${GUNICORN_NUM_WORKERS}"
 +                --bind "${GUNICORN_HOST}:${GUNICORN_PORT}" --timeout="${GUNICORN_TIMEOUT}" 
 +Restart=on-failure 
 +RestartSec=1min 
 +</code> 
 +      * Prendre en compte les changements : ''systemctl daemon-reload'' 
 +      * Relancer le service : ''systemctl restart geonature.service'' 
 +    * Répéter cette procédure pour l'Atlas, UsersHub et TaxHub : 
 +      * Pour l'Atlas, le service se nomme ''geonature-atlas.service'' : <code properties> 
 +[Unit] 
 +StartLimitIntervalSec=6min 
 +StartLimitBurst=5 
 + 
 +[Service] 
 +ExecStart= 
 +ExecStart=/home/geonat/www/atlas/venv/bin/gunicorn atlas.wsgi:app 
 +                --statsd-host "localhost:8125" \ 
 +                --statsd-prefix "atlas" 
 +                --name "${GUNICORN_PROC_NAME}" --workers "${GUNICORN_NUM_WORKERS}"
 +                --bind "${GUNICORN_HOST}:${GUNICORN_PORT}" --timeout="${GUNICORN_TIMEOUT}" 
 +Restart=on-failure 
 +RestartSec=1min 
 +</code> 
 +      * Pour TaxHub, le service ''taxhub.service'' : <code properties> 
 +[Unit] 
 +StartLimitIntervalSec=6min 
 +StartLimitBurst=5 
 + 
 +[Service] 
 +ExecStart= 
 +ExecStart=/home/geonat/www/taxhub/venv/bin/gunicorn apptax.app:create_app() \ 
 +                --statsd-host "localhost:8125"
 +                --statsd-prefix "taxhub" 
 +                --name "${GUNICORN_PROC_NAME}" --workers "${GUNICORN_NUM_WORKERS}"
 +                --bind "${GUNICORN_HOST}:${GUNICORN_PORT}" --timeout="${GUNICORN_TIMEOUT}" 
 +Restart=on-failure 
 +RestartSec=1min 
 +</code> 
 +      * Pour UsersHub, , le service ''usershub.service'' : <code properties> 
 +[Unit] 
 +StartLimitIntervalSec=6min 
 +StartLimitBurst=5 
 + 
 +[Service] 
 +ExecStart= 
 +ExecStart=/home/geonat/www/usershub/venv/bin/gunicorn app.app:create_app() \ 
 +                --statsd-host "localhost:8125"
 +                --statsd-prefix "usershub" 
 +                --name "${GUNICORN_PROC_NAME}" --workers "${GUNICORN_NUM_WORKERS}"
 +                --bind "${GUNICORN_HOST}:${GUNICORN_PORT}" --timeout="${GUNICORN_TIMEOUT}" 
 +Restart=on-failure 
 +RestartSec=1min 
 +</code> 
 +  * Vérifier la prise en compte des nouvelles métriques dans //InfluxDB//. Leurs noms doivent débuter par "geonature_...", "atlas_...", etc. 
 +    * En utilisant l'interface disponible avec InfluxDB v2 : https://influxdb.<domaine-sinp>/ 
 +    * En passant par le container : 
 +      * Se connecter à l'instance hébergeant InfluxDB, normalement "bkp-srv" : '' ssh admin@bkp-<region>-sinp '' 
 +      * Se connecter à InfluxDB :  
 +        * pour la v2 : '' docker exec -it monitor-influxdb influx v1 shell '' 
 +        * pour la v1 : '' docker exec -it monitor-influxdb influx '' 
 +      * Sélectionner la base stockant les métriques : '' USE "telegraf" '' 
 +      * Afficher les métriques : '' SHOW MEASUREMENTS '' 
 +  * Pour le Dashboard, nous avons adapté à InfluxDB le Dashboard Gunicorn suivant initialement prévu pour Prometheus :  
 +    * https://gist.github.com/dmyerscough/59896aa752ba48794d2aef4c7a0fdd6e 
 +    * https://github.com/pilosus/prometheus-client-python-app-grafana-dashboard/blob/master/flask-web-app.json
  • serveurs/installation/web-srv/monitorer-gunicorn.1582035718.txt.gz
  • Dernière modification : 2020/02/18 14:21
  • de jpmilcent