I’m running a remix site on a custom server using cleavr. To get the site to run properly in cluster mode, I had to set up an express server for remix. This requires a couple customizations to the build settings. Here’s my build config:
module.exports = {
name: "SITE_NAME",
script: "./server.js",
// args: "",
log_type: "json",
cwd: "/home/cleavr/SITE_NAME/current",
// Note: We detected that this web app is running on a server with multiple CPUs and hence we are
// setting *instances* to "max" and *exec_mode* to "cluster_mode" for better performance.
watch: false,
instances : "max", // change the value to "1" if your server has only 1 CPU
exec_mode : "cluster_mode", // remove this line if your server has only 1 CPU
env: {
"PORT": 9718,
"CI": 1,
"NUXT_TELEMETRY_DISABLED": 1,
...ENV_VARS
}
}
This setup works great, but when I deploy a new version of my app, it looks like pm2 checks if there’s a change to the build config, and if there isn’t, it’s running an old version of the start command. This results in my server being unable to run in cluster mode.
In order to get it running properly, I have to make a small change (anything will do) to the build config so it registers that there’s a change and uses the appropriate start command.
Any ideas on how to fix this? Is there something wrong in my config or is there a setting I can toggle so that it always reads the current version of the build config?