Compare commits
17 commits
49d9b193b2
...
282892505a
| Author | SHA1 | Date | |
|---|---|---|---|
| 282892505a | |||
| 8ef5ec7d68 | |||
| 288274b6ae | |||
| 54538c1c27 | |||
| e2d5e4c029 | |||
| 66f54677bf | |||
| 63c2e17818 | |||
| f695cad94f | |||
| e7b5718469 | |||
| a01c229d71 | |||
| be19d9e06b | |||
| 60f2a87955 | |||
| 7d2b4fbab2 | |||
| 8619b1b09d | |||
| 647f3f1c6c | |||
| 41adbc2cca | |||
| c865017561 |
10 changed files with 137 additions and 2 deletions
29
README.md
29
README.md
|
|
@ -35,6 +35,35 @@ For comprehensive documentation, see **[docs.pragmatismo.com.br](https://docs.pr
|
||||||
- **Env file:** `botserver/.env`
|
- **Env file:** `botserver/.env`
|
||||||
- **Stack:** `botserver-stack/`
|
- **Stack:** `botserver-stack/`
|
||||||
- **UI Files:** `botui/ui/suite/`
|
- **UI Files:** `botui/ui/suite/`
|
||||||
|
- **Local Bot Data:** `/opt/gbo/data/` (place `.gbai` packages here)
|
||||||
|
|
||||||
|
### Local Bot Data Directory
|
||||||
|
|
||||||
|
Place local bot packages in `/opt/gbo/data/` for automatic loading and monitoring:
|
||||||
|
|
||||||
|
**Directory Structure:**
|
||||||
|
```
|
||||||
|
/opt/gbo/data/
|
||||||
|
└── mybot.gbai/
|
||||||
|
├── mybot.gbdialog/
|
||||||
|
│ ├── start.bas
|
||||||
|
│ └── main.bas
|
||||||
|
└── mybot.gbot/
|
||||||
|
└── config.csv
|
||||||
|
```
|
||||||
|
|
||||||
|
**Features:**
|
||||||
|
- **Auto-loading:** Bots automatically mounted on server startup
|
||||||
|
- **Auto-compilation:** `.bas` files compiled to `.ast` on change
|
||||||
|
- **Auto-creation:** New bots automatically added to database
|
||||||
|
- **Hot-reload:** Changes trigger immediate recompilation
|
||||||
|
- **Monitored by:** LocalFileMonitor and ConfigWatcher services
|
||||||
|
|
||||||
|
**Usage:**
|
||||||
|
1. Create bot directory structure in `/opt/gbo/data/`
|
||||||
|
2. Add `.bas` files to `<bot_name>.gbai/<bot_name>.gbdialog/`
|
||||||
|
3. Server automatically detects and loads the bot
|
||||||
|
4. Optional: Add `config.csv` for bot configuration
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 23c93cbb3d188438cffde6ae43d641a2f1ebdc0e
|
Subproject commit c264ad1294a4b62db9ad007c5675b66f48165a30
|
||||||
2
botui
2
botui
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4f654dd95daeb8e21c7977f6f4762fdac392b2d3
|
Subproject commit a8bff4e1a7ff8512e1e2eb5368981d4c0904f41f
|
||||||
7
console-i18n.json
Normal file
7
console-i18n.json
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Total messages: 36 (Errors: 0, Warnings: 4)
|
||||||
|
Returning 4 messages for level "warning"
|
||||||
|
|
||||||
|
[WARNING] [GBSecurity] NO TOKEN - request will be unauthenticated @ https://chat.pragmatismo.com.br/suite/js/security-bootstrap.js?v=20260207b:157
|
||||||
|
[WARNING] i18n: Missing translation key: chat-mention-title @ https://chat.pragmatismo.com.br/suite/js/i18n.js:129
|
||||||
|
[WARNING] i18n: Missing translation key: chat-mention-title @ https://chat.pragmatismo.com.br/suite/js/i18n.js:129
|
||||||
|
[WARNING] i18n: Missing translation key: chat-mention-title @ https://chat.pragmatismo.com.br/suite/js/i18n.js:129
|
||||||
2
prod-console-test.json
Normal file
2
prod-console-test.json
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
Total messages: 36 (Errors: 0, Warnings: 4)
|
||||||
|
Returning 0 messages for level "error"
|
||||||
2
prod-console.json
Normal file
2
prod-console.json
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
Total messages: 34 (Errors: 0, Warnings: 4)
|
||||||
|
Returning 0 messages for level "error"
|
||||||
5
prod-network.json
Normal file
5
prod-network.json
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
[GET] https://chat.pragmatismo.com.br/api/product => [200]
|
||||||
|
[GET] https://chat.pragmatismo.com.br/api/product => [200]
|
||||||
|
[GET] https://chat.pragmatismo.com.br/suite/chat/chat.html => [200]
|
||||||
|
[GET] https://chat.pragmatismo.com.br/api/bot/config?bot_name=default => [200]
|
||||||
|
[GET] https://chat.pragmatismo.com.br/api/auth?bot_name=default => [200]
|
||||||
59
restart.sh
Executable file
59
restart.sh
Executable file
|
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "🛑 Stopping existing processes..."
|
||||||
|
pkill -f "botserver --noconsole" || true
|
||||||
|
pkill -f botui || true
|
||||||
|
pkill -f rustc || true
|
||||||
|
# Note: PostgreSQL, Vault, and Valkey are managed by botserver bootstrap, don't kill them
|
||||||
|
|
||||||
|
echo "🧹 Cleaning logs..."
|
||||||
|
rm -f botserver.log botui.log
|
||||||
|
|
||||||
|
echo "🔨 Building botserver..."
|
||||||
|
cargo build -p botserver
|
||||||
|
|
||||||
|
echo "🔨 Building botui..."
|
||||||
|
cargo build -p botui
|
||||||
|
|
||||||
|
echo "🗄️ Starting PostgreSQL..."
|
||||||
|
./botserver-stack/bin/tables/bin/postgres -D botserver-stack/data/tables/pgdata -c config_file=botserver-stack/conf/postgresql.conf > botserver-stack/logs/tables/postgres.log 2>&1 &
|
||||||
|
echo " PostgreSQL PID: $!"
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo "🔑 Starting Valkey (cache)..."
|
||||||
|
./botserver-stack/bin/cache/valkey-server --daemonize no --dir botserver-stack/data/cache > /dev/null 2>&1 &
|
||||||
|
echo " Valkey started"
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo "🚀 Starting botserver..."
|
||||||
|
export VAULT_ADDR="https://localhost:8200"
|
||||||
|
export VAULT_TOKEN="hvs.JjKHlEzycO2jvKdhhlRAoODu"
|
||||||
|
export VAULT_CACERT="./botserver-stack/conf/system/certificates/ca/ca.crt"
|
||||||
|
export VAULT_CACHE_TTL="300"
|
||||||
|
RUST_LOG=info ./target/debug/botserver --noconsole > botserver.log 2>&1 &
|
||||||
|
BOTSERVER_PID=$!
|
||||||
|
|
||||||
|
echo "⏳ Waiting for Vault to start (unsealing in background)..."
|
||||||
|
(
|
||||||
|
sleep 8
|
||||||
|
echo "🔓 Unsealing Vault..."
|
||||||
|
UNSEAL_KEY=$(python3 -c "import json; print(json.load(open('botserver-stack/conf/vault/init.json'))['unseal_keys_b64'][0])" 2>/dev/null)
|
||||||
|
if [ -n "$UNSEAL_KEY" ]; then
|
||||||
|
curl -s --cacert botserver-stack/conf/system/certificates/ca/ca.crt \
|
||||||
|
-X POST \
|
||||||
|
-H "X-Vault-Token: hvs.JjKHlEzycO2jvKdhhlRAoODu" \
|
||||||
|
-d "{\"key\": \"$UNSEAL_KEY\"}" \
|
||||||
|
https://localhost:8200/v1/sys/unseal 2>/dev/null && echo "✅ Vault unsealed" || echo "⚠️ Unseal failed"
|
||||||
|
else
|
||||||
|
echo "⚠️ Could not extract unseal key"
|
||||||
|
fi
|
||||||
|
) &
|
||||||
|
|
||||||
|
echo "🚀 Starting botui..."
|
||||||
|
BOTSERVER_URL="http://localhost:8080" ./target/debug/botui > botui.log 2>&1 &
|
||||||
|
BOTUI_PID=$!
|
||||||
|
|
||||||
|
echo "✅ Started botserver (PID: $BOTSERVER_PID) and botui (PID: $BOTUI_PID)"
|
||||||
|
echo "📊 Monitor with: tail -f botserver.log botui.log"
|
||||||
|
echo "🌐 Access at: http://localhost:3000"
|
||||||
26
start-and-unseal.sh
Executable file
26
start-and-unseal.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "🔓 Unsealing Vault..."
|
||||||
|
UNSEAL_KEY="$(cat botserver-stack/conf/vault/init.json | grep -o '"unseal_keys_b64":\["[^"]*"' | cut -d'"' -f4)"
|
||||||
|
|
||||||
|
# Wait for Vault to start
|
||||||
|
for i in {1..30}; do
|
||||||
|
if curl -sfk --cacert botserver-stack/conf/system/certificates/ca/ca.crt \
|
||||||
|
https://localhost:8200/v1/sys/health > /dev/null 2>&1; then
|
||||||
|
echo "✅ Vault is running"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo "⏳ Waiting for Vault... ($i/30)"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Unseal Vault
|
||||||
|
echo "🔓 Unsealing..."
|
||||||
|
curl -s --cacert botserver-stack/conf/system/certificates/ca/ca.crt \
|
||||||
|
-X POST \
|
||||||
|
-H "X-Vault-Token: hvs.JjKHlEzycO2jvKdhhlRAoODu" \
|
||||||
|
-d "{\"key\": \"$UNSEAL_KEY\"}" \
|
||||||
|
https://localhost:8200/v1/sys/unseal
|
||||||
|
|
||||||
|
echo "✅ Vault unsealed"
|
||||||
5
vault-unseal-keys
Normal file
5
vault-unseal-keys
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
Unseal Key 1: JDWcTlskyqgKO5dNghRZyVCrdvH9MsJsfmS/nQhpfUyl
|
||||||
|
Unseal Key 2: UuCsxt0MdaKm0z9ki7oHdLxu7CW47yBnUSrQ2/RiafnT
|
||||||
|
Unseal Key 3: 5g9WTB3Yg5iwEodnaFM8fUH7DzqGfKMO7Wj8rO6YuJdO
|
||||||
|
Unseal Key 4: Y5UQzF1PjgeJZ7/3J6fyvTkrNM2W6+hXCyk/5iyOp+0e
|
||||||
|
Unseal Key 5: f6lFx6B4+RJeKdz3B9r/YNKaTdolenU7PuixDwXMXeJ/
|
||||||
Loading…
Add table
Reference in a new issue