Skip to content

Add shutdown tasks and fix signal forwarding#511

Open
Nolah2 wants to merge 1 commit intoCyferShepard:unstablefrom
Nolah2:fix-docker-sigterm
Open

Add shutdown tasks and fix signal forwarding#511
Nolah2 wants to merge 1 commit intoCyferShepard:unstablefrom
Nolah2:fix-docker-sigterm

Conversation

@Nolah2
Copy link

@Nolah2 Nolah2 commented Feb 8, 2026

When shutting down the containers, signals are not being properly forwarded from the script/npm to node. This results in a slow shutdown time. The fix for this is to modify the entry.sh file and use exec so that it doesn't eat PID 1. See here for best practices on achieving this.

Some node images also run into issues with forwarding these signals to child processes, most often being debian. The builder and base image should be replaced with alpine3.23 distro as it does not encounter these issues. See npm/cli#6684 for discussion on this.

Proper shutdown functions should be implemented to close out all websocket connections and shut down the websocket, http, and knex servers/clients.

For transparency, I am pretty new to the node ecosystem (and to some extent, js as a whole) so I did reference an LLM at some points for direction. All code was loosely based on existing FOSS projects or stackoverflow posts.

Fix signal forwarding in the Dockerfile and entry.sh script. Implement sigterm/sigint handlers in the app with shutdown tasks for each service.
@Nolah2 Nolah2 force-pushed the fix-docker-sigterm branch from 2cebec0 to 2e1c04c Compare February 8, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant