smart_ide/docs/repo/cron-git-pull.md
Nicolas Cantu ac96434351 docs: centralize README content under docs/repo/
**Motivations:**
- Single canonical documentation tree under docs/; reduce drift between README copies.

**Evolutions:**
- Add docs/repo/ with operational guides (cron, systemd, projects, logs, docv, ia_dev, services, scripts, extension).
- Replace scattered README.md files with pointers to docs/repo/*.md.
- Refresh docs/README.md index and cross-links across docs/, .cursor rules/agents.
- Bump ia_dev submodule to matching doc pointer commits.
2026-04-03 18:20:31 +02:00

67 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 `cron/git-pull-project-clones.sh` parcourt `projects/<id>/` (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 |
|---------|------|
| `cron/config.env` | **Versionné** : `PULL_SYNC_ENABLED`, `PULL_SYNC_MODE` (`all` \| `project`), `PULL_SYNC_PROJECT_ID`, `PULL_SYNC_LOG` |
| `cron/config.local.env` | **Optionnel, non versionné** (`cron/config.local.env.example`) — surcharge machine |
Le script `cron/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`** — voir [logs-directory.md](./logs-directory.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`)
- `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`.
Détail des unités : [systemd-units.md](./systemd-units.md).
## 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 `cron/fragments/*.cron`
Fichiers **commentés** servant de rappel ; la configuration **centralisée** reste dans `cron/config.env`. En **systemd utilisateur** (recommandé) : `scripts/install-git-pull-systemd-user.sh`.
## Hooks AnythingLLM
Un **`post-merge`** sur un clone peut sexécuter après un `merge --ff-only` : voir `scripts/anythingllm-pull-sync/` et [script-anythingllm-pull-sync.md](./script-anythingllm-pull-sync.md).