openvibers/openvibe.services Commits
Listen on the socket systemd hands over, so a restart never answers 502 (#161)
Changes
@@@ -45,7 +45,10 @@ async function main() {const { app, ctx } = await createApp({ config, store: createStore(db), registry });const { authorities, tokens, outbox, keys, docs } = ctx;-- const server = app.listen(config.port, config.host, () => {++ // 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;++ const server = app.listen(...(socketActivated ? [{ fd: 3 }] : [config.port, config.host]), () => {console.log(`[Services] ${config.nodeEnv} on http://${config.host}:${config.port} → ${config.baseUrl} (store ${db.store})`);console.log(`[Services] docs from openvibe-contracts v${docs.contractsVersion} and openvibe-sdk v${docs.sdkVersion}; authorities ${authorities.size()}: ${authorities.ids().join(', ') || 'none'} (+ services in process); authority tokens ${tokens.enabled ? `client ${config.oauth.clientId}` : 'off (OV_OAUTH_CLIENT_SECRET unset: authorities are reported partial)'}; events relay ${outbox.enabled ? `on → ${config.events.url}` : 'off (events wait in services_events_outbox)'}`);});
@@ -45,7 +45,10 @@ async function main() {
@@ -45,7 +45,10 @@ async function main() {
const { app, ctx } = await createApp({ config, store: createStore(db), registry });
const { app, ctx } = await createApp({ config, store: createStore(db), registry });
const { authorities, tokens, outbox, keys, docs } = ctx;
const { authorities, tokens, outbox, keys, docs } = ctx;
- const server = app.listen(config.port, config.host, () => {
+ // 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;
+ const server = app.listen(...(socketActivated ? [{ fd: 3 }] : [config.port, config.host]), () => {
console.log(`[Services] ${config.nodeEnv} on http://${config.host}:${config.port} → ${config.baseUrl} (store ${db.store})`);
console.log(`[Services] ${config.nodeEnv} on http://${config.host}:${config.port} → ${config.baseUrl} (store ${db.store})`);
console.log(`[Services] docs from openvibe-contracts v${docs.contractsVersion} and openvibe-sdk v${docs.sdkVersion}; authorities ${authorities.size()}: ${authorities.ids().join(', ') || 'none'} (+ services in process); authority tokens ${tokens.enabled ? `client ${config.oauth.clientId}` : 'off (OV_OAUTH_CLIENT_SECRET unset: authorities are reported partial)'}; events relay ${outbox.enabled ? `on → ${config.events.url}` : 'off (events wait in services_events_outbox)'}`);
console.log(`[Services] docs from openvibe-contracts v${docs.contractsVersion} and openvibe-sdk v${docs.sdkVersion}; authorities ${authorities.size()}: ${authorities.ids().join(', ') || 'none'} (+ services in process); authority tokens ${tokens.enabled ? `client ${config.oauth.clientId}` : 'off (OV_OAUTH_CLIENT_SECRET unset: authorities are reported partial)'}; events relay ${outbox.enabled ? `on → ${config.events.url}` : 'off (events wait in services_events_outbox)'}`);
});
});