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:
23
README.md
23
README.md
@@ -35,10 +35,29 @@ python -m venv .venv
|
|||||||
|
|
||||||
L'application est accessible sur `http://localhost:5000`.
|
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
|
```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
|
### Configuration
|
||||||
|
|||||||
17
tableau-de-bord-pro.service
Normal file
17
tableau-de-bord-pro.service
Normal 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
|
||||||
Reference in New Issue
Block a user