Richte Develop-Build und Main-Deploy analog zur Jinkendo-Familie ein.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
94053d7fbe
commit
3ac42645ef
29 files changed
+3047
-3
No files matched your search
@@ -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}) ==="
|
||||
Reference in new issue
Block a user