# Install as /etc/systemd/system/pm2-root.service.d/override.conf # then: systemctl daemon-reload (takes effect on next boot) # # Why: pm2 (erpfrontend) used to start immediately at boot while the iDempiere # REST API (127.0.0.1:8443, started via /etc/init.d/idempiere) needs ~2 minutes # to come up -> every reboot produced a ~2 minute 502 Bad Gateway storm in the # frontend and nginx logs. This override orders pm2 after idempiere and waits # (max 180s, then starts anyway) until the REST port answers. [Unit] After=idempiere.service [Service] Environment=PM2_HOME=/root/.pm2 Environment=NVM_DIR=/root/.nvm Environment=PATH=/root/.nvm/versions/node/v22.14.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ExecStartPre=/bin/sh -c 'timeout 180 sh -c "until curl -ks -o /dev/null --connect-timeout 2 https://127.0.0.1:8443/; do sleep 2; done" || true'