================================================================ PipXpert - cPanel deployment guide ================================================================ This bundle was prepared by `pnpm deploy:cpanel` and contains everything cPanel + Phusion Passenger needs to run the PipXpert marketing site as a standard Node.js application. Bundle layout ---------------------------------------------------------------- app.js <- Passenger entry point server.js <- Next.js standalone server package.json .env.example <- copy to .env on the server .htaccess public/ <- /public assets .next/ <- prebuilt app node_modules/ <- already pruned for production Requirements on the cPanel host ---------------------------------------------------------------- * Node.js 20.9 or higher (cPanel "Setup Node.js App") * Passenger / "Application Manager" enabled (default on most modern cPanel installs - look for "Setup Node.js App" in the cPanel home screen). * Outbound HTTPS allowed (for Resend, Turnstile, Google Ads). * A Postgres database. Shared cPanel rarely ships Postgres - use a managed provider (Neon, Supabase, Railway, RDS) and paste the connection string into DATABASE_URL. Step 1 - Upload the bundle ---------------------------------------------------------------- Option A (recommended) - SFTP / SSH: scp -r ./cpanel/dist/* user@your-host:/home/USER/pipxpert/ Option B - cPanel File Manager: 1. Run `ZIP=1 pnpm deploy:cpanel` locally to produce `cpanel/pipxpert-cpanel.zip`. 2. In cPanel -> File Manager, create the folder /home/USER/pipxpert (outside public_html). 3. Upload pipxpert-cpanel.zip into that folder. 4. Right-click -> Extract. Step 2 - Register the Node.js app in cPanel ---------------------------------------------------------------- 1. cPanel home -> "Setup Node.js App" -> "Create Application". 2. Fill in the form: Node.js version: 20.x (or the highest 20+ shown) Application mode: Production Application root: pipxpert (the folder you uploaded to, relative to /home/USER) Application URL: e.g. pipxpert.com or a subdomain like app.pipxpert.com Application startup: app.js Passenger log file: /home/USER/pipxpert/passenger.log 3. Click "Create". Step 3 - Set environment variables ---------------------------------------------------------------- Still on the "Setup Node.js App" page for this app, scroll to "Environment variables (ENV)" and add every key from .env.example. The most important ones to fill in for a live site: NEXT_PUBLIC_SITE_URL https://your-domain.com DATABASE_URL postgres://... RESEND_API_KEY re_... ADMIN_EMAIL leads@your-domain.com NEXT_PUBLIC_TURNSTILE_SITE_KEY TURNSTILE_SECRET NEXT_PUBLIC_GOOGLE_ADS_ID AW-XXXXXXXXX NEXT_PUBLIC_GA4_ID G-XXXXXXXX LEAD_RETRY_KEY You can leave the Google Ads / Resend / Turnstile keys empty for the initial demo - the site will render fine; only the form submit pipeline will be inactive until they are filled in. Step 4 - Install dependencies ---------------------------------------------------------------- The standalone bundle already ships its own node_modules, so an npm install is usually NOT required. If cPanel insists, click "Run NPM Install" - it will be a no-op. Step 5 - Initialize the database ---------------------------------------------------------------- On the server (cPanel "Terminal" or via SSH), in the application root: DATABASE_URL='postgres://...' node -e "console.log('db ok')" If you want Drizzle to push the schema, run from a workstation that has the source repo: DATABASE_URL='postgres://...' pnpm db:push (The standalone bundle does not include drizzle-kit; you only need this once when you first connect a fresh Postgres.) Step 6 - Start the application ---------------------------------------------------------------- On the cPanel "Setup Node.js App" page, click "Start App" (or "Restart App" if it is already running). Open the configured Application URL in a browser - you should see the PipXpert site. Step 7 - Optional: set up the lead-retry cron job ---------------------------------------------------------------- This retries any leads that failed to push to the CRM. In cPanel go to "Cron Jobs" and add: Schedule: every 10 minutes (*/10 * * * *) Command: curl -fsS -X POST \ -H "x-cron-key: YOUR_LEAD_RETRY_KEY" \ https://your-domain.com/api/lead/retry ================================================================ Troubleshooting ================================================================ * 503 / "We're sorry, but something went wrong" -> open the Passenger log shown in cPanel ("Setup Node.js App" -> your app -> "View Logs"). Most issues are a missing DATABASE_URL or wrong NEXT_PUBLIC_SITE_URL. * Stylesheets / images return 404 -> make sure the .next/static and public folders were uploaded. Run the upload again. * Form submissions return "storage_unavailable" -> DATABASE_URL is missing or wrong. Re-check the env variable section in cPanel and "Restart App". * Need a fresh deploy? -> locally run `pnpm deploy:cpanel`, replace the contents of /home/USER/pipxpert with the new cpanel/dist/, then click "Restart App" in cPanel.