Skip to content

How to Auto Reconnect with Supervisor

Encho edited this page Aug 18, 2022 · 6 revisions

2based2wait is built to be capable of 24/7/365 uptime. In order to achieve this, we use Supervisor, a tiny script that will restart the proxy.

To get the proxy to autoreconnect, do the following:

  1. Install Supervisor globally with npm install supervisor -g
  2. Start the proxy with Supervisor. You have two options:
  • Option 1: npm run supervisor
    • The proxy will only restart when the program exits with an exit code of "success", which it does when it wants to autoreconnect. This means that if the proxy crashes in an unexpected way, it might not autoreconnect.
  • Option 2: npm run supervisorAllGasNoBrakes
    • The proxy will restart whenever the program exits. Use this robust setup for 24/7/365 uptime, but only after you're incredibly certain that your config is actually working.

Tip: Autoreconnect should be one of the last things you enable. Make sure your config is working before turning it on, or you'll end up with a constantly restarting script!