smart_ide/scripts/install-smart-ide-core-services-systemd-user.sh
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

45 lines
1.6 KiB
Bash
Executable File

#!/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"