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 [2021/04/21 08:29] 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.<domaine-sinp>//+    * 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-<region>-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// : '' ssh geonat@web-<region>-sinp '' +  * Se connecter au serveur en tant que //admin// : '' ssh admin@web-<region>-sinp '' 
-    * Se rendre dans le dossier // ~/www/geonature/backend/ // : ''cd ~/geonature/backend/'' +    * Passer en root : ''sudo -i'' 
-    * Éditer le fichier de démarrage de //Gunicorn// : ''vi gunicorn_start.sh'' +    * Nous allons surcoucher les fichiers service Systemd de GeoNature, UsersHub, TaxHub et Atlas: 
-      * Ajouter les options suivantes à ligne de démarrage de //Gunicorn// : <code bashexec gunicorn  wsgi:app --statsd-host=localhost:8125 --statsd-prefix=geonature </code> +      * Créer une fichier //overide// : ''systemctl edit geonature.service'' 
-      * En //root//, relancer le serveur //Gunicorn// à l'aide de //Supervisor// : ''supervisorctl restart geonature2''+      * Ajouter le contenu suivant (nous ajoutons aussi des options de redémarrage auto) : <code properties> 
 +[Unit] 
 +StartLimitIntervalSec=6min 
 +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 :     * Répéter cette procédure pour l'Atlas, UsersHub et TaxHub :
-      * Pour l'Atlas '' cd ~/www/atlas'' et <code bashexec gunicorn  wsgi:app --statsd-host=localhost:8125 --statsd-prefix=atlas </code> +      * Pour l'Atlas, le service se nomme ''geonature-atlas.service'' <code properties> 
-      * Pour TaxHub '' cd ~/www/taxhub'' et <code bashexec gunicorn  wsgi:app --statsd-host=localhost:8125 --statsd-prefix=taxhub </code> +[Unit] 
-      * Pour UsersHub '' cd ~/www/usershub'' et <code bashexec gunicorn  wsgi:app --statsd-host=localhost:8125 --statsd-prefix=usershub </code>+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.   * Vérifier la prise en compte des nouvelles métriques dans //InfluxDB//. Leurs noms doivent débuter par "geonature_...", "atlas_...", etc.
-    * Pour le Dashboard, nous avons adapté à InfluxDB le Dashboard Gunicorn suivant initialement prévu pour Prometheus :  +    * En utilisant l'interface disponible avec InfluxDB v2 : https://influxdb.<domaine-sinp>/ 
-      * https://gist.github.com/dmyerscough/59896aa752ba48794d2aef4c7a0fdd6e +    * En passant par le container : 
-      * https://github.com/pilosus/prometheus-client-python-app-grafana-dashboard/blob/master/flask-web-app.json+      * 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.1618993767.txt.gz
  • Dernière modification : 2021/04/21 08:29
  • de jpmilcent