Richte Develop-Build und Main-Deploy analog zur Jinkendo-Familie ein.
Deploy Development / deploy (push) Successful in 1m6s
Test Suite / smoke-dev (push) Successful in 0s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-03 10:47:48 +02:00
1 parent 94053d7fbe
commit 3ac42645ef
29 files changed
+3047 -3

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
name: Deploy Development
on:
push:
branches: [develop]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy BuyingAgent to development
run: |
set -e
echo "=== Deploying BuyingAgent to DEVELOPMENT ==="
REPO="http://192.168.2.144:3000/Lars/BuyingAgent.git"
TARGET="/home/lars/docker/buyingagent-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
if [ ! -f .env ]; then
cp .env.example .env
echo "created .env from .env.example"
fi
if grep -q '^BUYING_AGENT_API_PORT=' .env; then
sed -i 's/^BUYING_AGENT_API_PORT=.*/BUYING_AGENT_API_PORT=8095/' .env
else
echo 'BUYING_AGENT_API_PORT=8095' >> .env
fi
export ENGINE_BUILD BUYING_AGENT_API_PORT
ENGINE_BUILD="$(git rev-parse --short HEAD)"
BUYING_AGENT_API_PORT=8095
docker compose -f docker-compose.dev-env.yml build --no-cache api
if ! ENGINE_BUILD="$ENGINE_BUILD" BUYING_AGENT_API_PORT="$BUYING_AGENT_API_PORT" \
docker compose -f docker-compose.dev-env.yml up -d --wait; then
echo "compose up --wait failed — api logs:"
docker compose -f docker-compose.dev-env.yml logs api --tail 150 || true
docker compose -f docker-compose.dev-env.yml ps || true
exit 1
fi
if ! curl -sf http://localhost:8095/health/live; then
echo "DEV /health/live not reachable — api logs:"
docker compose -f docker-compose.dev-env.yml logs api --tail 150 || true
exit 1
fi
echo "DEV /health/live OK"
if ! curl -sf http://localhost:8095/health/ready; then
echo "DEV /health/ready failed — api logs:"
docker compose -f docker-compose.dev-env.yml logs api --tail 150 || true
exit 1
fi
echo "DEV /health/ready OK"
echo "=== BuyingAgent DEV deploy complete (${ENGINE_BUILD}) ==="
+66
View File
@@ -0,0 +1,66 @@
name: Deploy Production
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy BuyingAgent to production
run: |
set -e
echo "=== Deploying BuyingAgent to PRODUCTION ==="
REPO="http://192.168.2.144:3000/Lars/BuyingAgent.git"
TARGET="/home/lars/docker/buyingagent"
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
if [ ! -f .env ]; then
cp .env.example .env
echo "created .env from .env.example — set a unique DB_PASSWORD for production"
fi
if grep -q '^BUYING_AGENT_API_BIND=' .env; then
sed -i 's/^BUYING_AGENT_API_BIND=.*/BUYING_AGENT_API_BIND=0.0.0.0/' .env
else
echo 'BUYING_AGENT_API_BIND=0.0.0.0' >> .env
fi
if grep -q '^BUYING_AGENT_API_PORT=' .env; then
sed -i 's/^BUYING_AGENT_API_PORT=.*/BUYING_AGENT_API_PORT=8006/' .env
else
echo 'BUYING_AGENT_API_PORT=8006' >> .env
fi
export ENGINE_BUILD BUYING_AGENT_API_BIND BUYING_AGENT_API_PORT
ENGINE_BUILD="$(git rev-parse --short HEAD)"
BUYING_AGENT_API_BIND=0.0.0.0
BUYING_AGENT_API_PORT=8006
docker compose build --no-cache api
if ! ENGINE_BUILD="$ENGINE_BUILD" \
BUYING_AGENT_API_BIND="$BUYING_AGENT_API_BIND" \
BUYING_AGENT_API_PORT="$BUYING_AGENT_API_PORT" \
docker compose up -d --wait; then
echo "compose up --wait failed — api logs:"
docker compose logs api --tail 150 || true
docker compose ps || true
exit 1
fi
if ! curl -sf http://localhost:8006/health/live; then
echo "PROD /health/live not reachable — api logs:"
docker compose logs api --tail 150 || true
exit 1
fi
echo "PROD /health/live OK"
if ! curl -sf http://localhost:8006/health/ready; then
echo "PROD /health/ready failed — api logs:"
docker compose logs api --tail 150 || true
exit 1
fi
echo "PROD /health/ready OK"
echo "=== BuyingAgent PROD deploy complete (${ENGINE_BUILD}) ==="
+35
View File
@@ -0,0 +1,35 @@
name: Test Suite
on:
push:
branches: [develop]
workflow_run:
workflows: ["Deploy Development"]
types: [completed]
workflow_dispatch:
jobs:
smoke-dev:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Non-destructive smoke against the running Dev API
run: |
set -e
echo "wait for live Dev API (buyingagent-dev)"
for i in $(seq 1 60); do
if curl -sf http://localhost:8095/health/live >/dev/null; then
echo "DEV /health/live ready (attempt $i)"
break
fi
if [ "$i" -eq 60 ]; then
echo "timeout waiting for DEV /health/live"
exit 1
fi
sleep 5
done
curl -sf http://localhost:8095/health/live
echo
curl -sf http://localhost:8095/health/ready
echo
echo "LAN smoke OK: http://192.168.2.49:8095"