From c13a3f2a04aa6f86b6e9d04e09596646427979bd Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Sat, 23 May 2026 17:35:13 -0600 Subject: [PATCH] Update smoke-test --- CloudronManifest.json | 2 +- Dockerfile | 6 +++--- scripts/staging-smoke.sh | 5 +++-- scripts/start.sh | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CloudronManifest.json b/CloudronManifest.json index b2ea322..1db1ca8 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -4,7 +4,7 @@ "title": "Community Rule", "author": "MEDLab", "description": "Community governance and rule-building app", - "version": "0.1.1", + "version": "0.1.2", "httpPort": 3000, "healthCheckPath": "/api/health", "memoryLimit": 805306368, diff --git a/Dockerfile b/Dockerfile index 742b114..854c29c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,9 +44,9 @@ COPY --from=builder --chown=node:node /app/.next/static ./.next/static COPY --from=builder --chown=node:node /app/prisma ./prisma # Prisma CLI (devDependency) is not in the Next.js standalone trace. Install -# globally in the runner so start.sh can run `prisma migrate deploy` with all -# transitive deps (@prisma/engines, effect, etc.). -RUN npm install -g prisma@6.19.3 +# globally in the runner so start.sh can run `prisma migrate deploy` and the +# one-time idempotent `prisma db seed` (upserts by slug). +RUN npm install -g prisma@6.19.3 tsx@4.19.4 # Cloudron's runtime rootfs is read-only except /tmp, /run, /app/data. # Three marketing routes use ISR (`revalidate`) and write to .next/cache; diff --git a/scripts/staging-smoke.sh b/scripts/staging-smoke.sh index ee0d268..cd2a7e4 100755 --- a/scripts/staging-smoke.sh +++ b/scripts/staging-smoke.sh @@ -45,7 +45,7 @@ check_http() { check_json_contains() { name="$1" pattern="$2" - if grep -q "$pattern" "/tmp/staging-smoke-body.$$" 2>/dev/null; then + if grep -Fq "$pattern" "/tmp/staging-smoke-body.$$" 2>/dev/null; then pass "$name" else fail "$name (body missing pattern: $pattern)" @@ -61,7 +61,8 @@ check_json_contains 'health ok + database connected' '"ok":true' check_json_contains 'health database connected' '"database":"connected"' check_http "GET /api/templates" "$BASE/api/templates" "200" -check_json_contains 'templates non-empty' '"templates":[' +check_json_contains 'templates response shape' '"templates":[' +check_json_contains 'templates seeded (non-empty)' '"slug":' check_http "GET /api/rules" "$BASE/api/rules" "200" check_json_contains 'rules list shape' '"rules":[' diff --git a/scripts/start.sh b/scripts/start.sh index cd2092c..9c5b3e7 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -21,4 +21,4 @@ chown -R node:node /tmp/next-cache # Drop privileges, apply any pending migrations, then exec the server. # Inner `exec` ensures SIGTERM from Cloudron reaches node for clean shutdown. exec gosu node:node sh -c \ - 'prisma migrate deploy && exec node server.js' + 'prisma migrate deploy && prisma db seed && exec node server.js'