Initial commit: InfoUser Monitor with FastAPI, agent, Docker, JWT auth, notifications, filters and CSV export

This commit is contained in:
2026-07-16 11:53:51 +07:00
commit cf2727da2b
31 changed files with 1957 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -e
INSTALL_DIR="/opt/info-user-agent"
SERVICE_NAME="info-user-agent"
if [ "$EUID" -ne 0 ]; then
echo "Пожалуйста, запустите от root (sudo)"
exit 1
fi
mkdir -p "$INSTALL_DIR"
cp agent.py requirements.txt config.json "$INSTALL_DIR/"
python3 -m pip install -r "$INSTALL_DIR/requirements.txt" -q
cat > /etc/systemd/system/$SERVICE_NAME.service <<EOF
[Unit]
Description=InfoUser Agent
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/python3 $INSTALL_DIR/agent.py
User=root
[Install]
WantedBy=multi-user.target
EOF
cat > /etc/systemd/system/$SERVICE_NAME.timer <<EOF
[Unit]
Description=InfoUser Agent Timer
[Timer]
OnCalendar=*:00/60
Persistent=true
[Install]
WantedBy=timers.target
EOF
systemctl daemon-reload
systemctl enable $SERVICE_NAME.timer
systemctl start $SERVICE_NAME.timer
echo "Агент установлен. Статус таймера:"
systemctl status $SERVICE_NAME.timer --no-pager