smart_ide/cron/README.md
Nicolas Cantu d98e6bce60 feat: logs/ for pull-sync and ia_dev; document ia_dev as in-repo module
- Default PULL_SYNC_LOG to logs/git-pull-projects.log; add logs/README and gitignore
- Add services/ia_dev integration README and .env.example
- Replace docs/ia_dev-submodule.md with ia_dev-module.md; update ecosystem and README links
- Point ia_dev submodule to commit with smart_ide_logs.sh
2026-04-03 17:50:49 +02:00

61 lines
2.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Tirage Git planifié — clones `projects/*/conf.json`
## Comportement
Le script [`git-pull-project-clones.sh`](./git-pull-project-clones.sh) parcourt [`../projects/<id>/`](../projects/) (fichiers `conf.json`), lit **`project_path`**, et pour chaque dépôt Git:
1. **`git fetch origin <branche_courante>`**
2. si **`origin/<branche>`** est en avance en **fast-forward****`git merge --ff-only origin/<branche>`**
3. sinon → message explicite, **pas** de merge forcé
## Configuration centralisée
| Fichier | Rôle |
|---------|------|
| [`config.env`](./config.env) | **Versionné** : `PULL_SYNC_ENABLED`, `PULL_SYNC_MODE` (`all` \| `project`), `PULL_SYNC_PROJECT_ID`, `PULL_SYNC_LOG` |
| `config.local.env` | **Optionnel, non versionné** (voir [`config.local.env.example`](./config.local.env.example)) — surcharge machine |
Le script [`git-pull-wrapper.sh`](./git-pull-wrapper.sh) charge ces fichiers puis appelle `git-pull-project-clones.sh` et **append** la sortie dans `PULL_SYNC_LOG` (défaut : **`logs/git-pull-projects.log`** à la racine du dépôt — voir [`logs/README.md`](../logs/README.md)).
## Mise en place recommandée : systemd utilisateur
Depuis la racine du dépôt **smart_ide**:
```bash
./scripts/install-git-pull-systemd-user.sh
```
Cela installe sous `~/.config/systemd/user/`:
- `git-pull-project-clones.service` (généré depuis [`../systemd/user/git-pull-project-clones.service.in`](../systemd/user/git-pull-project-clones.service.in))
- `git-pull-project-clones.timer` ([`../systemd/user/git-pull-project-clones.timer`](../systemd/user/git-pull-project-clones.timer)) — **toutes les 15 minutes** (`OnCalendar=*:0/15`)
Commandes utiles:
```bash
systemctl --user status git-pull-project-clones.timer
systemctl --user list-timers | grep git-pull
journalctl --user -u git-pull-project-clones.service -n 50 --no-pager
```
Pour changer la fréquence : éditer le fichier **timer** dans le dépôt, relancer `install-git-pull-systemd-user.sh`, ou éditer directement `~/.config/systemd/user/git-pull-project-clones.timer` puis `systemctl --user daemon-reload`.
## Prérequis
- **`jq`**
- Clones avec remote **`origin`** et branche suivie (ex. `test`)
## Désactiver un projet
Dans `projects/<id>/conf.json` : `"cron": { "git_pull": false }`.
Pour **tout** arrêter : `PULL_SYNC_ENABLED=0` dans `config.env` ou `config.local.env`, ou `systemctl --user disable --now git-pull-project-clones.timer`.
## Crontab (alternative)
Si tu préfères cron au lieu de systemd : une ligne qui appelle **`./cron/git-pull-wrapper.sh`** (pas besoin de redéfinir les variables si tu utilises uniquement `config.env`). Fragments: [`fragments/`](./fragments/) (à aligner sur le wrapper).
## Hooks AnythingLLM
Un **`post-merge`** sur un clone peut sexécuter après un `merge --ff-only` : voir [`scripts/anythingllm-pull-sync`](../scripts/anythingllm-pull-sync/).