From 10a0438d119f2f25cacd9e85b934fb0cf8462419 Mon Sep 17 00:00:00 2001 From: Vladislav Fedyaev Date: Sat, 30 May 2026 19:27:08 +0300 Subject: [PATCH] fix: app now stops on Ctrl+C when running in Docker Replace shell pipeline (| pino-pretty) with fastify-cli's built-in options loading (-o). The logger transport with pino-pretty (singleLine) is configured via the exported 'options' constant in server/plugin.js. Using 'exec' makes fastify PID 1, so Docker signals (SIGINT/SIGTERM) are delivered directly to the Node.js process instead of being lost by the shell. Closes #11 --- bin/start.sh | 2 +- server/plugin.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/start.sh b/bin/start.sh index b1f02ab..13646c5 100755 --- a/bin/start.sh +++ b/bin/start.sh @@ -4,4 +4,4 @@ set -e export NODE_OPTIONS="--import ./instrument.js" -fastify start server/plugin.js -a 0.0.0.0 -l info | pino-pretty -S +exec fastify start server/plugin.js -a 0.0.0.0 -l info -o diff --git a/server/plugin.js b/server/plugin.js index 35add5e..fd83dc8 100644 --- a/server/plugin.js +++ b/server/plugin.js @@ -55,10 +55,13 @@ export default (app, _options) => { return app; }; -// export const options = { -// logger: { -// options: { -// singleLine: true, -// }, -// }, -// }; +export const options = { + logger: { + transport: { + target: 'pino-pretty', + options: { + singleLine: true, + }, + }, + }, +};