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
This commit is contained in:
Nicolas Cantu 2026-04-06 13:14:27 +02:00
parent ca03324838
commit a16f1261e9
6 changed files with 131 additions and 1 deletions

View File

@ -1 +1 @@
0.0.8
0.0.9

View File

@ -62,6 +62,40 @@ 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).

View File

@ -0,0 +1,44 @@
#!/usr/bin/env bash
# Installe les unités systemd *utilisateur* pour :
# - ia-dev-gateway
# - smart-ide-tools-bridge
# - smart-ide-orchestrator
#
# Prérequis :
# - config/services.local.env (copie de config/services.local.env.example), gitignoré
# - builds npm (tsc) des services concernés
#
# Usage :
# ./scripts/install-smart-ide-core-services-systemd-user.sh
# Puis :
# systemctl --user start ia-dev-gateway smart-ide-tools-bridge smart-ide-orchestrator
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
UNIT_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"
IA_IN="${ROOT}/systemd/user/ia-dev-gateway.service.in"
TOOLS_IN="${ROOT}/systemd/user/smart-ide-tools-bridge.service.in"
ORCH_IN="${ROOT}/systemd/user/smart-ide-orchestrator.service.in"
IA_OUT="${UNIT_DIR}/ia-dev-gateway.service"
TOOLS_OUT="${UNIT_DIR}/smart-ide-tools-bridge.service"
ORCH_OUT="${UNIT_DIR}/smart-ide-orchestrator.service"
mkdir -p "$UNIT_DIR"
sed "s|@SMART_IDE_ROOT@|$ROOT|g" "$IA_IN" >"$IA_OUT"
sed "s|@SMART_IDE_ROOT@|$ROOT|g" "$TOOLS_IN" >"$TOOLS_OUT"
sed "s|@SMART_IDE_ROOT@|$ROOT|g" "$ORCH_IN" >"$ORCH_OUT"
chmod 0644 "$IA_OUT" "$TOOLS_OUT" "$ORCH_OUT"
systemctl --user daemon-reload
systemctl --user enable ia-dev-gateway.service
systemctl --user enable smart-ide-tools-bridge.service
systemctl --user enable smart-ide-orchestrator.service
echo "Unités : $IA_OUT"
echo " $TOOLS_OUT"
echo " $ORCH_OUT"
echo "Démarrage : systemctl --user start ia-dev-gateway smart-ide-tools-bridge smart-ide-orchestrator"
echo "État : systemctl --user status ia-dev-gateway smart-ide-tools-bridge smart-ide-orchestrator"

View File

@ -0,0 +1,16 @@
[Unit]
Description=smart_ide — ia-dev-gateway (agents, runs, SSE)
Documentation=file://@SMART_IDE_ROOT@/docs/repo/service-ia-dev-gateway.md
After=network-online.target
[Service]
Type=simple
WorkingDirectory=@SMART_IDE_ROOT@/services/ia-dev-gateway
EnvironmentFile=-@SMART_IDE_ROOT@/config/services.local.env
ExecStart=/usr/bin/node @SMART_IDE_ROOT@/services/ia-dev-gateway/dist/server.js
Restart=on-failure
RestartSec=3
[Install]
WantedBy=default.target

View File

@ -0,0 +1,20 @@
[Unit]
Description=smart_ide — orchestrator (intent router)
Documentation=file://@SMART_IDE_ROOT@/docs/repo/service-smart-ide-orchestrator.md
After=network-online.target
After=ia-dev-gateway.service
After=smart-ide-tools-bridge.service
Wants=ia-dev-gateway.service
Wants=smart-ide-tools-bridge.service
[Service]
Type=simple
WorkingDirectory=@SMART_IDE_ROOT@/services/smart-ide-orchestrator
EnvironmentFile=-@SMART_IDE_ROOT@/config/services.local.env
ExecStart=/usr/bin/node @SMART_IDE_ROOT@/services/smart-ide-orchestrator/dist/server.js
Restart=on-failure
RestartSec=3
[Install]
WantedBy=default.target

View File

@ -0,0 +1,16 @@
[Unit]
Description=smart_ide — tools-bridge (registry + tool jobs)
Documentation=file://@SMART_IDE_ROOT@/docs/repo/service-smart-ide-tools-bridge.md
After=network-online.target
[Service]
Type=simple
WorkingDirectory=@SMART_IDE_ROOT@/services/smart-ide-tools-bridge
EnvironmentFile=-@SMART_IDE_ROOT@/config/services.local.env
ExecStart=/usr/bin/node @SMART_IDE_ROOT@/services/smart-ide-tools-bridge/dist/server.js
Restart=on-failure
RestartSec=3
[Install]
WantedBy=default.target