Consolidate Maria control into the shared Discord-bridge dashboard
Drop the standalone maria-dashboard.service — one common panel now controls both bridges, at the operator's request. discord-bridge's dashboard/api.py gains a Maria section (fixed-unit start/stop/restart for maria-whatsapp/maria-rag, WhatsApp status+QR proxy, document CRUD, reindex, Drive sync trigger, log tail) reached via subprocess/HTTP — no cross-module imports, to avoid colliding with discord-bridge's own `config` module name. index.html gets a matching "Maria — WhatsApp + RAG" section. maria-whatsapp-bridge loses its dashboard/ folder and DASHBOARD_* env keys; install.sh/README point at the shared panel. Co-Authored-By: Claude Agent <noreply@anthropic.com>
This commit is contained in:
@@ -32,11 +32,8 @@ POLL_INTERVAL_S=2
|
||||
# headless).
|
||||
DRIVE_REMOTE=
|
||||
|
||||
# --- dashboard de control (dashboard/api.py) --------------------------------
|
||||
# Token de acces. Generat automat de ops/install.sh daca lipseste.
|
||||
DASHBOARD_TOKEN=
|
||||
# `off` scoate complet login-ul. De pus DOAR daca panoul ramane strict pe
|
||||
# 127.0.0.1 / tailnet (acelasi motiv ca la discord-bridge).
|
||||
DASHBOARD_AUTH=
|
||||
DASHBOARD_BIND=127.0.0.1
|
||||
DASHBOARD_PORT=18792
|
||||
# --- control -----------------------------------------------------------------
|
||||
# Fara dashboard propriu: start/stop/restart, documente, reindexare si
|
||||
# sincronizare Drive se fac din dashboard-ul puntii Discord (discord-bridge/),
|
||||
# sectiunea "Maria — WhatsApp + RAG" — un singur panou comun, o singura
|
||||
# autentificare (DASHBOARD_TOKEN din ~/.claude-discord/env).
|
||||
|
||||
@@ -7,13 +7,18 @@
|
||||
# ./ops/install.sh # instaleaza / actualizeaza, NU porneste serviciile
|
||||
# ./ops/install.sh --start # in plus porneste bridge+rag (bridge cere QR scanat)
|
||||
#
|
||||
# Controlul (start/stop/restart, documente, reindexare, sincronizare Drive) se
|
||||
# face din dashboard-ul PUNTII DISCORD (discord-bridge/dashboard/), sectiunea
|
||||
# "Maria — WhatsApp + RAG" — decizie deliberata: un singur panou comun, nu un
|
||||
# dashboard separat per serviciu. Vezi discord-bridge/README.md.
|
||||
#
|
||||
# Ce face:
|
||||
# 1. ~/.maria-bridge/ cu 0700, subdirectoare (logs/, documents/, whatsapp-auth/)
|
||||
# 2. env 0600 din ops/env.example (doar daca lipseste)
|
||||
# 3. npm install pentru whatsapp/ (Baileys)
|
||||
# 4. venv + pip install pentru rag/requirements.txt
|
||||
# 5. loginctl enable-linger (serviciile de utilizator supravietuiesc logout-ului)
|
||||
# 6. symlink-uri unit -> ~/.config/systemd/user/ (bridge, rag, dashboard, timer sync)
|
||||
# 6. symlink-uri unit -> ~/.config/systemd/user/ (bridge, rag, timer sync)
|
||||
# 7. systemd-analyze verify + enable
|
||||
set -uo pipefail
|
||||
|
||||
@@ -22,7 +27,6 @@ SRC="$(dirname "$HERE")" # .../maria-whatsapp-bridge
|
||||
STATE_DIR="$HOME/.maria-bridge"
|
||||
UNIT_DIR="$HOME/.config/systemd/user"
|
||||
UNITS=(maria-whatsapp.service maria-rag.service maria-sync.service maria-sync.timer)
|
||||
DASH_UNIT="maria-dashboard.service"
|
||||
DO_START=0
|
||||
[ "${1:-}" = "--start" ] && DO_START=1
|
||||
|
||||
@@ -96,16 +100,6 @@ for u in "${UNITS[@]}"; do
|
||||
ln -sfn "$HERE/$u" "$UNIT_DIR/$u"
|
||||
info "unit legat: $UNIT_DIR/$u -> $HERE/$u"
|
||||
done
|
||||
ln -sfn "$HERE/$DASH_UNIT" "$UNIT_DIR/$DASH_UNIT"
|
||||
info "unit legat: $UNIT_DIR/$DASH_UNIT -> $HERE/$DASH_UNIT"
|
||||
|
||||
if grep -qE '^DASHBOARD_TOKEN=.+' "$STATE_DIR/env" 2>/dev/null; then
|
||||
info "DASHBOARD_TOKEN exista deja in env"
|
||||
else
|
||||
printf 'DASHBOARD_TOKEN=%s\n' "$(python3 -c 'import secrets;print(secrets.token_urlsafe(24))')" \
|
||||
>> "$STATE_DIR/env"
|
||||
info "DASHBOARD_TOKEN generat si adaugat in $STATE_DIR/env"
|
||||
fi
|
||||
|
||||
systemctl --user daemon-reload 2>/dev/null || warn "daemon-reload a esuat (sesiune fara systemd de utilizator?)"
|
||||
|
||||
@@ -134,9 +128,6 @@ for u in maria-whatsapp.service maria-rag.service; do
|
||||
&& info "$u enabled (porneste la boot)" \
|
||||
|| warn "enable pentru $u a esuat"
|
||||
done
|
||||
systemctl --user enable --now "$DASH_UNIT" >/dev/null 2>&1 \
|
||||
&& info "dashboard enabled + pornit pe 127.0.0.1:$(grep -E '^DASHBOARD_PORT=' "$STATE_DIR/env" | cut -d= -f2- || echo 18792)" \
|
||||
|| warn "enable pentru $DASH_UNIT a esuat"
|
||||
systemctl --user enable --now maria-sync.timer >/dev/null 2>&1 \
|
||||
&& info "timer de sincronizare Drive activat (la fiecare 10 min)" \
|
||||
|| warn "enable pentru maria-sync.timer a esuat"
|
||||
@@ -144,8 +135,8 @@ systemctl --user enable --now maria-sync.timer >/dev/null 2>&1 \
|
||||
if [ "$DO_START" -eq 1 ]; then
|
||||
systemctl --user restart maria-whatsapp.service && info "punte WhatsApp pornita"
|
||||
echo
|
||||
echo " Deschide dashboard-ul (127.0.0.1:\$DASHBOARD_PORT, tunel SSH) si scaneaza"
|
||||
echo " codul QR din cardul 'Conectare WhatsApp' inainte sa pornesti maria-rag."
|
||||
echo " Deschide dashboard-ul puntii Discord (sectiunea 'Maria — WhatsApp + RAG')"
|
||||
echo " si scaneaza codul QR din cardul 'Conectare WhatsApp' inainte sa pornesti maria-rag."
|
||||
systemctl --user restart maria-rag.service && info "consumer RAG pornit"
|
||||
systemctl --user --no-pager status maria-whatsapp.service | sed 's/^/ /'
|
||||
else
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
# Unit systemd de UTILIZATOR pentru dashboard-ul de control al puntii Maria.
|
||||
#
|
||||
# Se instaleaza in ~/.config/systemd/user/maria-dashboard.service (vezi install.sh).
|
||||
# Unit SEPARAT de bridge/rag, ca o repornire a lor sa nu ia si panoul din care
|
||||
# ai apasat butonul (acelasi motiv ca la claude-discord-dashboard.service).
|
||||
#
|
||||
# systemctl --user daemon-reload
|
||||
# systemctl --user enable --now maria-dashboard
|
||||
# journalctl --user -u maria-dashboard -f
|
||||
|
||||
[Unit]
|
||||
Description=Dashboard de control pentru puntea WhatsApp+RAG a lui Maria (LXC 171)
|
||||
Documentation=file:///workspace/romfastsql/proxmox/lxc171-claude-agent/maria-whatsapp-bridge/README.md
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=%h/.maria-bridge
|
||||
EnvironmentFile=%h/.maria-bridge/env
|
||||
Environment=MARIA_BRIDGE_DIR=%h/.maria-bridge
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
|
||||
# Stdlib only, dar are nevoie sa dea `systemctl --user` — acelasi utilizator ca
|
||||
# bridge/rag, deci merge fara sudo.
|
||||
ExecStart=/usr/bin/python3 /workspace/romfastsql/proxmox/lxc171-claude-agent/maria-whatsapp-bridge/dashboard/api.py
|
||||
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
|
||||
MemoryHigh=192M
|
||||
MemoryMax=384M
|
||||
|
||||
StandardOutput=append:%h/.maria-bridge/logs/dashboard.log
|
||||
StandardError=append:%h/.maria-bridge/logs/dashboard.log
|
||||
SyslogIdentifier=maria-dashboard
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
Reference in New Issue
Block a user