3 Commits
Author SHA1 Message Date
CodexandClaude Haiku 5.5 9e8ffe2dc5 fix: restart long-running local ThothII services after Docker or host restart
Set restart: unless-stopped on catalog-db, embedding, core, frontend and qdrant
in the local overlay, so the stack comes back after a Docker Desktop or Mac
restart unless it was stopped explicitly. One-shot services and
workspace-maintenance keep restart: "no".

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-17 19:10:26 +02:00
CodexandClaude Haiku 5.5 6578578acb fix: delegate run-stack.sh to the supported tht start path
The direct Compose path did not render model projections or PSD secrets, so
embedding-model-init failed on every run. run-stack.sh now execs
scripts/thothii-local.sh start, which uses tht start.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-17 18:31:48 +02:00
CodexandClaude Haiku 5.5 b17d41802d feat: add local start/stop/status script for ThothII via tht
Wraps tht start/stop/status for the PSD installation. Before starting it
stops other thothii-* Compose projects (stop only, volumes kept) and fails
early if the published ports 8080, 8787 or 6333 are held by a non-Docker
process. It warns, without stopping them, when PeopleKitchens containers run.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-17 18:22:19 +02:00
3 changed files with 89 additions and 33 deletions
+11 -3
View File
@@ -1,16 +1,24 @@
services:
# Long-running local services restart after a Docker or Mac restart, unless stopped with stop.
# One-shot services (embedding-model-init, catalog-migrate) and workspace-maintenance keep "no".
catalog-db:
restart: unless-stopped
embedding:
restart: unless-stopped
core:
environment:
NODE_ENV: development
THT_WORKSPACE_INSTALLATION_ID: ${THT_WORKSPACE_INSTALLATION_ID:-local}
ports:
- "127.0.0.1:${THOTH_CORE_HTTP_PORT:-8787}:8787"
restart: "no"
restart: unless-stopped
frontend:
ports:
- "127.0.0.1:${THOTH_HTTP_PORT:-8080}:8080"
restart: "no"
restart: unless-stopped
workspace-maintenance:
environment:
@@ -22,4 +30,4 @@ services:
qdrant:
ports:
- "127.0.0.1:6333:6333"
restart: "no"
restart: unless-stopped
+5 -30
View File
@@ -1,36 +1,11 @@
#!/usr/bin/env bash
# run-stack.sh — avvia lo stack Compose locale di ThothII in primo piano.
# run-stack.sh — avvia lo stack locale di ThothII (installazione PSD) tramite tht.
#
# Il core include Pi; DWH e LLM restano endpoint esterni configurati in deploy/env/local.env.
# Qdrant e Ollama embedding sono servizi Compose privati. Non richiede un eseguibile Pi sull'host.
#
# Preparazione: cp deploy/env/local.env.example deploy/env/local.env e compilare i valori.
# Uso: ./scripts/run-stack.sh [argomenti aggiuntivi per docker compose up]
# Il percorso Compose diretto non genera le proiezioni dei modelli né i secret dell'installazione,
# quindi non può avviare lo stack. Questo script delega al percorso supportato: scripts/thothii-local.sh.
# Uso: ./scripts/run-stack.sh [--build]
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
LOCAL_ENV_FILE="${THT_LOCAL_ENV_FILE:-$ROOT/deploy/env/local.env}"
[[ -f "$LOCAL_ENV_FILE" ]] || {
echo "ERRORE: $LOCAL_ENV_FILE mancante. Copia deploy/env/local.env.example e configura gli endpoint." >&2
exit 1
}
compose_files=(-f "$ROOT/compose.yaml" -f "$ROOT/deploy/compose.local.yaml")
if [[ "${THOTH_ENABLE_EMBEDDING_GPU:-0}" == "1" ]]; then
compose_files+=(-f "$ROOT/deploy/compose.embedding-gpu.yaml")
fi
if [[ "${THOTH_ENABLE_SENSITIVITY_NER:-0}" == "1" ]]; then
compose_files+=(-f "$ROOT/deploy/compose.sensitivity-ner.yaml")
fi
compose=(docker compose --env-file "$LOCAL_ENV_FILE" "${compose_files[@]}")
# Migrations are an explicit one-shot operation, never hidden in backend startup. The local
# launcher runs that operation before bringing the foreground stack up so a fresh checkout is
# immediately usable while production operators can invoke the same service during rollout.
"${compose[@]}" build core
"${compose[@]}" up -d catalog-db
"${compose[@]}" run --rm catalog-migrate
exec "${compose[@]}" up --build "$@"
exec "$ROOT/scripts/thothii-local.sh" start "$@"
+73
View File
@@ -0,0 +1,73 @@
#!/usr/bin/env bash
# thothii-local.sh — avvia, ferma e controlla lo stack locale ThothII tramite tht.
#
# Prima di avviare ferma gli altri progetti Compose thothii-* in esecuzione (solo stop: container
# e volumi restano) e verifica che le porte pubblicate siano libere. PeopleKitchens non viene
# toccato: lo script segnala solo che è attivo.
# Uso: ./scripts/thothii-local.sh start [--build] | stop | status
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
INSTALLATION="$ROOT/deploy/psd/thothii-installation.yaml"
PORTS=(8080 8787 6333)
tht_cmd() {
tht --installation "$INSTALLATION" "$@"
}
running_thothii_projects() {
docker ps --filter 'label=com.docker.compose.project' \
--format '{{.Label "com.docker.compose.project"}}' | sort -u | grep '^thothii' || true
}
warn_peoplekitchens() {
if docker ps --format '{{.Names}}' | grep -q '^peoplekitchens'; then
echo "ATTENZIONE: container PeopleKitchens attivi (consumo memoria, non fermati da questo script)." >&2
fi
}
stop_other_thothii_projects() {
local project
while read -r project; do
[[ -n "$project" ]] || continue
echo "Fermo il progetto Compose $project (container e volumi conservati)"
docker compose -p "$project" stop
done < <(running_thothii_projects)
}
check_ports_free() {
local port busy=0
for port in "${PORTS[@]}"; do
if lsof -nP -iTCP:"$port" -sTCP:LISTEN >/dev/null 2>&1; then
echo "ERRORE: porta $port occupata da:" >&2
lsof -nP -iTCP:"$port" -sTCP:LISTEN >&2 || true
busy=1
fi
done
return "$busy"
}
case "${1:-}" in
start)
shift
warn_peoplekitchens
tht_cmd stop >/dev/null 2>&1 || true
stop_other_thothii_projects
check_ports_free
tht_cmd start "$@"
;;
stop)
tht_cmd stop
stop_other_thothii_projects
;;
status)
tht_cmd status
echo "--- progetti thothii in esecuzione:"
running_thothii_projects
warn_peoplekitchens
;;
*)
echo "Uso: $0 start [--build] | stop | status" >&2
exit 2
;;
esac