documentation
Kohinos v3 Doc générée le commit 8d60b1904

Cron & commandes

Toute la mécanique financière mensuelle tourne via des commandes Symfony planifiées. Chaque commande modifiant la BDD doit accepter --dry-run (simulation) et --test (mode test sans email réel).

Calendrier mensuel type

gantt
    title Cycle mensuel Kohinos
    dateFormat  YYYY-MM-DD
    section SEPA
    Génération XML pain.008    :a1, 2026-05-01, 1d
    Validation trésorier        :a2, after a1, 1d
    Dépôt banque                :a3, after a2, 1d
    section SSA
    Calcul prélèvements         :b1, 2026-05-10, 1d
    Redistribution              :b2, after b1, 1d
    section Cotisation
    Renouvellement annuel       :c1, 2026-05-15, 1d
    section Maintenance
    Vérification soldes         :d1, 2026-05-20, 1d
    
Indicatif : dates configurables par MLC.

Commandes principales

SEPA

# Traitement mensuel SEPA (génère le pain.008 et débite)
php bin/console kohinos:sepa:process-monthly [--test] [--force-date=YYYY-MM-DD]

SSA — Sécurité Sociale de l'Alimentation

# Exécution mensuelle du fonds Solidoume (prélèvement + redistribution)
php bin/console kohinos:ssa:execute [--test]

# Alertes aux anciens participants sortis du fonds
php bin/console kohinos:ssa:send-former-participant-alerts

MLC — Cotisations & comptes

# Cotisation annuelle (renouvellement automatique des mandats SEPA cotisation)
php bin/console kohinos:mlc:process-annual-subscriptions

# Création des comptes manquants pour les entités existantes
php bin/console kohinos:accounts:create

# Vérification de cohérence des soldes (somme débits = somme crédits)
php bin/console kohinos:accounts:check

Maintenance Doctrine

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate --no-interaction
php bin/console doctrine:schema:validate

Utilitaires

# Migration des IBAN en chiffré (AES-256-CBC) — à exécuter UNE fois
php bin/console app:migrate-iban-encryption [--dry-run]

# Init de la base de test (vidée + réinjectée)
php bin/console app:init-test-database --env=test --purge

# Récupérer la BDD prod en local (script)
php scripts/database/download-database.php

Crontab type (production)

# /etc/cron.d/kohinos — utilisateur www-data
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
KOHINOS=/var/www/kohinos
ENV=--env=prod

# SEPA : tous les jours à 06:00, le script décide lui-même si c'est le jour
0 6 * * *   www-data  cd $KOHINOS && php bin/console kohinos:sepa:process-monthly $ENV  >> var/log/cron-sepa.log 2>&1

# SSA : le 15 de chaque mois à 07:00
0 7 15 * *  www-data  cd $KOHINOS && php bin/console kohinos:ssa:execute $ENV  >> var/log/cron-ssa.log 2>&1

# Alertes anciens participants SSA : le 20 à 09:00
0 9 20 * *  www-data  cd $KOHINOS && php bin/console kohinos:ssa:send-former-participant-alerts $ENV

# Cotisations annuelles : tous les jours à 05:00, script décide
0 5 * * *   www-data  cd $KOHINOS && php bin/console kohinos:mlc:process-annual-subscriptions $ENV

# Vérification de cohérence quotidienne : 04:00
0 4 * * *   www-data  cd $KOHINOS && php bin/console kohinos:accounts:check $ENV  >> var/log/cron-check.log 2>&1

# Rotation cache 1 fois par semaine
30 3 * * 0  www-data  cd $KOHINOS && php bin/console cache:pool:prune $ENV

Bonnes pratiques d'exploitation

Exemple de wrapper flock

# /etc/cron.d/kohinos — version avec flock
0 7 15 * * www-data flock -n /var/lock/kohinos-ssa.lock -c \
    "cd /var/www/kohinos && php bin/console kohinos:ssa:execute --env=prod"