Files
esign/docker/start.sh
T
zooqueen fde9a8962f fix(server): bundle the esign ZAP server layer + resilient migrate
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.
2026-06-22 02:56:25 -07:00

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