etherpad-lite/packaging/bin/etherpad
John McLear 9bdbb3ee95
fix(deb): bump nodejs Depends to >= 25; install Node 25 in smoke test (#7754)
Followup to #7752. That PR raised `src/package.json` engines.node to
>=25.0.0 (matching the workspace root) but missed three places that
still encoded the previous Node 22+ floor — so the deb-package CI
broke at sha 33b616b9:

  packaging/nfpm.yaml declared `Depends: nodejs (>= 22)`, so the deb
  installed cleanly on a Node 22-or-24 system. .github/workflows/
  deb-package.yml's smoke test then explicitly installed Node 24
  (`NODE_MAJOR=24`), `dpkg -i` succeeded, and `systemctl start
  etherpad` crashlooped with:

    [ERROR] settings - Running Etherpad on Node v24.15.0 is not
      supported. Please upgrade at least to Node 25.0.0

  (The misleading `ENOENT: ... lstat '/opt/etherpad/.git'` line above
  it is a benign WARN from getGitCommit(), wrapped in try/catch — not
  the cause.)

This commit aligns everything to Node 25:

- packaging/nfpm.yaml: `nodejs (>= 22)` → `nodejs (>= 25)` in the
  top-level `depends:` and the deb / rpm overrides (3 occurrences).
- .github/workflows/deb-package.yml: smoke-test `NODE_MAJOR=24` →
  `25`, comments updated to match.
- packaging/README.md: doc points users at `node_25.x` NodeSource
  apt repo (Node 25 isn't in most distro repos yet, so the
  `setup_lts.x` shortcut no longer suffices).
- packaging/bin/etherpad: comment about the apt declare updated to
  match.

No source code changes — Etherpad's own NodeVersion check already
reads engines.node from src/package.json and rejects anything older.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 11:57:27 +01:00

28 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
# /usr/bin/etherpad - thin wrapper that runs Etherpad in production mode.
# Invoked by the etherpad.service systemd unit.
set -e
APP_DIR="${ETHERPAD_DIR:-/opt/etherpad}"
cd "${APP_DIR}"
: "${NODE_ENV:=production}"
export NODE_ENV
export ETHERPAD_PRODUCTION=true
# Resolve `node` explicitly to the apt-installed binary (the .deb declares
# `Depends: nodejs (>= 25)`, which always lands at /usr/bin/node). Relying
# on PATH would let a stray /usr/local/bin/node — e.g. an older nvm or
# toolcache install — shadow the version we actually require, and the
# server would crash on startup with "Node 20.x is not supported".
NODE_BIN=/usr/bin/node
[ -x "${NODE_BIN}" ] || NODE_BIN=$(command -v node) \
|| { echo "etherpad: node not found (install the 'nodejs' package)" >&2; exit 1; }
# Run the server through tsx's CommonJS hook — Etherpad's prod entrypoint
# (src/node/server.ts) uses `exports.start = ...`, which fails under the
# ESM loader. Mirrors the `prod` script in src/package.json.
exec "${NODE_BIN}" \
--require "${APP_DIR}/src/node_modules/tsx/dist/cjs/index.cjs" \
"${APP_DIR}/src/node/server.ts" \
"$@"