Run with PM2 - pixeleate/monero-proxy GitHub Wiki

Run proxy with pm2 and get load balancing, cluster mode, watch & reload, and live metrics.

First, install pm2 and coin-hive-stratum:

npm i -g pm2 coin-hive-stratum

Then, create a proxy.js file:

const Proxy = require("coin-hive-stratum");
const proxy = new Proxy({
  host: "pool.supportxmr.com",
  port: 3333
});
proxy.listen(8892);

If you want to access your proxy via wss:// you will need to pass a private key and certificate files.

You can use Certbot to generate the certificates:

certbot certonly --manual -d youdomain.com

Follow the steps and then just use those certificates in your proxy:

const Proxy = require("coin-hive-stratum");
const proxy = new Proxy({
  host: "pool.supportxmr.com",
  port: 3333,
  key: require("fs").readFileSync("/etc/letsencrypt/live/yourdomain.com/privkey.pem"),
  cert: require("fs").readFileSync("/etc/letsencrypt/live/yourdomain.com/fullchain.pem")
});
proxy.listen(8892);

Finally, run the proxy using pm2:

pm2 start proxy.js --name=proxy --log-date-format="YYYY-MM-DD HH:mm"

Now you can monitor your proxy, see the logs and metrics like online miners, submitted shares, etc, using this command:

pm2 monit

To stop the proxy use this:

pm2 stop proxy