Add Compose, Gitea deploy, and Postgres dual-backend on develop.
Deploy Development / deploy (push) Successful in 44s
Test Suite / backend-sqlite (push) Failing after 2s
Test Suite / frontend-build (push) Successful in 23s

Use host ports 3006/8005 and 3096/8096 so Kansho does not collide with Bookstack on 3005 or the sister products.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-09-07 12:15:08 +02:00
1 parent 32acdc220b
commit 07479f6a9f
37 files changed
+1613 -102

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
name: Deploy Development
on:
push:
branches: [develop]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy Kanshō to development
run: |
set -e
echo "=== Deploying Kanshō to DEVELOPMENT ==="
REPO="http://192.168.2.144:3000/Lars/Kansho.git"
TARGET="/home/lars/docker/kansho-dev"
mkdir -p "$TARGET"
cd "$TARGET"
if [ ! -d .git ]; then
git clone -b develop "$REPO" .
else
git fetch origin develop
git checkout develop
git reset --hard origin/develop
fi
docker compose -f docker-compose.dev-env.yml build --no-cache backend frontend
if ! docker compose -f docker-compose.dev-env.yml up -d --wait; then
echo "compose up --wait failed — backend logs:"
docker compose -f docker-compose.dev-env.yml logs backend --tail 150 || true
docker compose -f docker-compose.dev-env.yml ps || true
exit 1
fi
if ! curl -sf http://localhost:8096/api/health; then
echo "DEV API not reachable — backend logs:"
docker compose -f docker-compose.dev-env.yml logs backend --tail 150 || true
exit 1
fi
echo "DEV API /api/health OK"
curl -sf http://localhost:3096/api/health && echo "DEV frontend proxy /api/health OK"
echo "=== Kanshō DEV deploy complete ==="
+40
View File
@@ -0,0 +1,40 @@
name: Deploy Production
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy Kanshō to production
run: |
set -e
echo "=== Deploying Kanshō to PRODUCTION ==="
REPO="http://192.168.2.144:3000/Lars/Kansho.git"
TARGET="/home/lars/docker/kansho"
mkdir -p "$TARGET"
cd "$TARGET"
if [ ! -d .git ]; then
git clone -b main "$REPO" .
else
git fetch origin main
git checkout main
git reset --hard origin/main
fi
docker compose build --no-cache backend frontend
if ! docker compose up -d --wait; then
echo "compose up --wait failed — backend logs:"
docker compose logs backend --tail 150 || true
docker compose ps || true
exit 1
fi
if ! curl -sf http://localhost:8005/api/health; then
echo "PROD API not reachable — backend logs:"
docker compose logs backend --tail 150 || true
exit 1
fi
echo "PROD API /api/health OK"
curl -sf http://localhost:3006/api/health && echo "PROD frontend proxy /api/health OK"
echo "=== Kanshō PROD deploy complete ==="
+67
View File
@@ -0,0 +1,67 @@
name: Test Suite
on:
push:
branches: [develop, main]
pull_request:
branches: [develop]
jobs:
backend-sqlite:
runs-on: ubuntu-latest
steps:
- name: Backend tests against isolated SQLite
run: |
set -e
EVENT_REF="${{ github.ref_name }}"
BASE_REF="${{ github.base_ref }}"
APP_DIR="/home/lars/docker/kansho"
COMPOSE_FILE="docker-compose.yml"
if [ "$EVENT_REF" = "develop" ] || [ "$BASE_REF" = "develop" ]; then
APP_DIR="/home/lars/docker/kansho-dev"
COMPOSE_FILE="docker-compose.dev-env.yml"
fi
echo "tests against ${APP_DIR} (${COMPOSE_FILE})"
cd "$APP_DIR"
for i in $(seq 1 60); do
if docker compose -f "$COMPOSE_FILE" exec -T backend true 2>/dev/null; then
echo "backend ready (attempt $i)"
break
fi
if [ "$i" -eq 60 ]; then
echo "timeout waiting for backend"
docker compose -f "$COMPOSE_FILE" ps || true
exit 1
fi
sleep 5
done
docker compose -f "$COMPOSE_FILE" exec -T \
-e KANSHO_DB_BACKEND=sqlite \
-e KANSHO_DB_PATH=/tmp/kansho-ci.sqlite \
-e KANSHO_PROVIDER_KEY= \
-e KANSHO_DETECT_PROVIDER_KEY= \
-e PYTHONUTF8=1 \
backend sh -lc '
set -e
rm -f /tmp/kansho-ci.sqlite
for test in tests/test_*.py; do
echo "=== $test ==="
python "$test"
done
'
frontend-build:
runs-on: ubuntu-latest
steps:
- name: Frontend production build on deploy checkout
run: |
set -e
EVENT_REF="${{ github.ref_name }}"
BASE_REF="${{ github.base_ref }}"
APP_DIR="/home/lars/docker/kansho"
if [ "$EVENT_REF" = "develop" ] || [ "$BASE_REF" = "develop" ]; then
APP_DIR="/home/lars/docker/kansho-dev"
fi
cd "$APP_DIR/frontend"
npm ci
npm run build