Skip to content

Running Insight in Production

Eric Martindale edited this page Mar 29, 2015 · 2 revisions

Once you've run Insight in development, you might want to use it for a production service. There are many ways to do this, and ultimate the choice on how to do so will be up to you.

I use a process called pm2 to manage many productions sites, as it adds logging, automatic restarts, and many other useful features that you don't want to have to roll on your own. You can install it on any system using npm: npm install pm2 -g – it gives you an option to get a nice fancy dashboard, too:

fancy pm2 dashboard with keymetrics

Once Insight is installed and configured, here's how to start it – run this from inside your insight root folder:

INSIGHT_NETWORK=livenet BITCOIND_USER=someuser BITCOIND_PASS=somepass INSIGHT_PUBLIC_PATH=public pm2 start node_modules/.bin/insight-bitcore-api --name insight

Make sure to correct BITCOIND_USER and BITCOIND_PASS to reflect your changes. You'll now see insight running:

┌───────────────────┬────┬──────┬───────┬─────────┬─────────┬────────┬──────────────┬──────────┐
│ App name          │ id │ mode │ pid   │ status  │ restart │ uptime │ memory       │ watching │
├───────────────────┼────┼──────┼───────┼─────────┼─────────┼────────┼──────────────┼──────────┤
│ insight           │  0 │ fork │ 28409 │ online  │ 0       │ 5m     │ 87.844 MB    │ disabled │
└───────────────────┴────┴──────┴───────┴─────────┴─────────┴────────┴──────────────┴──────────┘

It will be listening on port 3000 by default, but I'll assume you've already configured a reverse proxy for this. Enjoy!

Clone this wiki locally