Commit Graph

14 Commits

Author SHA1 Message Date
Sepehr
8f55e3d9aa fix(glossaries): dedup by (user_id, name) instead of (user_id, template_id)
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 3m1s
Le groupement par template_id etait faux sur la prod :
- Les doublons historiques ont template_id=NULL (crees avant la migration)
- Deux glossaires 'Finance - FR->Anglais' et 'Finance - FR->Multilingue'
  partagent le meme template_id mais DOIVENT etre conserves separement.

Changements :
- Groupement par (user_id, name) -> c'est ce que l'utilisateur voit dans l'UI
  et la definition reelle d'un doublon.
- Les glossaires multilingues ('-> Multilingue') ont un nom distinct des
  versions '-> Anglais' : ils ne sont jamais fusionnes (preserve par design).
- Fallback automatique si la colonne template_id est absente du schema
  (dev DB) : warning + requete sans la colonne, aucun crash.
- Suppression du flag --allow-missing-template-id devenu inutile.
- Nettoyage des imports ORM inutiles (text brut uniquement, plus rapide).
2026-06-03 21:48:53 +02:00
Sepehr
cd32a42b1a feat(glossaries): add backup + delete scripts and Gitea workflow for duplicate cleanup
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 6m31s
- scripts/backup_duplicate_glossaries.py : exporte en JSON les doublons
  (meme user_id + template_id) sans rien supprimer. Schema validation,
  tri stable, mode degrade si colonne template_id absente.
- scripts/delete_duplicate_glossaries.py : lit un backup JSON et supprime
  les doublons listes. Validation IDs, confirmation interactive,
  commit par user, mode --dry-run / --yes.
- .gitea/workflows/cleanup-glossaries.yml : workflow_dispatch qui SSH
  sur le serveur de prod et execute le script dans le conteneur backend
  (postgres demarre, .env charge, env_file docker-compose).
2026-06-03 21:21:11 +02:00
6a6b510e56 fix: remaining multiline logger job_id errors and prevent grafana removal during deploy
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m34s
2026-05-17 18:32:32 +02:00
4ec39a42a8 fix: prevent docker compose from consuming stdin in ssh deploy script
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 1m14s
2026-05-17 17:31:19 +02:00
6c0ecded47 fix: automatic DB migration — run before backend starts
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 3s
Three fixes to ensure alembic migrations always run in production:

1. entrypoint.sh: add `exec "$@"` passthrough so `docker compose run
   --rm backend alembic upgrade head` actually runs alembic instead of
   ignoring args and starting uvicorn.

2. entrypoint.sh: remove `|| echo` fallback on alembic — if migration
   fails the container must stop, not silently continue.

3. deploy.yml: start only postgres+redis first, run migration, THEN
   start backend. Previously the backend started before migration,
   ran with stale schema, and the separate migration step was broken
   by the entrypoint bug.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 11:03:42 +02:00
413f610f1a feat: production CI/CD with DB backup and auto-rollback
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2s
8-step pipeline:
1. Git pull
2. pg_dumpall + gzip backup (keep last 10)
3. Build images (with cache)
4. Start services
5. Wait for postgres
6. Run alembic migration (one-shot container)
   - On failure: auto-restore DB from backup
7. Health check backend
   - On failure: auto-rollback DB + restart
8. Summary with backup path

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 10:02:36 +02:00
392418c3f9 fix: run alembic migration in one-shot container before backend start
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m1s
- Use 'docker compose run --rm backend alembic upgrade head' to run
  migration in a throwaway container (doesn't need backend running)
- Restore entrypoint migration fallback (don't block startup)
- Restart backend after migration to pick up schema changes
- Remove --no-cache (too slow, was causing timeouts)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 09:59:20 +02:00
f409ccc647 fix: force --no-cache on docker build to pick up all dependency changes
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 2m39s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 01:38:07 +02:00
3069cf5928 fix: add explicit alembic migration step to CI pipeline
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 52s
Entrypoint migration can fail silently. Now runs explicitly:
  1. Wait for postgres
  2. alembic upgrade head (explicit, fails the deploy if broken)
  3. Wait for backend healthy

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 01:28:55 +02:00
20e8565929 fix: merge monitoring into main docker-compose.yml
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 51s
All services (app + Prometheus + Grafana + node-exporter + cAdvisor)
are now in a single docker-compose.yml. One `docker compose up -d`
starts everything. No more separate monitoring file needed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 15:39:26 +02:00
a77b500e50 fix: merge monitoring deploy into single job
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 51s
Monitoring was in a separate blocked job. Now everything runs in one
SSH session so Prometheus + Grafana always deploy with the app.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 15:23:17 +02:00
38b59ba48d fix: rewrite deploy workflow to use SSH-based deployment
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 2m20s
Deploy to Production / Deploy Monitoring (push) Has been skipped
Use ubuntu-24.04 runner with SSH to 192.168.1.151 (same pattern as
memento project). Self-hosted runner is not needed on the server.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 14:53:15 +02:00
26dfa08730 feat: add Prometheus metrics + fix CI/CD health check port
Some checks failed
Deploy to Homelab / Deploy Wordly to 192.168.1.151 (push) Has been cancelled
Deploy to Homelab / Deploy Monitoring (if configured) (push) Has been cancelled
- Add prometheus-client dependency
- Create middleware/metrics.py with PrometheusMiddleware
- Expose /metrics endpoint in Prometheus text format
- Track http_requests_total, translation_total, translation_duration_seconds,
  file_size_bytes
- Instrument translate routes with record_translation() and record_file_size()
- Fix deploy.yml health check: localhost:8000 -> localhost:8001 (Portainer conflict)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 14:33:10 +02:00
f79a4303ac ci: add Gitea Actions self-hosted deployment workflow
Some checks failed
Deploy to Homelab / Deploy Wordly to 192.168.1.151 (push) Has been cancelled
Deploy to Homelab / Deploy Monitoring (if configured) (push) Has been cancelled
Auto-deploys to 192.168.1.151 on push to production-deployment:
- Builds backend and frontend Docker images
- Starts all services with health checks
- Optionally deploys monitoring stack
- Cleans up old images

Requires a self-hosted runner on the target server.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 11:53:41 +02:00