CI: Deploy to system container via incus
This commit is contained in:
parent
72e64ce7b4
commit
54e1069ce0
1 changed files with 29 additions and 19 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
# NEW WORKFLOW - Fresh start
|
|
||||||
name: BotServer CI
|
name: BotServer CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
@ -9,26 +8,37 @@ env:
|
||||||
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
build:
|
||||||
runs-on: gbo
|
runs-on: gbo
|
||||||
steps:
|
steps:
|
||||||
|
- name: Setup
|
||||||
|
run: |
|
||||||
|
cd /opt/gbo/work/botserver
|
||||||
|
git rebase --abort 2>/dev/null || true
|
||||||
|
git reset --hard HEAD && git clean -fd
|
||||||
|
git pull
|
||||||
|
git submodule foreach --recursive git reset --hard HEAD 2>/dev/null || true
|
||||||
|
git submodule update --init --recursive botlib botserver 2>/dev/null || true
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
cd /opt/gbo/work/botserver
|
||||||
|
cargo build -p botserver
|
||||||
|
ls -lh target/debug/botserver
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
echo "Starting deploy..."
|
BINARY="/opt/gbo/work/botserver/target/debug/botserver"
|
||||||
# Kill old
|
echo "Deploying from: $BINARY"
|
||||||
timeout 3 bash -c 'while pgrep -x botserver > /dev/null; do pkill -x botserver; sleep 0.3; done' || true
|
|
||||||
sleep 1
|
# Push binary to system container
|
||||||
# Copy
|
sudo incus file push "$BINARY" system:/opt/gbo/bin/botserver --mode=0755
|
||||||
cp -f /opt/gbo/work/botserver/target/debug/botserver /opt/gbo/bin/botserver 2>/dev/null || echo "Binary not found, skipping copy"
|
echo "✅ Copied to system container"
|
||||||
chmod +x /opt/gbo/bin/botserver
|
|
||||||
# Start
|
# Restart botserver on system container
|
||||||
cd /opt/gbo/bin && ./botserver --noconsole &
|
sudo incus exec system -- systemctl restart botserver
|
||||||
sleep 2
|
echo "✅ Restarted on system"
|
||||||
|
|
||||||
# Verify
|
# Verify
|
||||||
if pgrep -x botserver > /dev/null 2>&1; then
|
sleep 2
|
||||||
echo "✅ SUCCESS"
|
sudo incus exec system -- pgrep -x botserver && echo "✅ Running on system!" || echo "❌ Not running"
|
||||||
pgrep -x botserver
|
|
||||||
else
|
|
||||||
echo "❌ FAILED"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue