botserver/.forgejo/workflows/botserver.yaml
Rodrigo Rodriguez (Pragmatismo) 68ef554132
All checks were successful
BotServer CI/CD / build (push) Successful in 4m53s
fix: Vault as single source of truth - credentials + location for all services
- Qdrant health check: recognize 'healthz check passed' response (fixes 45s timeout)
- seed_vault_defaults: add host/port/url/grpc_port for ALL 10 services
- fetch_vault_credentials: fetch ALL services via generic loop (drive, cache, tables, vectordb, directory, llm, meet, alm, encryption)
- vectordb URL: fix https://localhost:6334 -> http://localhost:6333 in all config getters
- get_from_env: add host/port/grpc_port for vectordb fallback
- Tested: .reset (fresh install) + .restart (idempotent) - zero errors
2026-04-01 16:46:16 -03:00

90 lines
3.8 KiB
YAML

name: BotServer CI/CD
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_BUILD_JOBS: 8
CARGO_NET_RETRY: 10
WORKSPACE: /opt/gbo/ci/botserver
CARGO_TARGET_DIR: /opt/gbo/ci/botserver/target
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
jobs:
build:
runs-on: gbo
steps:
- name: Setup Git
run: |
git config --global http.sslVerify false
git config --global --add safe.directory "*"
- name: Setup Workspace
run: |
mkdir -p $WORKSPACE
cd $WORKSPACE
# Update or clone botlib
if [ -d botlib/.git ]; then
git -C botlib fetch --depth 1 origin main && git -C botlib checkout FETCH_HEAD
else
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/botlib.git botlib
fi
# Update or clone botserver
if [ -d botserver/.git ]; then
git -C botserver fetch --depth 1 origin main && git -C botserver checkout FETCH_HEAD
else
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git botserver
fi
# Get workspace Cargo.toml from gb and strip unused members
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git /tmp/gb-ws
cp /tmp/gb-ws/Cargo.toml Cargo.toml
for m in botapp botdevice bottest botui botbook botmodels botplugin bottemplates; do
grep -v "\"$m\"" Cargo.toml > /tmp/c.toml && mv /tmp/c.toml Cargo.toml
done
rm -rf /tmp/gb-ws
- name: Install system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y libpq-dev libssl-dev liblzma-dev pkg-config
- name: Build BotServer
working-directory: /opt/gbo/ci/botserver
run: |
cargo build -p botserver --features chat -j 8 2>&1 | tee /tmp/build.log
ls -lh target/debug/botserver
- name: Save build log
if: always()
run: sudo cp /tmp/build.log /tmp/botserver-$(date +%Y%m%d-%H%M%S).log || true
- name: Deploy via ssh tar gzip
run: |
set -e
echo "=== Deploy started ==="
echo "Step 1: Checking binary..."
ls -lh /opt/gbo/ci/botserver/target/debug/botserver
echo "Step 2: Killing old botserver..."
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 system "pgrep -f botserver && killall botserver 2>/dev/null || echo 'No running botserver'"
echo "Step 3: Removing old binary..."
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 system "rm -f /opt/gbo/bin/botserver && echo 'Old binary removed'"
echo "Step 4: Starting tar+gzip transfer..."
tar cf - -C /opt/gbo/ci/botserver/target/debug botserver | gzip -1 | ssh -o StrictHostKeyChecking=no -o ConnectTimeout=60 -o ServerAliveInterval=10 system "gzip -d | tar xf - -C /opt/gbo/bin && echo 'Transfer complete'"
echo "Step 5: Verifying transfer..."
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 system "ls -lh /opt/gbo/bin/botserver"
echo "Step 6: Setting permissions..."
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 system "chmod +x /opt/gbo/bin/botserver && chown gbuser:gbuser /opt/gbo/bin/botserver"
echo "=== Deploy completed ==="
- name: Verify botserver started
run: |
sleep 10
ssh -o StrictHostKeyChecking=no system "pgrep -f botserver && echo 'OK: botserver is running' || (echo 'ERROR: botserver not running' && cat /opt/gbo/logs/error.log | tail -20 && exit 1)"
- name: Save deploy log
if: always()
run: sudo cp /tmp/deploy.log /tmp/deploy-$(date +%Y%m%d-%H%M%S).log || true