Files

39 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Install unified single-machine systemd services for ZenAI APC Ngoro
set -euo pipefail
INSTALL_DIR="${INSTALL_DIR:-/home/admin123/ngoro_project}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ ! -f "$INSTALL_DIR/.env" ]; then
echo "WARNING: $INSTALL_DIR/.env not found."
echo "Copy config.env.example to .env and configure before starting services:"
echo " cp $INSTALL_DIR/config.env.example $INSTALL_DIR/.env"
fi
mkdir -p "$INSTALL_DIR/batch_videos" "$INSTALL_DIR/recount_output"
# Copy all unit files
sudo cp "$SCRIPT_DIR/systemd/apc-ngoro-service.service" /etc/systemd/system/
sudo cp "$SCRIPT_DIR/systemd/apc-ngoro-counter.service" /etc/systemd/system/
sudo cp "$SCRIPT_DIR/systemd/apc-ngoro-recount.service" /etc/systemd/system/
sudo cp "$SCRIPT_DIR/systemd/apc-ngoro-dashboard.service" /etc/systemd/system/
sudo systemctl daemon-reload
# Enable and start the unified master service
sudo systemctl enable apc-ngoro-service
sudo systemctl restart apc-ngoro-service
echo "================================================================="
echo "ZenAI APC Ngoro unified service installed and started!"
echo ""
echo "Management commands:"
echo " sudo systemctl restart apc-ngoro-service"
echo " sudo systemctl status apc-ngoro-service"
echo " sudo journalctl -u apc-ngoro-service -f"
echo ""
echo "Dashboard running at: http://127.0.0.1:5000"
echo "Recount API at: http://127.0.0.1:8765"
echo "================================================================="