docs: ajout service systemd et instructions de déploiement

- tableau-de-bord-pro.service : service Gunicorn pour www-data
- README : section production avec systemctl edit --full

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 20:55:38 +01:00
parent abbce5e799
commit bb0e57dbc6
2 changed files with 38 additions and 2 deletions

View File

@@ -35,10 +35,29 @@ python -m venv .venv
L'application est accessible sur `http://localhost:5000`.
### Production (Gunicorn)
### Production (systemd + Gunicorn)
Déploiement dans `/var/www/tableau-de-bord-pro/`, service géré par systemd.
```bash
SECRET_KEY=<votre-clé-secrète> ./start.sh
# Copier l'application
sudo rsync -a --exclude='.venv' --exclude='instance' . /var/www/tableau-de-bord-pro/
cd /var/www/tableau-de-bord-pro
sudo python -m venv .venv
sudo .venv/bin/pip install -r requirements.txt
sudo chown -R www-data:www-data /var/www/tableau-de-bord-pro
# Installer le service
sudo cp tableau-de-bord-pro.service /etc/systemd/system/
# Configurer (notamment SECRET_KEY)
sudo systemctl edit --full tableau-de-bord-pro
# Activer et démarrer
sudo systemctl enable --now tableau-de-bord-pro
# Vérifier
sudo systemctl status tableau-de-bord-pro
```
### Configuration

View File

@@ -0,0 +1,17 @@
[Unit]
Description=Tableau de bord pro (Gunicorn)
After=network.target
[Service]
User=www-data
Group=www-data
WorkingDirectory=/var/www/tableau-de-bord-pro
Environment=SECRET_KEY=changeme-replace-with-a-strong-secret
ExecStart=/var/www/tableau-de-bord-pro/.venv/bin/gunicorn \
-c /var/www/tableau-de-bord-pro/gunicorn.conf.py \
"app:create_app()"
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target