2022-10-05 15:27:03 +02:00
# Service STATUS
2022-10-05 18:55:09 +02:00
Service d'information sur l'état des service du Chalec, le chaton de Libre en communs, basé sur le logiciel libre TinyStatus : https://github.com/bderenzo/tinystatus
2022-10-05 15:34:19 +02:00
Équipe : neox + Cpm.
2022-10-05 18:55:09 +02:00
Anciennement : n/a.
2022-10-05 15:27:03 +02:00
2022-10-05 15:33:16 +02:00
Date création : octobre 2022.
2022-10-05 18:34:38 +02:00
# Installation
2022-10-05 18:55:09 +02:00
## Prérequis système
Vérifier que le fichier `/etc/hosts.deny` ne bloque pas les connexions ssh :
```
#sshd: ALL
```
## NGinx
Installer les paquets :
```
apt-get install nginx python3-certbot-nginx
```
Ouvrir les ports http (80) et https (443) :
```
ufw allow 'Nginx HTTP'
ufw allow 'Nginx HTTPS'
ufw allow 444
```
Configurer a minima le site web dans `/etc/nginx/sites-available/status.chalec.org` :
```
server
{
listen 80;
listen [::]:80;
server_name status.chalec.org;
access_log /var/log/nginx/status.chalec.org-access.log;
error_log /var/log/nginx/status.chalec.org-error.log;
}
```
Activer la configuration :
```
cd /etc/nginx/sites-enabled/
ln -s ../sites-available/status.chalec.org
```
Vérifier que c'est bon et recharger :
```
nginx -t & & systemctl reload nginx
```
Configurer le certificat SSl :
```
certbot --nginx
```
Créer un fichier générique `cat /etc/nginx/statoolinfos.conf` qui sera includé plus tard :
```
location /.well-known/statoolinfos/
{
types
{
text/plain properties;
}
alias /srv/statoolinfos/well-known/statoolinfos/;
autoindex on;
}
```
Mettre beau le fichier `/etc/nginx/sites-enabled/status.chalec.org` :
```
server
{
listen 80;
listen [::]:80;
server_name status.chalec.org;
access_log /var/log/nginx/status.chalec.org-access.log;
error_log /var/log/nginx/status.chalec.org-error.log;
#return 302 https://$host$request_uri;
return 302 https://status.chalec.org$request_uri;
}
server
{
set_real_ip_from 192.169.1.1;
real_ip_header proxy_protocol;
listen [::]:443 ssl;
listen 444 ssl proxy_protocol;
server_name status.chalec.org;
access_log /var/log/nginx/status.chalec.org-access.log;
error_log /var/log/nginx/status.chalec.org-error.log;
ssl_certificate /etc/letsencrypt/live/status.chalec.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/status.chalec.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
# StatoolInfos.
include /etc/nginx/statoolinfos.conf;
root /var/www/status.chalec.org;
location = /
{
index index.html;
}
}
```
Vérifier que c'est bon et recharger :
```
nginx -t & & systemctl reload nginx
```
## Déploiement de l'application
2022-10-05 18:34:38 +02:00
Prodécure de référence : https://github.com/bderenzo/tinystatus#setup
Créer le dossier web cible :
```
mkdir -p /var/www/status.chalec.org/
chown www-data /var/www/status.chalec.org/
```
Récupérer l'application :
```
cd /srv/
git clone https://github.com/bderenzo/tinystatus.git
```
2022-10-06 00:56:24 +02:00
Préparer l'espace de configuration :
2022-10-05 18:34:38 +02:00
```
2022-10-06 00:56:24 +02:00
mkdir /etc/tinystatus/
cd /srv/tinystatus/
cp *csv /etc/tinystatus/
```
Paramétrer les éléments à surveiller, en éditant le fichier `/etc/tinystatus/checks.csv` :
```
http, 200, Site web Chalec, https://www.chalec.org/
http, 200, Service Audio, https://audio.chalec.org/
http, 200, Service Ctrlv, https://ctrlv.chalec.org/
http, 200, Service Forge, https://forge.chalec.org/
http, 200, Service Libreverse, https://libreverse.chalec.org/
http, 200, Service Pad, https://pad.chalec.org/
http, 200, Service XMPP, https://xmpp.chalec.org/
http, 200, Service Stats, https://stats.chalec.org/
2022-10-05 18:34:38 +02:00
```
2022-10-05 18:55:09 +02:00
Programmer un cron dans `/etc/cron.d/tinystatus` :
2022-10-05 18:34:38 +02:00
```
2022-10-06 00:56:24 +02:00
*/5 * * * * root /srv/tinystatus/tinystatus /etc/tinystatus/checks.csv /etc/tinystatus/incidents.txt > /var/www/status.chalec.org/index.html
2022-10-06 00:46:27 +02:00
```
## Personnaliser le UserAgent
2022-10-06 00:56:24 +02:00
Important de mettre un UserAgent identifiable en tant que bot. Éditer le fichier `/srv/tinystatus/tinystatus` :
2022-10-06 00:46:27 +02:00
```
-useragent="User-Agent: Mozilla/5.0 (X11; Linux x86_64; Debian) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"
+useragent="User-Agent: TinyStatus bot"
2022-10-05 18:34:38 +02:00
```