Initial production-ready release of OpenCare v1

- Flask/SQLAlchemy app with profile, dashboard, recommendations
- AI crawl pipeline (GPT-4o) with admin review workflow
- 14 curated health sources (RSS + index crawling)
- Production config: env vars, Gunicorn, systemd, nginx
- deploy/ scripts for VPS setup and updates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 21:38:03 +02:00
commit efd775706b
28 changed files with 4682 additions and 0 deletions

47
deploy/nginx.conf Normal file
View File

@@ -0,0 +1,47 @@
server {
listen 80;
server_name opencare.open-squared.tech; # adapter selon votre domaine
# Redirection HTTPS (décommenter après avoir configuré le certificat)
# return 301 https://$host$request_uri;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 120s;
}
# Fichiers statiques servis directement par nginx
location /static/ {
alias /opt/opencare/static/;
expires 7d;
add_header Cache-Control "public, immutable";
}
}
# Bloc HTTPS (générer le certificat avec : certbot --nginx -d opencare.open-squared.tech)
# server {
# listen 443 ssl;
# server_name opencare.open-squared.tech;
# ssl_certificate /etc/letsencrypt/live/opencare.open-squared.tech/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/opencare.open-squared.tech/privkey.pem;
# include /etc/letsencrypt/options-ssl-nginx.conf;
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
#
# location / {
# proxy_pass http://127.0.0.1:5000;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_read_timeout 120s;
# }
#
# location /static/ {
# alias /opt/opencare/static/;
# expires 7d;
# }
# }

18
deploy/opencare.service Normal file
View File

@@ -0,0 +1,18 @@
[Unit]
Description=OpenCare Web App
After=network.target
[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/opt/opencare
EnvironmentFile=/opt/opencare/.env
ExecStart=/opt/opencare/venv/bin/gunicorn -c gunicorn.conf.py wsgi:app
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target

63
deploy/setup_vps.sh Normal file
View File

@@ -0,0 +1,63 @@
#!/bin/bash
# Script d'installation OpenCare sur VPS Ubuntu/Debian
# Usage : sudo bash setup_vps.sh
set -e
APP_DIR=/opt/opencare
APP_USER=www-data
REPO=https://gitea.open-squared.tech/admin/opencare.git
echo "=== Installation OpenCare ==="
# 1. Dépendances système
apt-get update -qq
apt-get install -y python3 python3-pip python3-venv nginx git
# 2. Cloner / mettre à jour le repo
if [ -d "$APP_DIR/.git" ]; then
echo "--- Mise à jour du code ---"
cd "$APP_DIR" && git pull
else
echo "--- Clonage du repo ---"
git clone "$REPO" "$APP_DIR"
fi
cd "$APP_DIR"
# 3. Environnement virtuel Python
if [ ! -d "$APP_DIR/venv" ]; then
python3 -m venv venv
fi
venv/bin/pip install -q --upgrade pip
venv/bin/pip install -q -r requirements.txt
# 4. Fichier .env (créer si absent)
if [ ! -f "$APP_DIR/.env" ]; then
cp .env.example .env
SECRET=$(python3 -c "import secrets; print(secrets.token_hex(32))")
sed -i "s/change-me-with-a-strong-random-key/$SECRET/" .env
echo "ATTENTION : .env créé avec une clé secrète aléatoire."
echo "Editez /opt/opencare/.env pour configurer DATABASE_URL et autres."
fi
# 5. Dossier instance (SQLite)
mkdir -p "$APP_DIR/instance"
chown -R "$APP_USER:$APP_USER" "$APP_DIR"
# 6. Service systemd
cp deploy/opencare.service /etc/systemd/system/opencare.service
systemctl daemon-reload
systemctl enable opencare
systemctl restart opencare
# 7. Nginx
cp deploy/nginx.conf /etc/nginx/sites-available/opencare
ln -sf /etc/nginx/sites-available/opencare /etc/nginx/sites-enabled/opencare
rm -f /etc/nginx/sites-enabled/default
nginx -t && systemctl reload nginx
echo ""
echo "=== Déploiement terminé ==="
echo "L'application tourne sur http://$(hostname -I | awk '{print $1}')"
echo "Consultez les logs : journalctl -u opencare -f"

11
deploy/update.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
# Mise à jour rapide après git pull
# Usage (depuis /opt/opencare) : bash deploy/update.sh
set -e
cd /opt/opencare
git pull
venv/bin/pip install -q -r requirements.txt
systemctl restart opencare
echo "Mise à jour terminée — $(systemctl is-active opencare)"