mirror of
https://github.com/hanzoai/sign.git
synced 2026-10-21 01:21:51 +00:00
Two post-#7 runtime bugs (image never built before, so never exercised): 1. ERR_MODULE_NOT_FOUND @hanzo/esign-trpc/zap/server: the raw-copied server/main.js imported serveZap/serveZapHttpApi that rollup never bundled (input was only router.ts). Add zap/http-api.ts as a rollup input, re-export serveZap through it, point main.js at the bundled ./hono path. First-party ZAP layer is now bundled; @zap-proto/web stays an external registry dep (resolves at runtime). 2. SQLite 'database is locked' during prisma migrate (replicate sidecar streams the WAL): retry the migrate with backoff.
44 lines
1.9 KiB
Bash
Executable File
44 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# š Starting Hanzo eSign...
|
|
printf "š Starting Hanzo eSign...\n\n"
|
|
|
|
# š Check certificate configuration
|
|
printf "š Checking certificate configuration...\n"
|
|
|
|
CERT_PATH="${NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH:-/opt/hanzo-sign/cert.p12}"
|
|
|
|
if [ -f "$CERT_PATH" ] && [ -r "$CERT_PATH" ]; then
|
|
printf "ā
Certificate file found and readable - document signing is ready!\n"
|
|
else
|
|
printf "ā ļø Certificate not found or not readable\n"
|
|
printf "š” Tip: Hanzo eSign will still start, but document signing will be unavailable\n"
|
|
printf "š§ Check: http://localhost:3000/api/certificate-status for detailed status\n"
|
|
fi
|
|
|
|
printf "\nš Useful Links:\n"
|
|
printf "š Documentation: https://docs.esign.hanzo.ai\n"
|
|
printf "š³ Self-hosting guide: https://docs.esign.hanzo.ai/developers/self-hosting\n"
|
|
printf "š Certificate setup: https://docs.esign.hanzo.ai/developers/self-hosting/signing-certificate\n"
|
|
printf "š„ Health check: http://localhost:3000/api/health\n"
|
|
printf "š Certificate status: http://localhost:3000/api/certificate-status\n"
|
|
printf "š„ Community: https://github.com/hanzo-sign/hanzo-sign\n\n"
|
|
|
|
printf "šļø Running database migrations...\n"
|
|
# The replicate sidecar streams the SQLite WAL concurrently, so the first
|
|
# migrate can hit a transient "database is locked". Retry with backoff ā SQLite
|
|
# locks clear in milliseconds once the checkpoint completes.
|
|
migrate_attempt=1
|
|
until npx prisma migrate deploy --schema ../../packages/prisma/schema.prisma; do
|
|
if [ "$migrate_attempt" -ge 6 ]; then
|
|
printf "ā Migrations failed after %d attempts\n" "$migrate_attempt"
|
|
exit 1
|
|
fi
|
|
printf "ā³ Migrate attempt %d hit a lock; retrying in %ds...\n" "$migrate_attempt" "$migrate_attempt"
|
|
sleep "$migrate_attempt"
|
|
migrate_attempt=$((migrate_attempt + 1))
|
|
done
|
|
|
|
printf "š Starting Hanzo eSign server...\n"
|
|
HOSTNAME=0.0.0.0 node build/server/main.js
|