chore: закоммичены все рабочие файлы smeta-web
Предотвращение потери данных при деплое: batch_v3, search_engine, xlsx_utils, тесты, скрипты деплоя, архитектура, security page, admin page. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Auto-deploy script for smeta-web
|
||||
# Called by Gitea webhook or manually: bash scripts/deploy.sh
|
||||
|
||||
set -e
|
||||
cd /home/mcp-user/smeta-web
|
||||
|
||||
echo "[$(date)] Deploy started"
|
||||
|
||||
# Pull latest
|
||||
git pull origin main 2>&1 || true
|
||||
|
||||
# Install deps if changed
|
||||
pip3 install -q -r requirements.txt 2>&1 || true
|
||||
|
||||
# Restart service
|
||||
sudo systemctl restart smeta-web
|
||||
sleep 3
|
||||
|
||||
# Verify service is running
|
||||
if systemctl is-active --quiet smeta-web; then
|
||||
echo "[$(date)] Service active"
|
||||
else
|
||||
echo "[$(date)] ERROR: Service not active!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Quick smoke test (5 questions)
|
||||
export $(grep SESSION_SECRET .env)
|
||||
RESULT=$(python3 tests/test_chat_quality.py --quick 2>&1 | grep "Passed:")
|
||||
echo "[$(date)] Test: $RESULT"
|
||||
|
||||
echo "[$(date)] Deploy complete"
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
# Quarterly data update: ФССЦ prices, ФСНБ supplements, RAG rebuild
|
||||
# Cron: 0 6 1 */3 * bash /home/mcp-user/smeta-web/scripts/update_data.sh >> /tmp/data_update.log 2>&1
|
||||
|
||||
set -e
|
||||
cd /home/mcp-user/smeta-railway
|
||||
export PYTHONPATH=src
|
||||
|
||||
echo "[$(date)] === Data update started ==="
|
||||
|
||||
# 1. Update ФССЦ-2022 prices from ФГИС ЦС (all 86 regions)
|
||||
echo "[$(date)] Updating ФССЦ-2022..."
|
||||
python3 scripts/fetch_fssc_all_regions.py &
|
||||
FSSC_PID=$!
|
||||
|
||||
# 2. Try to fetch new ГЭСН norms (if API balance available)
|
||||
echo "[$(date)] Checking ГЭСН API..."
|
||||
python3 scripts/fetch_gesn_daily.py
|
||||
|
||||
# 3. Wait for ФССЦ to finish
|
||||
wait $FSSC_PID
|
||||
echo "[$(date)] ФССЦ-2022 update complete"
|
||||
python3 scripts/fetch_fssc_all_regions.py --status
|
||||
|
||||
# 4. Rebuild RAG index
|
||||
echo "[$(date)] Rebuilding RAG index..."
|
||||
PYTHONPATH=src python3 -c "from smeta_railway.cli import app; app()" build-rag
|
||||
|
||||
# 5. Verify knowledge base
|
||||
echo "[$(date)] Verifying..."
|
||||
PYTHONPATH=src python3 scripts/verify_knowledge_base.py
|
||||
|
||||
# 6. Quick chat test
|
||||
cd /home/mcp-user/smeta-web
|
||||
sudo systemctl restart smeta-web
|
||||
sleep 5
|
||||
export $(grep SESSION_SECRET .env)
|
||||
python3 tests/test_chat_quality.py --quick
|
||||
|
||||
echo "[$(date)] === Data update complete ==="
|
||||
Reference in New Issue
Block a user