# Copy this file to deploy.config.ps1 and fill in your own values. # deploy.config.ps1 is gitignored, so your server address stays out of the repo. $Config = @{ # ---- SSH ---- Host = '1.2.3.4' # server IP or domain Port = 22 User = 'root' # Node bin directory on the server (prepended to PATH during the remote build). # Find it in BT Panel -> Node version manager, e.g. /www/server/nodejs/v22.14.0/bin NodeBin = '/www/server/nodejs/v22/bin' # ---- Nginx proxy cache ---- # BT Panel enables `proxy_cache cache_one` globally in # /www/server/nginx/conf/proxy.conf, while Next.js answers with # `Cache-Control: s-maxage=31536000` — i.e. "this page may be cached for a year". # Nginx obeys, so a fresh build is never served; the cached HTML references chunks # that the new build already removed (404), and the page breaks halfway through. # deploy.ps1 clears this directory and reloads Nginx after every deploy. # Leave NginxCacheDir empty ('') to skip that step. NginxCacheDir = '/www/server/nginx/proxy_cache_dir' NginxBin = '/www/server/nginx/sbin/nginx' # ---- yelaymaths_api ---- # The build runs on your machine; the server only receives build output. Api = @{ Key = 'api' Label = 'yelaymaths_api (server API)' LocalPath = 'yelaymaths_api' RemotePath = '/www/wwwroot/yelaymaths/yelaymaths_api' # Build output only. 'prisma' carries the schema + migrations so you can still run # `pnpm prisma:migrate` on the server. Source (src / tools / tsconfig …) is never uploaded. DeployPaths = @( 'dist', 'prisma', 'package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml' ) # Compile locally so the server never spends CPU on a build. LocalBuildCmd = 'pnpm prisma:generate && pnpm build' # Opt-in via -WithInstall. The server's global pnpm is 8.x and cannot read our # v9+ lockfile, so npx fetches a matching pnpm into its cache instead. InstallCmd = 'npx --yes pnpm@10.27.0 install --frozen-lockfile' # Already built locally — do not rebuild on the server. BuildCmd = '' # Directories to delete on the server before unpacking, so files removed locally do # not linger. Leave empty ('@()') when the build output is fully overwritten. CleanPaths = @() # Restart command: kills the old process so the new build is picked up # (Node reads code into memory at startup — uploading alone changes nothing). # If PM2 / systemd already keeps it running, use e.g. 'pm2 restart yelaymaths-api' # and leave StartCmd empty (''). RestartCmd = 'pkill -f "dist/main.js" || true' # Start command. BT Panel does not bring the process back after it is killed, # so we start it ourselves; setsid + nohup keeps it alive after the SSH session ends. # `node` resolves through the NodeBin PATH exported by the remote script. # Leave empty ('') to skip. StartCmd = 'setsid nohup node dist/main.js >> /www/wwwlogs/yelaymaths-api.out.log 2>&1 < /dev/null &' # Probe after start. The deploy fails if this URL does not answer in 30s. HealthUrl = 'http://127.0.0.1:3002/healthz' } # ---- yelaymaths_admin ---- # NOTE: NEXT_PUBLIC_* values are inlined at build time, so .env.local must already # exist on the server before the first deploy. It is never uploaded (it is gitignored # and not in the whitelist). # As with the API, the build runs on your machine and only output is uploaded. Admin = @{ Key = 'admin' Label = 'yelaymaths_admin (admin console)' LocalPath = 'yelaymaths_admin' RemotePath = '/www/wwwroot/yelaymaths/yelaymaths_admin' # Build output only: `next start` needs .next and next.config.ts at runtime. DeployPaths = @( '.next', 'package.json', 'pnpm-lock.yaml', 'next.config.ts' ) # ~73 MB of build cache inside .next is not needed at runtime. ExcludePaths = @('.next/cache', '.next/diagnostics', '.next/trace', '.next/types') # Next serves pre-rendered pages straight from .next/cache instead of reading the files # on disk, so a stale cache means "deployed and restarted, page unchanged". CleanPaths = @('.next/cache') # Same as the API: built locally, never rebuilt on the server. LocalBuildCmd = 'pnpm build' InstallCmd = 'npx --yes pnpm@10.27.0 install --frozen-lockfile' BuildCmd = '' # next start reads pages into memory as well — restart or the old build keeps serving. # 'next-server' is its process name. RestartCmd = 'pkill -f "next-server" || true' # Kill first, then bring it back up ourselves; no BT Panel click needed. StartCmd = 'setsid nohup node node_modules/next/dist/bin/next start -p 3001 >> /www/wwwlogs/yelaymaths-admin.out.log 2>&1 < /dev/null &' HealthUrl = 'http://127.0.0.1:3001/' } }