NodeBB is a forum platform built on Node.js. This layer serves it behind Nginx on the LNPP stack of Keel (handbook note 0082):
core -> web -> lnpp -> nodebb
- NodeBB 4.16.7 in
/var/www/nodebb, from the release tarball at a pinned sha256, owned by root. The dependencies come from the reviewed lock fileusr/share/keel-nodebb/package-lock.jsonwithnpm ci. - Node.js 24 from the Keel package
keel-nodejs-24(note 0083). Each Node.js line is its own package, and the lines conflict. The layer names its line inplan/main. - An apt pin (
/etc/apt/preferences.d/keel-nodebb-nodejs) keeps line 24 and refuses the other lines. nodebb-nodejs.pathrestarts NodeBB when/usr/lib/keel-nodejs/bin/nodechanges. The Node.js package has no maintainer script, so without this unit NodeBB keeps the old binary after an upgrade.- The session secret is in the one-row table
keel_nodebb_secretof the database, so a pair shares it with the session rows. The first writable boot writes it (secrets.nodebb_secretof the spec, which keel renders asKEEL_SECRET_NODEBB_SECRET, else a new value), and no later boot changes it.serve.pygives it to NodeBB in the environment. - PostgreSQL of lnpp in every mode: embedded in
simple, the pair of decision 0054 in the cloud modes. No Redis. nodebb.servicerunsusr/lib/keel-nodebb/serve.pyas the user nodebb. It starts NodeBB only while PostgreSQL accepts writes, runs the schema upgrade before a start, and builds the assets again when the active plugins change. On a standby it writes/run/keel-nodebb/replica, and Nginx shows the replica notice.- The routes in
/etc/nginx/keel-default.d/60-keel-nodebb.confandkeel-front.d: NodeBB on127.0.0.1:4567, socket.io with the Upgrade headers, a larger body on the upload routes only. - The first boot hook
45nodebbandbin/nodebb.py:config.json, the role and databasenodebb, and./nodebb setupwith the admin of the spec (secrets.app_password,app.options.admin_user). With nosecrets.app_password, keel-init asks it on the console (the screen "NodeBB password"). - NodeBB logs in to PostgreSQL on the socket
/run/postgresqlwith the peer authentication of the user nodebb. The rolenodebbhas no password, andconfig.jsonholds no database password.secrets.db_passwordis the password of the accountpostgresonly. - NodeBB writes
build/,logs/, the pidfile, the emoji data of nodebb-plugin-emoji, and/var/lib/nodebb/uploads, which a pair replicates (state.replicateofnodebb.yaml). - The check page of lnpp is removed.
NodeBB needs a CPU of the x86-64-v2 level. Its image library, sharp, loads
its binary only on that level, and its WebAssembly build needs SSE4.1 too.
An LXC uses the CPU of the host. A VM uses the CPU type of its
configuration: the Proxmox VE web interface gives x86-64-v2-AES, which
is correct, but qm create with no --cpu gives kvm64, which is
not. On such a CPU the first boot hook 45nodebb stops and says what to
do:
- Stop the VM.
- Set its CPU type to
x86-64-v2-AESorhost(Hardware, Processors, Type; orqm set VMID --cpu x86-64-v2-AES). - Start the VM and run
/usr/lib/inithooks/firstboot.d/45nodebbas root on its console.
Each Node.js line is its own package, and the lines conflict (handbook
note 0083). /etc/apt/preferences.d/keel-nodebb-nodejs keeps line 24
and refuses every other line, so apt install keel-nodejs-26 finds no
candidate and cannot remove line 24 by surprise. Updates of line 24 come
with apt upgrade as usual.
The normal change of line is a new image: the plan names the new line, the pin follows it, and the image passes commissioning on both sites first. To change the line of an installed node on purpose:
- Make sure that NodeBB of this layer passed commissioning on the new line. A native module of NodeBB is built for the ABI of one line.
- Edit
/etc/apt/preferences.d/keel-nodebb-nodejs: put the new line, for examplekeel-nodejs-26andPin: version 26.*, in the first record. - Run
apt install keel-nodejs-26. apt removeskeel-nodejs-24. nodebb-nodejs.pathrestarts NodeBB on the new binary. Check the forum.
To go back, do the same steps with line 24.
The build needs keel-nodejs-24 in the Keel archive that the build reads:
bt-layer nodebb --parent lnpp
- A login that survives a promote is not tested: no pair test ran. keel has no general path that gives one generated value to both nodes of a pair; this layer keeps its secret in the database instead.
- Coraza exclusions for posts are not written and not tested.
- The option
trusted_proxyof the old layer is gone. - No nodebb layer is published, so the appliance check fails until a layer on lnpp is published after commissioning.
See COVERAGE.md and tests/README.md.