smart_ide/docs/repo/systemd-units.md
Nicolas Cantu a16f1261e9 chore: add systemd units for Smart IDE core services
**Motivations:**
- Manage ia-dev-gateway, tools-bridge and orchestrator as user services.
- Provide a repeatable install path aligned with existing systemd patterns.

**Root causes:**
- N/A

**Correctifs:**
- N/A

**Evolutions:**
- Add systemd user unit templates for ia-dev-gateway, smart-ide-tools-bridge and smart-ide-orchestrator.
- Add an install script and document it in docs/repo/systemd-units.md.

**Pages affectées:**
- N/A
2026-04-06 13:14:27 +02:00

102 lines
3.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

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.

# Unités systemd (smart_ide)
## Ollama
Installé par l[installateur officiel Ollama Linux](https://ollama.com/download/linux). Unité : `ollama.service`.
Exposer lAPI à Docker sur le même hôte (AnythingLLM) avec un drop-in :
```ini
# /etc/systemd/system/ollama.service.d/override.conf
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
```
Puis : `sudo systemctl daemon-reload && sudo systemctl restart ollama`
Script daide dans le dépôt : `setup/configure-ollama-for-docker.sh` (écrit ce drop-in).
## AnythingLLM
- `anythingllm.service` — image Docker officielle au premier plan sous systemd (`Type=simple`).
- Défauts : `/etc/default/anythingllm` (copier depuis `systemd/anythingllm.default` si absent).
- Helper : `/usr/local/sbin/anythingllm-docker-exec.sh` (installé depuis `scripts/anythingllm-docker-exec.sh`).
Installation / rafraîchissement :
```bash
sudo ./scripts/install-systemd-services.sh
```
Commandes :
```bash
sudo systemctl status anythingllm
sudo systemctl restart anythingllm
journalctl -u anythingllm -f
```
Nécessite `docker.service`, utilisateur autorisé à utiliser Docker, et chemins dans `/etc/default/anythingllm` si stockage non standard.
## Git pull des clones projet (utilisateur, pas root)
Tirage **périodique** des dépôts listés dans `projects/*/conf.json` (voir [cron-git-pull.md](./cron-git-pull.md)) :
- Unités : `systemd/user/git-pull-project-clones.service.in` + `systemd/user/git-pull-project-clones.timer`
- Installation : `scripts/install-git-pull-systemd-user.sh` (écrit dans `~/.config/systemd/user/`, **sans** `sudo`)
- Configuration : `cron/config.env`
## smart-ide-global-api et smart-ide-sso-gateway (utilisateur)
Unités **user** pour lagrégateur HTTP interne puis la passerelle OIDC. Lunité SSO déclare **`Requires=smart-ide-global-api.service`** et **`After=smart-ide-global-api.service`** pour garantir lordre de démarrage.
- Gabarits : `systemd/user/smart-ide-global-api.service.in`, `systemd/user/smart-ide-sso-gateway.service.in`
- Variables : `config/services.local.env` (copie de `config/services.local.env.example`, gitignoré) — `GLOBAL_API_INTERNAL_TOKEN`, `OIDC_ISSUER`, jetons micro-services, etc.
- Prérequis : `npm ci && npm run build` dans `packages/smart-ide-upstreams`, `services/smart-ide-global-api`, `services/smart-ide-sso-gateway`
Installation :
```bash
./scripts/install-smart-ide-gateway-systemd-user.sh
systemctl --user start smart-ide-global-api smart-ide-sso-gateway
systemctl --user status smart-ide-global-api smart-ide-sso-gateway
```
## ia-dev-gateway, smart-ide-tools-bridge, smart-ide-orchestrator (utilisateur)
Unités **user** pour :
- `ia-dev-gateway` (catalogue agents, runs, SSE)
- `smart-ide-tools-bridge` (registry + jobs Carbonyl/PageIndex/Chandra)
- `smart-ide-orchestrator` (routage dintentions)
Gabarits :
- `systemd/user/ia-dev-gateway.service.in`
- `systemd/user/smart-ide-tools-bridge.service.in`
- `systemd/user/smart-ide-orchestrator.service.in`
Variables : `config/services.local.env` (copie de `config/services.local.env.example`, gitignoré) :
- `IA_DEV_GATEWAY_TOKEN`
- `TOOLS_BRIDGE_TOKEN`
- `ORCHESTRATOR_TOKEN`
Prérequis : `npm ci && npm run build` dans :
- `services/ia-dev-gateway`
- `services/smart-ide-tools-bridge`
- `services/smart-ide-orchestrator`
Installation :
```bash
./scripts/install-smart-ide-core-services-systemd-user.sh
systemctl --user start ia-dev-gateway smart-ide-tools-bridge smart-ide-orchestrator
systemctl --user status ia-dev-gateway smart-ide-tools-bridge smart-ide-orchestrator
```
## Linger (session fermée)
Les timers **user** ne tournent en général que lorsquune session utilisateur systemd est active. Pour exécuter les timers après déconnexion graphique complète, activer le **linger** pour lutilisateur : `loginctl enable-linger <user>` (décision dadministration machine).