Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Run server as PID 1 in Docker to drop idle launcher processes
Stanislawd13085fdd6ca
diff --git a/Dockerfile b/Dockerfileindex d9e967b26..520814881 100644--- a/Dockerfile+++ b/Dockerfile@@ -76,4 +76,4 @@ EXPOSE 3000ENV HOSTNAME=0.0.0.0ENV PORT=3000-CMD ["npm", "run", "start-docker"]+CMD ["sh", "scripts/start-docker.sh"]diff --git a/scripts/start-docker.sh b/scripts/start-docker.shnew file mode 100755index 000000000..2ad0c3c2e--- /dev/null+++ b/scripts/start-docker.sh@@ -0,0 +1,16 @@+#!/bin/sh+# Container startup: run the one-shot DB check/migration and tracker update, then+# exec the long-running server so it replaces this shell as PID 1.+#+# This avoids `npm-run-all` keeping idle `npm`/`npm-run-all` parent processes+# resident for the lifetime of the container (each a full Node VM holding tens+# of MiB of anonymous memory). `exec` leaves a single `node server.js` process.+#+# PATH is extended so check-db.js's `prisma migrate deploy` resolves the prisma+# CLI from node_modules/.bin the way `npm run` would have injected it.+set -e+export PATH="$PWD/node_modules/.bin:$PATH"++node scripts/check-db.js+node scripts/update-tracker.js+exec node server.js