mirror of
https://github.com/hanzoai/sign.git
synced 2026-10-21 01:21:51 +00:00
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.
47 lines
2.1 KiB
Bash
Executable File
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
|