smart_ide/docs/repo/systemd-units.md
Nicolas Cantu 940cf59178 Share upstream definitions in @4nk/smart-ide-upstreams, systemd user units
- Add packages/smart-ide-upstreams (versioned dist) for resolveUpstream + listUpstreamKeys
- Wire smart-ide-global-api and smart-ide-sso-gateway via file: dependency
- Add systemd user unit templates and install-smart-ide-gateway-systemd-user.sh (SSO After/Requires global API)
- Update docs and VERSION 0.0.3
2026-04-04 15:37:58 +02:00

68 lines
2.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
```
## 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).