Outils pour utilisateurs

Outils du site


services:agir.chapril.org

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édentesRévision précédente
services:agir.chapril.org [2026/04/11 17:40] – supprimée - modification externe (Date inconnue) 127.0.0.1services:agir.chapril.org [2026/04/11 17:40] (Version actuelle) – ↷ Page déplacée de admin:services:agir.chapril.org à services:agir.chapril.org pitchum
Ligne 1: Ligne 1:
 +====== Service agir.chapril.org ======
 +
 +Redirection vers le projet Chapril dans l’instance [[https://agir.april.org/|Redmine de l'April]].
 +
 +===== Déploiement =====
 +
 +==== DNS ====
 +
 +Configuration du fichier DNS :
 +<code bash>
 +cd /etc/bind/zones/masters/
 +git diff
 +</code>
 +<code>
 +diff --git a/bind/zones/masters/chapril.org b/bind/zones/masters/chapril.org
 +index a5368c5..cb20fcd 100644
 +--- a/bind/zones/masters/chapril.org
 ++++ b/bind/zones/masters/chapril.org
 +@@ -3,7 +3,7 @@
 + 
 + $TTL 1h
 +      IN      SOA     fip.chapril.org.        hostmaster.chapril.org. (
 +-               2019110400              ; Serial  - YYYYMMDDnn
 ++               2020010801              ; Serial  - YYYYMMDDnn
 +                4h                      ; Refresh
 +                1h                      ; Retry
 +                1w                      ; Expire
 +@@ -50,6 +50,10 @@ icinga2 CNAME galanga.april.org.
 + backup  CNAME   icinga2
 + myip    CNAME   icinga2
 + 
 ++; redirections
 ++agir    CNAME   fip
 ++
 + ; XMPP (old)
 + muc.xmpp    CNAME   xmpp
 + echo.xmpp   CNAME   xmpp
 +</code>
 +
 +Activation :
 +<code bash>
 +rndc reload chapril.org in external
 +</code>
 +
 +==== Bastion ====
 +
 +Configuration du certificat TLS :
 +<code bash>
 +cd /etc/
 +git diff dehydrated/domains.txt
 +</code>
 +<code>
 +diff --git a/dehydrated/domains.txt b/dehydrated/domains.txt
 +index b53ff9c..662eb8a 100644
 +--- a/dehydrated/domains.txt
 ++++ b/dehydrated/domains.txt
 +@@ -15,3 +15,5 @@ pad.chapril.org
 + valise.chapril.org
 + xmpp.chapril.org upload-xmpp.chapril.org
 + drop.chapril.org
 ++agir.chapril.org
 +</code>
 +
 +Activation :
 +<code bash>
 +dehydrated -c
 +</code>
 +
 +Configuration du serveur web sur la VM bastion :
 +<code bash>
 +cd /etc/nginx/sites-available
 +cat agir.chapril.org
 +</code>
 +<code nginx>
 +server {
 +    listen 80;
 +    listen [::]:80;
 +    
 +    server_name agir.chapril.org;
 +
 +    access_log /var/log/nginx/agir.chapril.org/agir.chapril.org.access_log;
 +    error_log /var/log/nginx/agir.chapril.org/agir.chapril.org.error_log;
 +
 +#    include /etc/nginx/custom_50x;
 +    include /etc/nginx/acme-challenge;
 +    include /etc/nginx/sexy-chapril;
 +    include /etc/nginx/force-ssl.conf;
 +}
 +
 +
 +server {
 +    listen 443 ssl;
 +    listen [::]:443 ssl;
 +    ssl on;
 +    
 +    server_name agir.chapril.org;
 +
 +    access_log /var/log/nginx/agir.chapril.org/agir.chapril.org.access_log;
 +    error_log /var/log/nginx/agir.chapril.org/agir.chapril.org.error_log;
 +
 +#    include /etc/nginx/custom_50x;
 +    ssl_certificate     /var/lib/dehydrated/certs/agir.chapril.org/fullchain.pem;
 +    ssl_certificate_key /var/lib/dehydrated/certs/agir.chapril.org/privkey.pem;
 +
 +    include /etc/nginx/acme-challenge;
 +    include /etc/nginx/sexy-chapril;
 +
 +    return 301 https://agir.april.org/projects/chapril/issues;
 +}
 +</code>
 +
 +Création du dossier de logs :
 +<code bash>
 +mkdir /var/log/nginx/agir.chapril.org/
 +ln -sf /etc/nginx/sites-available/agir.chapril.org /etc/nginx/sites-enabled/
 +</code>
 +
 +Activation :
 +<code bash>
 +nginx -t
 +systemctl reload nginx
 +</code>
 +
 +Création du dossier de logs :
 +<code bash>
 +mkdir /var/log/nginx/agir.chapril.org/
 +ln -sf /etc/nginx/sites-available/agir.chapril.org /etc/nginx/sites-enabled/
 +</code>
 +
 +Activation :
 +<code bash>
 +nginx -t
 +systemctl reload nginx
 +</code>
 +
 +==== Supervision ====
 +
 +Monitoring ajouté :
 +<code bash>
 +cd /etc/icinga2/zones.d/master/cluster/
 +git diff
 +</code>
 +<code>
 +diff --git a/icinga2/zones.d/master/cluster/bastion.conf b/icinga2/zones.d/master/cluster/bastion.conf
 +index da31c6c..53127e4 100644
 +--- a/icinga2/zones.d/master/cluster/bastion.conf
 ++++ b/icinga2/zones.d/master/cluster/bastion.conf
 +@@ -25,6 +25,20 @@ object Host "bastion.cluster.chapril.org" {
 +     disk_partitions = "/tmp"
 +   }
 + 
 ++  vars.http_vhosts["agir.chapril.org redirection"] = {
 ++    http_vhost = "agir.chapril.org"
 ++    http_ssl = true
 ++    http_uri = "/"
 ++    http_expect = "HTTP/1.1 301 Moved Permanently,Location: https://agir.april.org/projects/chapril/issues"
 ++  }
 +
 +   /* Define notification mail attributes for notification apply rules in `notifications.conf`. */
 +   vars.notification["mail"] = {
 +     /* The UserGroup `icingaadmins` is defined in `users.conf`. */
 +
 +</code>
 +
 +===== Compte pour la création de note Redmine =====
 +
 +Dans le Redmine :
 +  * Un compte ''chagirbot'' a été créé ;
 +  * Un rôle ''Bot'' a été créé avec uniquement le droit de voir les demandes et d'ajouter une note ;
 +  * Le compte ''chagirbot'' a été ajouté au projet Chapril avec le rôle ''Bot'' ;
 +  * Une clef d'API Redmine a été générée : se connecter sur https://agir.april.org/ avec le compte ''chagirbot'' puis cliquer sur //Mon compte// et aller dans //Clé d'accès API//.
 +
 +Sur les VM, la clef est disponible dans le fichier ''/etc/chagirbot/agiraprilorg.conf''.
 +
 +===== Chagirbot (Redminebot) =====
 +
 +Redminebot (//agirbot// sur le réseau IRC [[https://libera.chat/|Libera]]) est un bot qui analyse régulièrement les fichiers Atom de ''agir.april.org'' pour afficher sur un canal IRL l'activité d'un projet.
 +
 +À l'origine dédié à gDTC sur le salon ''#gdtc'', il est utilisé pour le projet admin sur ''#april-admin'' et maintenant pour le Chapril sur ''#april-chapril''.
 +
 +Il a été écrit en Python après grosse réécriture du script redmine IRC bot.
 +
 +Agirbot possède un dépôt Git dans <del>Agir : https://agir.april.org/projects/admins/repository/agirbot</del> la forge de l’April : https://forge.april.org/adminsys/agirbot.
 +
 +==== Déploiement ====
 +
 +Dans le réseau IRC Libera, déclarer (//register//) le //nickname// ''chagirbot'' auprès de ''NickServ'' avec un mot de passe.
 +
 +<code>
 +08:17 -NickServ(NickServ@services.)-
 +08:18 <chagirbot> register xxxxxxxxx chagirbot@chapril.org
 +08:18 -NickServ(NickServ@services.)- An email containing nickname activation instructions has been sent to chagirbot@chapril.org.
 +08:18 -NickServ(NickServ@services.)- If you do not complete registration within one day, your nickname will expire.
 +08:18 -NickServ(NickServ@services.)- chagirbot is now registered to chagirbot@chapril.org, with the password JxQwAKjwC3HFWTfzwiq7.
 +08:18 -NickServ(NickServ@services.)-  
 +08:18 -NickServ(NickServ@services.)- For frequently-asked questions about the network, please see the
 +08:18 -NickServ(NickServ@services.)- Knowledge Base page (http://freenode.net/kb/all). Should you need more
 +08:18 -NickServ(NickServ@services.)- help you can /join #freenode to find network staff.
 +</code>
 +
 +Créer un utilisateur ''chagirbot'' :
 +<code bash>
 +adduser --system --group --home /srv/chagirbot --shell /bin/false chagirbot
 +</code>
 +
 +Installation des dépendances de paquets:
 +<code bash>
 +apt-get install python-iso8601 python-twisted python-dateutil python-feedparser
 +</code>
 +
 +Clonage :
 +<code bash>
 +cd /srv/chagirbot/
 +git clone april@agir.cluster.april.org:/srv/git/agirbot git
 +</code>
 +
 +Définition de l'exécutable :
 +<code bash>
 +cd /srv/chagirbot/
 +mkdir bin
 +cd bin/
 +ln -s ../git/redminebot.py chagirbot.py
 +</code>
 +
 +Déploiement du fichier de configuration :
 +<code bash>
 +cp /srv/chagirbot/git/redminebot.conf /etc/chagirbot/chagirbot.conf
 +cd /srv/chagirbot/
 +mkdir conf
 +cd conf/
 +ln -s /etc/chagirbot/chagirbot.conf /etc/chagirbot/conf/
 +</code>
 +
 +Adapter le fichier ''/etc/chagirbot/chagirbot.conf'' :
 +  * Mettre le mot de passe IRC du nickname bot ;
 +  * définir projet ''chapril'' et canal ''#april-chapril''.
 +
 +Définir le service dans Systemd :
 +<code bash>
 +cp /srv/chagirbot/git/redminebot.service /etc/systemd/system/
 +ln -s /etc/systemd/system/chagirbot.service /srv/chagirbot/conf/
 +</code>
 +
 +Adapter le fichier ''/etc/systmd/system/chagirbot.service'' avec :
 +  * Le bon chemin ;
 +  * Le bon compte ;
 +  * Le bon groupe ;
 +  * Le chemin du fichier de configuration passé en paramètre ''ExecStart''.
 +
 +Configurer le lancement du service à l’amorçage (//boot//) :
 +<code bash>
 +cd ~/
 +systemctl enable chagirbot
 +</code>
 +<code>
 +Created symlink /etc/systemd/system/multi-user.target.wants/chagirbot.service → /etc/systemd/system/chagirbot.service.
 +</code>
 +
 +Ajouter une sonde dans Icinga2 (''/etc/icinga2/zones.d/master/cluster/admin.conf'') pour valider le bon fonctionnement du bot :
 +<code nagios>
 +  vars.process["Chagirbot"] = {
 +    procs_command = "python3"
 +    procs_argument = "chagirbot.py"
 +    procs_critical = "1:1"
 +  }
 +</code>
 +
 +==== Logs ====
 +
 +Des logs sont consultables via Systemd :
 +<code bash>
 +journalctl -f -u chagirbot
 +</code>