Files
zeekay 2f8d94e2fa Start by saying the certificate is there when the environment carries it
The boot check looked only at the file path, so a pod given the
certificate's contents said signing would be unavailable while it was
not.
2026-10-20 12:54:27 -07:00

47 lines
2.1 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}"
# The signer takes the certificate's contents before its path, so the check does too.
if [ -n "$NEXT_PRIVATE_SIGNING_LOCAL_FILE_CONTENTS" ]; then
printf "āœ… Certificate provided in the environment - document signing is ready!\n"
elif [ -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/v1/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/v1/health\n"
printf "šŸ“Š Certificate status: http://localhost:3000/v1/certificate-status\n"
printf "šŸ‘„ Community: https://github.com/hanzoai/esign\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 --config ../../packages/prisma/prisma.config.ts; 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