Extract 4 self-contained services into services/ module: - server/telegram_bot/ -> services/telegram_bot/ - server/ws_gateway/ -> services/ws_gateway/ - server/corporate_memory/ -> services/corporate_memory/ - server/session_collector.py -> services/session_collector/ Each service now has its own systemd/ directory with .service and .timer files. deploy.sh updated to auto-discover service units from services/*/systemd/*. server/ now contains only deployment infrastructure (deploy.sh, setup scripts, bin/ management tools, sudoers, nginx config). All imports updated: webapp/app.py, server/bin/ scripts, systemd ExecStart paths.
31 lines
637 B
Bash
31 lines
637 B
Bash
#!/bin/bash
|
|
# Wrapper script for the corporate memory knowledge collector
|
|
# This script is called by systemd timer every 30 minutes
|
|
|
|
set -euo pipefail
|
|
|
|
APP_DIR="/opt/data-analyst"
|
|
REPO_DIR="${APP_DIR}/repo"
|
|
VENV_PYTHON="${APP_DIR}/.venv/bin/python"
|
|
LOG_DIR="/data/corporate-memory"
|
|
|
|
# Ensure log directory exists
|
|
mkdir -p "$LOG_DIR"
|
|
|
|
cd "$REPO_DIR"
|
|
|
|
# Load environment variables
|
|
if [[ -f "${APP_DIR}/.env" ]]; then
|
|
set -a
|
|
source "${APP_DIR}/.env"
|
|
set +a
|
|
fi
|
|
|
|
if [[ -f "${REPO_DIR}/.env" ]]; then
|
|
set -a
|
|
source "${REPO_DIR}/.env"
|
|
set +a
|
|
fi
|
|
|
|
# Run the collector
|
|
exec "$VENV_PYTHON" -m services.corporate_memory "$@"
|