From ca5bdf23808d0a8c557d19095451d21a0ec74786 Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Wed, 20 May 2026 17:16:15 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Auto-deploy:=20BrainSteel=20Fin?= =?UTF-8?q?=20atualizado=20em=2020/05/2026=2017:16:15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/script.js | 34 ++++++++++++++++++++++++++++++++++ update.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100755 update.sh diff --git a/static/script.js b/static/script.js index fa983ad..97c6f1f 100644 --- a/static/script.js +++ b/static/script.js @@ -22,6 +22,8 @@ document.addEventListener('DOMContentLoaded', () => { loadTokenChart(); loadConfig(); loadMultiStratChart('live'); + loadPortfolio(); + loadActivityLog(); updateStatus('Sistema operacional', 'online'); }); @@ -373,6 +375,37 @@ function addLog(agent, message) { while (container.children.length > 50) container.removeChild(container.lastChild); } +function loadActivityLog() { + fetch('/api/history') + .then(r => r.json()) + .then(data => { + const container = document.getElementById('logContainer'); + if (!container) return; + if (data.length === 0) { + container.innerHTML = ` +
+ --:-- + SYS + Nenhum log gravado ainda. Os agentes precisam rodar. +
`; + return; + } + container.innerHTML = data.map(log => { + const ts = log.timestamp ? log.timestamp.slice(11, 19) : '--:--'; + const agent = (log.agent || 'SYS').toUpperCase(); + const cls = log.status === 'success' ? 'success' : log.status === 'error' ? 'error' : ''; + const agentColor = AGENT_COLORS[log.agent?.toLowerCase()] || 'var(--accent-blue)'; + return ` +
+ ${ts} + ${agent} + ${log.action}: ${log.result || ''} +
`; + }).join(''); + }) + .catch(err => console.error('Error loading activity log:', err)); +} + // Refresh all sections periodically setInterval(() => { loadAgentRegistry(); @@ -380,6 +413,7 @@ setInterval(() => { loadServices(); loadPipelineVisual(); loadPortfolio(); + loadActivityLog(); }, 15000); // ── Portfolio ─────────────────────────────────────────────────────────────── diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..ee3b84f --- /dev/null +++ b/update.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# --------------------------------------------------------- +# BRAINSTEEL FIN: SCRIPT DE DEPLOY TOTAL & SINCRONIZAÇÃO AUTOMÁTICA +# --------------------------------------------------------- + +CYAN='\033[0;36m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' + +echo -e "\n${CYAN}🚀 Iniciando Ciclo Automático de Deploy BrainSteel Fin...${NC}" + +# 1. Sincronização com Repositório (Git - Gitea) +echo -e "${YELLOW}📝 Sincronizando código com o Gitea...${NC}" +git add . + +if git diff-index --quiet HEAD --; then + echo -e "${GREEN}✨ Código local já está sincronizado com o último commit.${NC}" +else + TIMESTAMP=$(date +"%d/%m/%Y %H:%M:%S") + echo -e "${CYAN}📤 Enviando alterações (Auto-update $TIMESTAMP)...${NC}" + git commit -m "🚀 Auto-deploy: BrainSteel Fin atualizado em $TIMESTAMP" + git push origin main +fi + +# 2. Gatilho de Deploy no Coolify (API Oficial v1) +COOLIFY_RESOURCE_UUID="ldirzpst39xk99ikf9cjw1qr" +echo -e "${YELLOW}🔄 Disparando Deploy via API Oficial no Coolify...${NC}" +COOLIFY_TOKEN="12|wbepNILQe24LAOjfEUmMROgU93F6uG1zuwPLwrRi786bca03" + +curl -s -X GET "https://painel.reifonas.cloud/api/v1/deploy?uuid=${COOLIFY_RESOURCE_UUID}&force=false" \ + -H "Authorization: Bearer $COOLIFY_TOKEN" + +echo -e "\n${GREEN}✅ Deploy oficial via API engatilhado (Hash Sincronizado).${NC}" +echo -e "${GREEN}🏁 Ciclo concluído com sucesso.${NC}\n"