diff --git a/scripts/targo-sync/.gitignore b/scripts/targo-sync/.gitignore new file mode 100644 index 0000000..2ce3fc6 --- /dev/null +++ b/scripts/targo-sync/.gitignore @@ -0,0 +1,7 @@ +# Secrets hôte — JAMAIS versionnés +secrets.env +*.env +# Logs + locks runtime +*.log +.lock +.*.lock diff --git a/scripts/targo-sync/README.md b/scripts/targo-sync/README.md index 77d8b15..3514012 100644 --- a/scripts/targo-sync/README.md +++ b/scripts/targo-sync/README.md @@ -52,8 +52,26 @@ Réconciliation visible dans OPS : page **/sync-legacy** → carte « Réconcili ## Fichiers +## Tickets → Issue (cron QUOTIDIEN séparé) + +`tickets-daily.sh` (cron `30 4 * * *`) lance `migrate_tickets.py` (idempotent, skip par +`legacy_ticket_id`) pour n'importer que les nouveaux tickets. Séparé de `run.sh` (horaire) car +le scan de 252k tickets est trop lourd pour l'horaire. Le canonique de `migrate_tickets.py` est +`scripts/migration/` ; en déployer une copie dans `/opt/targo-sync/`. Messages des tickets *closed* +non importés (deferred ; `import_ticket_msgs.py` au besoin). + +## 🔐 Secrets — JAMAIS dans le repo + +Le mot de passe F (`LEGACY_PW`) se charge depuis `/opt/targo-sync/secrets.env` (hôte, `chmod 600`, +**non versionné** — voir `.gitignore`). Les `.py` du repo ont un défaut VIDE (`os.environ.get("LEGACY_PW","")`). +Ne **jamais** committer une copie prod d'un script qui aurait le mot de passe en dur. + +## Fichiers + | Fichier | Rôle | |---|---| -| `run.sh` | Orchestrateur cron (4 étapes DAG) | -| `sync_services_incremental.py` | Service Location (delivery) + Service Subscription (service) : création + prix + **statut (fix fantômes)** | +| `run.sh` | Orchestrateur cron horaire (4 étapes DAG) | +| `sync_services_incremental.py` | Service Location (delivery) + Service Subscription (service) : création + prix + **statut (fix fantômes raffiné)** | | `sync_invoices_incremental.py` | Sales Invoice (miroir des factures F ; statut reflétant F) | +| `tickets-daily.sh` | Wrapper cron quotidien → `migrate_tickets.py` (secret via `secrets.env`) | +| `secrets.env` | **Hôte seulement, non versionné** : `LEGACY_PW=…` |