Add deployment notes
This commit is contained in:
143
DEPLOY_NOTES.md
Normal file
143
DEPLOY_NOTES.md
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
# Notes de deploiement - OpenSquared PWA
|
||||||
|
|
||||||
|
Date: 2026-04-26
|
||||||
|
|
||||||
|
## Depot
|
||||||
|
|
||||||
|
```text
|
||||||
|
https://gitea.open-squared.tech/admin/openbot.git
|
||||||
|
branche main
|
||||||
|
```
|
||||||
|
|
||||||
|
Commits importants:
|
||||||
|
|
||||||
|
```text
|
||||||
|
fb8cc4d Initial PWA assistant proof of concept
|
||||||
|
94148e8 Rename installed PWA to OpenSquared
|
||||||
|
1f815fa Version PWA icon asset to refresh Android cache
|
||||||
|
1b9933d Fix voice button audio unlock hang
|
||||||
|
```
|
||||||
|
|
||||||
|
## VPS
|
||||||
|
|
||||||
|
```text
|
||||||
|
Serveur: 46.202.173.47
|
||||||
|
Dossier app: /root/openbot
|
||||||
|
Domaine: bot.open-squared.tech
|
||||||
|
URL: https://bot.open-squared.tech
|
||||||
|
```
|
||||||
|
|
||||||
|
L'app Flask a ete testee sur:
|
||||||
|
|
||||||
|
```text
|
||||||
|
http://46.202.173.47:8080/health
|
||||||
|
https://bot.open-squared.tech/health
|
||||||
|
```
|
||||||
|
|
||||||
|
## Python
|
||||||
|
|
||||||
|
Sur le VPS, `python3 -m venv .venv` a d'abord echoue car `python3.12-venv` manquait.
|
||||||
|
|
||||||
|
Correctif:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt update
|
||||||
|
apt install -y python3.12-venv
|
||||||
|
cd /root/openbot
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## HTTPS et Nginx Docker
|
||||||
|
|
||||||
|
Le VPS utilise deja un `docker-compose.yml` avec un conteneur `nginx`.
|
||||||
|
|
||||||
|
Montage nginx:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/root/tradon/nginx/conf -> /etc/nginx/conf.d
|
||||||
|
/etc/letsencrypt -> /etc/letsencrypt:ro
|
||||||
|
/root/tradon/nginx/certbot -> /var/www/certbot
|
||||||
|
```
|
||||||
|
|
||||||
|
Le bloc HTTP doit servir les challenges avant la redirection:
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
location /.well-known/acme-challenge/ {
|
||||||
|
root /var/www/certbot;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Certificat cree avec:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
certbot certonly --webroot \
|
||||||
|
-w /root/tradon/nginx/certbot \
|
||||||
|
-d bot.open-squared.tech
|
||||||
|
```
|
||||||
|
|
||||||
|
Le bloc HTTPS `bot.open-squared.tech` doit utiliser:
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
ssl_certificate /etc/letsencrypt/live/bot.open-squared.tech/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/bot.open-squared.tech/privkey.pem;
|
||||||
|
```
|
||||||
|
|
||||||
|
Proxy depuis nginx Docker vers Flask sur l'hote:
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
proxy_pass http://172.17.0.1:8080;
|
||||||
|
```
|
||||||
|
|
||||||
|
Verifier:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec nginx nginx -t
|
||||||
|
docker exec nginx nginx -s reload
|
||||||
|
curl -I https://bot.open-squared.tech/health
|
||||||
|
```
|
||||||
|
|
||||||
|
## PWA Android
|
||||||
|
|
||||||
|
Nom installe:
|
||||||
|
|
||||||
|
```text
|
||||||
|
OpenSquared
|
||||||
|
```
|
||||||
|
|
||||||
|
Icone:
|
||||||
|
|
||||||
|
```text
|
||||||
|
static/icons/icon-v2.svg
|
||||||
|
```
|
||||||
|
|
||||||
|
Pour forcer Android/Chrome a prendre la nouvelle icone:
|
||||||
|
|
||||||
|
1. `git pull` sur le VPS.
|
||||||
|
2. Ouvrir `https://bot.open-squared.tech/icons/icon-v2.svg`.
|
||||||
|
3. Desinstaller l'ancienne PWA.
|
||||||
|
4. Reinstaller depuis Chrome.
|
||||||
|
|
||||||
|
## Cache et bouton micro
|
||||||
|
|
||||||
|
Le bouton `Demarrer` etait non reactif sur navigateur parce que `unlockAudio()` pouvait rester bloque sur `audio.play()` avec un audio vide.
|
||||||
|
|
||||||
|
Correctif applique:
|
||||||
|
|
||||||
|
- `unlockAudio()` utilise maintenant `AudioContext`.
|
||||||
|
- `index.html` charge `/app.js?v=4`.
|
||||||
|
- Service worker: `opensquared-assistant-v4`.
|
||||||
|
|
||||||
|
Si le bouton ne reagit pas apres un deploiement:
|
||||||
|
|
||||||
|
```text
|
||||||
|
PC: Ctrl+F5
|
||||||
|
Android: fermer l'app, rouvrir Chrome, ou desinstaller/reinstaller la PWA
|
||||||
|
```
|
||||||
|
|
||||||
|
Si ca persiste, ouvrir F12 -> Console et lire l'erreur JS.
|
||||||
Reference in New Issue
Block a user