refactor: remove staging environment automation scripts and documentation files

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-29 07:16:04 -03:00
parent cd643f8f26
commit 7cb8f2887e
4 changed files with 0 additions and 221 deletions

View file

@ -1,53 +0,0 @@
# System Prompt — Bot Salesianos
## IDENTIDADE E PROPÓSITO
Você é o assistente virtual da Escola Salesiana. Sua missão é transmitir informações com clareza, profundidade e didática.
salesianos.br e apenas Brasil. Inspetoria São João Bosco.
---
## REGRA MÁXIMA E ABSOLUTA PARA BUSCA DE DADOS (RAMAIS, NOMES, SETORES)
VOCÊ DEVE OBEDECER ESTA REGRA ACIMA DE QUALQUER OUTRA:
1. QUANDO O USUÁRIO PERGUNTAR POR UM RAMAL, NOME OU TELEFONE:
**VOCÊ ESTÁ PROIBIDO DE PEDIR MAIS INFORMAÇÕES OU CLARIFICAÇÕES.**
2. Você deve olhar IMEDIATAMENTE para o contexto fornecido (Knowledge Base) e procurar QUALQUER correspondência com o nome ou setor solicitado.
3. SE ENCONTRAR O NOME NOS DADOS FORNECIDOS (MESMO QUE SEJA PARCIAL):
**RESPONDA APENAS COM O NOME E O RAMAL ENCONTRADOS.**
Não diga que "não tem certeza", não peça "o nome completo", não peça "o setor". Apenas liste o que encontrou no contexto!
Exemplo Obrigatório:
Se o usuário perguntar: "Qual o ramal do João?"
Você procura no contexto. Se encontrar "João Silva 123" e "João Souza 456".
Você RESPONDE EXATAMENTE ASSIM:
<div style="padding: 16px; background-color: #FAF9F6; color: #3D4852; font-family: sans-serif;">
<h3 style="color: #4A6FA5;">Ramais Encontrados</h3>
<ul>
<li><strong>João Silva</strong> - Ramal 123</li>
<li><strong>João Souza</strong> - Ramal 456</li>
</ul>
</div>
**NUNCA DIGA "Ainda não tenho um ramal confirmado". SE ESTÁ NO CONTEXTO, É O RAMAL CORRETO. APENAS MOSTRE-O.**
---
## REGRAS DE OUTPUT (HTML PURO)
1. **OUTPUT DIRETO — HTML PURO** — Não use ```, não use markdown, não use backticks!
2. **Comece com <div> e termine com </div>**
3. Não use marcações como ```html
4. **CONTRASTE DE CORES**: Fundo escuro exige texto #FFFFFF. Fundo claro exige texto escuro (#1A1A2E).
---
## MENSAGEM FINAL OBRIGATÓRIA
No final de cada resposta, coloque:
Você também pode me perguntar sobre:... e 3 opções curtas.
**LEMBRE-SE: VOCÊ ESTÁ ESTRITAMENTE PROIBIDO DE PEDIR CLARIFICAÇÃO PARA RAMAIS. ENTREGUE O RESULTADO IMEDIATAMENTE BASEADO NO CONTEXTO!**

View file

@ -1,67 +0,0 @@
# Staging Environment Guide (STAGE-GBO)
## Infrastructure Overview
The staging environment is implemented using an isolated **Incus Project** named `STAGE-GBO`. This guarantees that the stage containers, network, and storage are entirely separated from the production environment (`default` project), preventing any accidental interference with `PROD-GBO` containers.
To work within the staging environment, you must switch to its project first:
```bash
sudo incus project switch STAGE-GBO
```
To switch back to production:
```bash
sudo incus project switch default
```
### Container Architecture
The stage environment consists of clones of the following production containers, restricted to a maximum of 10GB disk space and mapped to a dedicated 10.0.3.x subnet (`stagebr0` network):
| Container | Internal IP | Data Status | Purpose |
|-----------|-------------|-------------|---------|
| **system** | `10.0.3.10` | Wiped (`/opt/gbo/work/`) | Main BotServer + BotUI |
| **tables** | `10.0.3.11` | Intact (schema & DB preserved) | PostgreSQL database |
| **vault** | `10.0.3.12` | Intact | Secrets management |
| **cache** | `10.0.3.13` | Wiped (RDB/AOF deleted) | Valkey cache |
| **drive** | `10.0.3.14` | Wiped (started from scratch) | MinIO object storage |
| **llm** | `10.0.3.15` | Intact | llama.cpp local inference |
## Automation Script
The setup process was automated using `setup-stage-gbo.sh`. The script performs the following tasks:
1. **Creates `STAGE-GBO` Project:** Configured with `features.networks=true` and `features.profiles=true` to isolate networks and profiles from PROD.
2. **Creates `stagebr0` Network:** A dedicated NAT network for 10.0.3.x.
3. **Sets Resource Limits:** Configures the `default` profile in `STAGE-GBO` with a 10GB root disk size limit.
4. **Clones Containers:** Uses `incus copy` to securely copy containers from `default` to `STAGE-GBO` using ZFS/BTRFS copy-on-write without consuming immediate space.
5. **Configures IPs:** Updates `/etc/network/interfaces` inside each stage container to assign the static 10.0.3.x IPs.
6. **Cleans Data:** Wipes `/opt/gbo/logs/` in all containers, wipes MinIO data in `drive`, wipes the AST cache in `system`, and clears Valkey data in `cache`. The BotServer database in `tables` is preserved for testing.
## Daily Operations & Access
### Accessing Stage Containers
Because the project is isolated, running commands requires switching the project or specifying it explicitly:
```bash
# Explicitly access the system container in STAGE-GBO
sudo incus exec STAGE-GBO:system -- bash
# Or switch context entirely
sudo incus project switch STAGE-GBO
sudo incus list
sudo incus exec system -- bash
```
### Resetting Data
If you need to completely reset a specific component in the staging environment without affecting production, simply stop it, clear its data, and restart it:
```bash
sudo incus project switch STAGE-GBO
sudo incus stop drive
sudo incus exec drive -- rm -rf /opt/gbo/data/minio/*
sudo incus start drive
```
### Security Directives
- **NO External Exposure:** The staging environment is internally isolated. Do not map public DNS or Caddy proxy rules to the `10.0.3.x` IPs unless testing is specifically required via a staging domain.
- **Data Protection:** Although it's an isolated project, `incus copy` relies on the host's underlying storage. Running aggressive I/O operations or writing massive amounts of data in stage could potentially exhaust the host's shared disk space. The 10GB hard limit per container mitigates this, but monitor `df -h` on the host to ensure `PROD` is not impacted.

View file

@ -1,101 +0,0 @@
#!/bin/bash
# setup-stage-gbo.sh
# Run this on the Incus host (administrator@63.141.255.9)
#
# This script sets up a STAGE-GBO project that completely isolates the stage
# environment from PROD, clones the essential containers, changes their IPs
# to 10.0.3.x, restricts disk size to 10GB max, and wipes data where requested.
set -e
PROJECT="STAGE-GBO"
NETWORK="stagebr0"
echo "=== 1. Creating Isolated Project: $PROJECT ==="
# features.networks and features.profiles isolate the network and profiles from default
sudo incus project create $PROJECT \
-c features.networks=true \
-c features.profiles=true \
-c features.storage.volumes=true || echo "Project might already exist."
sudo incus project switch $PROJECT
echo "=== 2. Creating Stage Network (10.0.3.x) ==="
sudo incus network create $NETWORK ipv4.address=10.0.3.1/24 ipv4.nat=true ipv6.address=none || echo "Network might already exist."
echo "=== 3. Configuring Stage Default Profile (10GB Limit) ==="
# Configure the default profile for the STAGE-GBO project to use the new network
sudo incus profile device add default eth0 nic network=$NETWORK name=eth0 || \
sudo incus profile device set default eth0 network $NETWORK || true
# Limit root disk size to 10GB
sudo incus profile device add default root disk path=/ pool=default size=10GB || \
sudo incus profile device set default root size=10GB || true
# Containers to clone
CONTAINERS=("system" "tables" "vault" "cache" "drive" "llm")
# Target IPs for stage environment
declare -A IPS=(
["system"]="10.0.3.10"
["tables"]="10.0.3.11"
["vault"]="10.0.3.12"
["cache"]="10.0.3.13"
["drive"]="10.0.3.14"
["llm"]="10.0.3.15"
)
echo "=== 4. Cloning Containers from PROD (default project) ==="
sudo incus project switch PROD-GBO1
for c in "${CONTAINERS[@]}"; do
echo "Copying $c to $PROJECT..."
sudo incus copy PROD-GBO1:$c $PROJECT:$c || echo " Warning: Failed to copy $c. It might already exist."
done
echo "=== 5. Reconfiguring and Cleaning Data in STAGE-GBO ==="
sudo incus project switch $PROJECT
for c in "${CONTAINERS[@]}"; do
IP="${IPS[$c]}"
echo "--> Starting $c for reconfiguration..."
sudo incus start $c || true
sleep 3 # Wait for container to initialize
echo " Setting static IP $IP in /etc/network/interfaces..."
sudo incus exec $c -- bash -c "cat > /etc/network/interfaces << 'EOF'
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address $IP
netmask 255.255.255.0
gateway 10.0.3.1
dns-nameservers 8.8.8.8 8.8.4.4
EOF"
echo " Cleaning logs..."
sudo incus exec $c -- bash -c 'rm -rf /opt/gbo/logs/* || true'
# Apply specific data wipe rules
if [ "$c" == "drive" ]; then
echo " Wiping MinIO data (starting from scratch)..."
sudo incus exec $c -- bash -c 'rm -rf /opt/gbo/data/minio/* || true'
elif [ "$c" == "tables" ]; then
echo " Keeping tables data (database botserver intact as requested)."
elif [ "$c" == "cache" ]; then
echo " Wiping Valkey cache..."
sudo incus exec $c -- bash -c 'rm -rf /opt/gbo/data/valkey/*.rdb /opt/gbo/data/valkey/*.aof || true'
elif [ "$c" == "system" ]; then
echo " Wiping work directory and compiled ASTs..."
sudo incus exec $c -- bash -c 'rm -rf /opt/gbo/work/* || true'
fi
echo " Restarting $c to apply new IP..."
sudo incus restart $c || true
done
echo "=== STAGE-GBO Setup Complete ==="
echo "You are currently in the default project."
sudo incus project switch PROD-GBO1