Fix pm2 monitoring

Okay huh, while digging a bit into another issue, I found what was wrong with our config and pm2's built-in monitoring! You can't use `yarn start`, because the wrapper script breaks its ability to look inside and see what's happening.

I also removed the compiler flag thing from the `start` script in `package.json`, because I think it's redundant? There's no compilation to be done in a live server.

I think I might remove monit after this? It's nice extra resilience in a sense, but it feels like extra complexity when it's doing the job `pm2` is supposed to do. (And tbh I've almost never heard of nginx crashing, and if it does it's probably a scenario worth investigating by hand.)
This commit is contained in:
Emi Matchu 2021-11-03 16:46:35 -07:00
parent 3f07933f7a
commit d17263139e
2 changed files with 6 additions and 3 deletions

View file

@ -71,8 +71,11 @@
{
name: "impress-2020",
cwd: "/srv/impress-2020/current",
script: "yarn",
args: "start",
// Instead of `yarn start`, we specify the `next` binary
// directly, because it helps pm2 monitor our app correctly.
// https://github.com/vercel/next.js/discussions/10675#discussioncomment-34615
script: "./node_modules/.bin/next",
args: "start --port=3000",
instances: "max",
exec_mode: "cluster",
// We add `app` to the end of the filename, to avoid a pm2

View file

@ -60,7 +60,7 @@
},
"scripts": {
"prepare": "husky install",
"start": "TS_NODE_COMPILER=typescript-cached-transpile next start",
"start": "next start",
"dev": "yarn build-cached-data && REACT_APP_IMPRESS_LOG_IN_AS=$IMPRESS_LOG_IN_AS TS_NODE_COMPILER=typescript-cached-transpile next dev",
"build": "yarn build-cached-data && next build",
"vercel-build": "yum install libuuid-devel libmount-devel && cp /lib64/{libuuid,libmount,libblkid}.so.1 node_modules/canvas/build/Release/",