175 lines
4.2 KiB
Markdown
175 lines
4.2 KiB
Markdown
# Service STATUS
|
|
|
|
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
|
|
|
|
Équipe : neox + Cpm.
|
|
Anciennement : n/a.
|
|
|
|
Date création : octobre 2022.
|
|
|
|
|
|
# Installation
|
|
|
|
## 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
|
|
|
|
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
|
|
```
|
|
|
|
Préparer l'espace de configuration :
|
|
```
|
|
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/
|
|
```
|
|
|
|
Programmer un cron dans `/etc/cron.d/tinystatus` :
|
|
```
|
|
*/5 * * * * root /srv/tinystatus/tinystatus /etc/tinystatus/checks.csv /etc/tinystatus/incidents.txt > /var/www/status.chalec.org/index.html
|
|
```
|
|
|
|
## Personnaliser le UserAgent
|
|
|
|
Important de mettre un UserAgent identifiable en tant que bot. Éditer le fichier `/srv/tinystatus/tinystatus` :
|
|
```
|
|
-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"
|
|
```
|