chore: actualizar path CMake a nueva ubicacion del dashboard + start.sh
cpp/CMakeLists.txt ahora referencia projects/fn_monitoring/apps/ en vez de apps/. Se añade start.sh para lanzar sqlite_api en background con health check automatico. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -99,7 +99,8 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/apps/chart_demo/CMakeLists.txt)
|
|||||||
add_subdirectory(apps/chart_demo)
|
add_subdirectory(apps/chart_demo)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# --- Registry Dashboard (lives in apps/ per project convention) ---
|
# --- Registry Dashboard (lives in projects/fn_monitoring/apps/) ---
|
||||||
if(EXISTS ${CMAKE_SOURCE_DIR}/../apps/registry_dashboard/CMakeLists.txt)
|
set(_DASH_DIR ${CMAKE_SOURCE_DIR}/../projects/fn_monitoring/apps/registry_dashboard)
|
||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/../apps/registry_dashboard ${CMAKE_BINARY_DIR}/apps/registry_dashboard)
|
if(EXISTS ${_DASH_DIR}/CMakeLists.txt)
|
||||||
|
add_subdirectory(${_DASH_DIR} ${CMAKE_BINARY_DIR}/apps/registry_dashboard)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Start sqlite_api in the background. Logs to sqlite_api.log.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
REGISTRY_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
|
||||||
|
LOG="$SCRIPT_DIR/sqlite_api.log"
|
||||||
|
PID_FILE="$SCRIPT_DIR/sqlite_api.pid"
|
||||||
|
|
||||||
|
# Kill previous instance if running
|
||||||
|
if [ -f "$PID_FILE" ]; then
|
||||||
|
old_pid=$(cat "$PID_FILE")
|
||||||
|
if kill -0 "$old_pid" 2>/dev/null; then
|
||||||
|
echo "Stopping previous instance (PID $old_pid)"
|
||||||
|
kill "$old_pid"
|
||||||
|
sleep 0.5
|
||||||
|
fi
|
||||||
|
rm -f "$PID_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export FN_REGISTRY_ROOT="$REGISTRY_ROOT"
|
||||||
|
|
||||||
|
cd "$REGISTRY_ROOT"
|
||||||
|
CGO_ENABLED=1 go run -tags fts5 ./projects/fn_monitoring/apps/sqlite_api/ "$@" \
|
||||||
|
>"$LOG" 2>&1 &
|
||||||
|
|
||||||
|
echo $! > "$PID_FILE"
|
||||||
|
echo "sqlite_api started (PID $!, log: $LOG)"
|
||||||
|
sleep 0.5
|
||||||
|
if curl -sf http://127.0.0.1:8484/health >/dev/null 2>&1; then
|
||||||
|
echo "Health check OK"
|
||||||
|
else
|
||||||
|
echo "Waiting for startup..."
|
||||||
|
sleep 1.5
|
||||||
|
if curl -sf http://127.0.0.1:8484/health >/dev/null 2>&1; then
|
||||||
|
echo "Health check OK"
|
||||||
|
else
|
||||||
|
echo "Warning: health check failed — check $LOG"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user