openvibers/openvibe.wiki Commits
Listen on the socket systemd hands over, so a restart never answers 502 (#162)
Changes
@@@ -119,7 +119,10 @@ async function start({ config, db: givenDb = null, now = () => Date.now(), fetchlet server = null;let subscriptions = null;if (listen) {-- await new Promise((resolve) => { server = app.listen(config.port, config.host, resolve); });++ // Socket activation (2026-10-31): systemd's .socket unit holds the listener across restarts, so a deploy++ // queues requests in the kernel instead of answering 502. Without the socket unit, the usual listen.++ const socketActivated = process.env.LISTEN_FDS === '1' && Number(process.env.LISTEN_PID) === process.pid;++ await new Promise((resolve) => { server = app.listen(...(socketActivated ? [{ fd: 3 }] : [config.port, config.host]), resolve); });server.keepAliveTimeout = 65000;log.log(`[Wiki] ${config.nodeEnv} on http://${config.host}:${config.port} → ${config.baseUrl}`);// The two account subscriptions at OpenVibe.Events, created when missing; off without EVENTS_URL,
@@ -119,7 +119,10 @@ async function start({ config, db: givenDb = null, now = () => Date.now(), fetch
@@ -119,7 +119,10 @@ async function start({ config, db: givenDb = null, now = () => Date.now(), fetch
let server = null;
let server = null;
let subscriptions = null;
let subscriptions = null;
if (listen) {
if (listen) {
- await new Promise((resolve) => { server = app.listen(config.port, config.host, resolve); });
+ // Socket activation (2026-10-31): systemd's .socket unit holds the listener across restarts, so a deploy
+ // queues requests in the kernel instead of answering 502. Without the socket unit, the usual listen.
+ const socketActivated = process.env.LISTEN_FDS === '1' && Number(process.env.LISTEN_PID) === process.pid;
+ await new Promise((resolve) => { server = app.listen(...(socketActivated ? [{ fd: 3 }] : [config.port, config.host]), resolve); });
server.keepAliveTimeout = 65000;
server.keepAliveTimeout = 65000;
log.log(`[Wiki] ${config.nodeEnv} on http://${config.host}:${config.port} → ${config.baseUrl}`);
log.log(`[Wiki] ${config.nodeEnv} on http://${config.host}:${config.port} → ${config.baseUrl}`);
// The two account subscriptions at OpenVibe.Events, created when missing; off without EVENTS_URL,
// The two account subscriptions at OpenVibe.Events, created when missing; off without EVENTS_URL,