Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
cat <<EOF > $out/bin/${name}
#!${pkgs.runtimeShell}
echo "Starting ${name}...";
${nodePackages.pm2}/bin/pm2 delete all; \
${nodePackages.pm2}/bin/pm2 start \
${nodePackages.pm2}/bin/pm2 delete all
${nodePackages.pm2}/bin/pm2 install pm2-prom-module || true
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing pm2-prom-module at runtime (pm2 install ...) makes startup depend on external network availability and an unpinned npm artifact, which hurts reproducibility and can break cold starts/offline deployments. If this is required, prefer packaging/pinning it in Nix (or at least pinning the version in the install command) and handle failures explicitly rather than swallowing them with || true (e.g., log and continue, or gate install on module not already being present).

Copilot uses AI. Check for mistakes.
${nodePackages.pm2}/bin/pm2 start \
$out/libexec/source/dist/server.js \
Comment on lines +47 to 50
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pm2 delete all will remove every PM2-managed process for the service user/PM2_HOME, including any other apps or modules an operator may be running under the same user. Safer is to name this process explicitly (e.g., via pm2 start --name) and delete only that name (or use a dedicated PM2_HOME / user that is guaranteed to be exclusive).

Suggested change
${nodePackages.pm2}/bin/pm2 delete all
${nodePackages.pm2}/bin/pm2 install pm2-prom-module || true
${nodePackages.pm2}/bin/pm2 start \
$out/libexec/source/dist/server.js \
pm2AppName="${name}"
${nodePackages.pm2}/bin/pm2 delete "$pm2AppName" || true
${nodePackages.pm2}/bin/pm2 install pm2-prom-module || true
${nodePackages.pm2}/bin/pm2 start \
$out/libexec/source/dist/server.js \
--name "$pm2AppName" \

Copilot uses AI. Check for mistakes.
--interpreter=${pkgs.nodejs}/bin/node --node-args="\''${BLOCKFROST_NODE_ARGS:-"--max-http-header-size=32768"}" \
--max-memory-restart \''${BLOCKFROST_MAX_MEMORY_RESTART:-"1500M"} \
Expand Down
Loading