5 Commits

Author SHA1 Message Date
Vectry
b21d8fe52c fix: add lightweight migrate Dockerfile target to avoid tsup build failure in CI
Some checks failed
Deploy AgentLens / deploy (push) Failing after 9s
The migrate service only needs Prisma CLI to run 'prisma db push'. Previously
it used the 'builder' target which runs 'npx turbo build' (including sdk-ts
needing tsup), causing failures in fresh CI builds over TCP where Docker cache
is unavailable. New 'migrate' target copies only node_modules and prisma schema.
2026-02-10 23:56:09 +00:00
Vectry
c6fa25ed47 fix: skip Docker install, use pre-installed CLI from runner image
Some checks failed
Deploy AgentLens / deploy (push) Failing after 6s
2026-02-10 23:38:45 +00:00
Vectry
0e97c23579 fix: use TCP docker host, fix heredoc whitespace, fix health checks in deploy workflow 2026-02-10 23:31:18 +00:00
Vectry
865a1b0081 Fix deploy workflow: use ubuntu-latest with Docker CLI install 2026-02-10 23:22:06 +00:00
Vectry
b3e5119568 Add Gitea Actions deploy-on-tag workflow 2026-02-10 23:18:53 +00:00
3 changed files with 69 additions and 1 deletions

View File

@@ -0,0 +1,64 @@
name: Deploy AgentLens
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
COMPOSE_PROJECT_NAME: agentlens
DOCKER_HOST: tcp://192.168.1.133:2375
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify Docker access
run: |
docker version
docker compose version
- name: Write environment file
run: |
cat > .env <<'ENVEOF'
AUTH_SECRET=${{ secrets.AUTH_SECRET }}
STRIPE_SECRET_KEY=${{ secrets.STRIPE_SECRET_KEY }}
STRIPE_WEBHOOK_SECRET=${{ secrets.STRIPE_WEBHOOK_SECRET }}
POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}
REDIS_PASSWORD=${{ secrets.REDIS_PASSWORD }}
EMAIL_PASSWORD=${{ secrets.EMAIL_PASSWORD }}
ENVEOF
sed -i 's/^[[:space:]]*//' .env
- name: Build and deploy
run: |
echo "Deploying AgentLens ${{ gitea.ref_name }}..."
docker compose build web migrate
docker compose up -d --no-deps --remove-orphans web migrate redis postgres
echo "Waiting for migration and startup..."
sleep 25
- name: Health check
run: |
for i in 1 2 3 4 5; do
STATUS=$(docker inspect --format='{{.State.Running}}' agentlens-web-1 2>/dev/null || true)
if [ "$STATUS" = "true" ]; then
echo "Container running (attempt $i)"
exit 0
fi
echo "Attempt $i/5 — retrying in 10s..."
sleep 10
done
echo "Health check failed after 5 attempts"
docker compose logs web --tail 50
exit 1
- name: Cleanup
if: always()
run: docker image prune -f

View File

@@ -16,6 +16,10 @@ COPY . .
RUN npx prisma generate --schema=packages/database/prisma/schema.prisma RUN npx prisma generate --schema=packages/database/prisma/schema.prisma
RUN npx turbo build RUN npx turbo build
FROM base AS migrate
COPY --from=deps /app/node_modules ./node_modules
COPY packages/database/prisma ./packages/database/prisma
FROM base AS web FROM base AS web
RUN addgroup --system --gid 1001 nodejs && \ RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs adduser --system --uid 1001 nextjs

View File

@@ -74,7 +74,7 @@ services:
migrate: migrate:
build: build:
context: . context: .
target: builder target: migrate
command: npx prisma db push --schema=packages/database/prisma/schema.prisma --skip-generate command: npx prisma db push --schema=packages/database/prisma/schema.prisma --skip-generate
environment: environment:
- DATABASE_URL=postgresql://${POSTGRES_USER:-agentlens}:${POSTGRES_PASSWORD:-agentlens}@postgres:5432/${POSTGRES_DB:-agentlens} - DATABASE_URL=postgresql://${POSTGRES_USER:-agentlens}:${POSTGRES_PASSWORD:-agentlens}@postgres:5432/${POSTGRES_DB:-agentlens}