fix(docker): resolve self-hosting build and OAuth troubleshooting issues#2885
fix(docker): resolve self-hosting build and OAuth troubleshooting issues#2885Honey-pg wants to merge 8 commits into
Conversation
Align Docker with CI using Node 22 and pinned pnpm 11.9, copy pnpm-workspace.yaml for non-interactive build scripts, add native build tools, and improve auth logging for self-hosted deployments.
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
|
Good work on the Docker/self-hosting fixes — approved and labeled, but merge conflicts appeared after recent dependency updates (#2928). Please rebase on latest main and resolve the conflicts in package.json, then we'll merge. |
pnpm requires an exact semver in packageManager (pnpm@11.9.0, not pnpm@11). Also align @swc/core-linux-x64-gnu specifier with pnpm-lock.yaml for frozen-lockfile CI installs.
Remove explicit version: 11 from workflows to avoid conflict with packageManager pnpm@11.9.0 in package.json (ERR_PNPM_BAD_PM_VERSION).
Upstream main workflows pin pnpm via action-setup version: 11. Fork PRs run those workflows, not the PR branch workflow files, so packageManager in package.json conflicts until merge. Docker still pins pnpm@11.9.0 via Corepack.
Use version: 11.9.0 in pnpm/action-setup across all workflows. Do not set packageManager in package.json to avoid duplicate-version errors in CI.
Replace pnpm/action-setup@v6 with corepack prepare pnpm@11.9.0 in all workflows. Avoids version conflicts between workflow version keys and packageManager during fork PR CI runs.
|
The Docker fixes look valuable, but this also rewrites 4 CI workflows and bumps to Node 22 while package.json engines still says 20.x. Please split: a Docker-only fix PR (aligned to the engines version, or bump engines explicitly in the same PR), and leave CI workflow changes for a separate discussion. |
Align Docker with CI using Node 22 and pinned pnpm 11.9, copy
pnpm-workspace.yamlfor non-interactive build scripts, add native build tools, and improve auth logging for self-hosted deployments.Summary
Fixes common Docker self-hosting failures on fresh clones: unpinned Corepack/pnpm version mismatches,
ERR_PNPM_IGNORED_BUILDSfrom missing workspace config during image build, native module compile failures without build tools, and opaque GitHub OAuth errors. Aligns the Docker toolchain with CI (Node 22 + pnpm 11.9) and adds startup auth diagnostics for VPS troubleshooting.Closes #2874
Type of Change
What Changed
Dockerfile: Bump base image tonode:22-alpine; pin pnpm viacorepack prepare pnpm@11.9.0 --activate; copypnpm-workspace.yamlbefore install; addpython3,make, andg++in deps/development stagespackage.json: Add"packageManager": "pnpm@11.9.0"; updateengines.nodeto"20.x || 22.x"; remove deprecatedpnpm.onlyBuiltDependencies(canonical config is inpnpm-workspace.yaml)src/lib/auth-config.ts: New startup validation for GitHub/NextAuth env vars; optionalAUTH_DEBUGlogging helperssrc/lib/auth.ts: Wire NextAuthdebug+logger; improve[auth]log messages during sign-indocs/self-hosting.md/README.md: Add Docker build troubleshooting (pnpm, ignored builds, native deps, OAutherror=github,AUTH_DEBUG)How to Test
docker compose build --no-cachedocker compose upand confirm the app starts athttp://localhost:3000/api/auth/providerswithout GitHub/NextAuth env vars set and check logs for[auth] Self-hosting configuration issuesand[nextauth]messagesExpected result:
pnpm installcompletes withoutERR_PNPM_IGNORED_BUILDS; native packages (sharp,esbuild,tree-sitter) build successfully; container starts; auth misconfiguration produces actionable log output instead of silent OAuth failures.Checklist
console.log, debug code, or commented-out blocksnpm run lintpasses locallynpm run type-check)Accessibility (UI changes only)
Additional Context
docker compose build --no-cacheanddocker compose upsucceed; auth diagnostics appear when hitting/api/auth/providerswith missing env vars.docker-compose.ymlstill targets thedevelopmentstage (npm run dev). Self-hosters wanting a production image should build the Dockerfileproductiontarget directly — documented indocs/self-hosting.md.AUTH_DEBUG=truein.envfor verbose NextAuth OAuth logs during self-hosting setup.