Deployment
Deploying to Zoho Catalyst AppSail requires a pre-built ZIP so the process binds a port within the platform's startup timeout.
What you'll do
- Pre-build a deploy ZIP locally.
- Upload it to AppSail with the correct startup command.
- Configure environment variables in the AppSail dashboard.
Scripts
npm run dev, dev server on port 3000.npm run build, production build.npm run typecheck, TypeScript check without emitting files.npm run deploy:startorsh start.sh, one-shot install plus build plus start for AppSail.
start.sh
start.sh is POSIX-only. It uses /bin/sh (not bash) because AppSail's shell is dash. It:
- Skips install if
node_modules/.bin/nextexists. - Skips build if
.next/BUILD_IDexists. - Starts the app on
$PORT.
Pre-built ZIP
scripts/build-deploy-zip.sh pre-builds the artifact locally so the deployed script only does a couple of seconds of work, well inside AppSail's startup timeout. Ship a source-only ZIP and AppSail will kill the process mid-install.
Command:
sh scripts/build-deploy-zip.sh
That runs the install and build, prunes dev dependencies, and produces a deploy.zip containing node_modules/, .next/, all source, and the start.sh entrypoint. The ZIP is a few hundred MB, which is expected.
AppSail configuration
-
Upload
deploy.zip. -
Startup command:
sh start.sh. -
Port:
3000(or whatever AppSail routes to; the script honors$PORT). -
Set environment variables in the AppSail dashboard (do not upload
.env.local):SESSION_SECRET=<32+ char random> META_API_BASE=https://api.facebook.com GRAPH_API_BASE=https://graph.facebook.com/v20.0 # Optional, only if this app receives Meta webhooks: # META_APP_SECRET= # META_WEBHOOK_VERIFY_TOKEN=
Common failure modes
sh: 1: next: not found, you uploaded a source-only ZIP withoutnode_modules/. Rebuild withsh scripts/build-deploy-zip.sh.npm error code EUSAGE,npm cicould not findpackage-lock.json. Pre-building avoids this.- Process restarts every 10 to 15 seconds, AppSail's startup timeout is killing you mid-install. Pre-build fixes it.
Illegal option -o pipefail, the runtime shell isdash, not bash. Keepstart.shPOSIX-compliant.- Startup command is
npm run dev, wrong. Usesh start.sh.
Related docs
- Security, how the encrypted session relies on
SESSION_SECRET. - Prerequisites, full env var list.