Quickstart

Preparation

Prerequisite

$ curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ sudo npm install -g @angular/cli

Configuration

Configure RPC

$ echo "export const nodeRpc1 = 'http://localhost:1317';" > src/config.js 
$ echo "export const nodeRpc2 = 'http://localhost:26657';" >> src/config.js 
$ echo "export const nodeWs = 'http://localhost:26657/websocket';" >> src/config.js 

Bundle Project

$ npm run bundle

Configure Proxy via Nginx (CORS)

# websocket
location /node/websocket {
  proxy_pass http://localhost:26657/websocket;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
}
# rpc1
location /node/rpc1 {
  add_header "Access-Control-Allow-Origin"  * always;

  if ($request_method = OPTIONS ) {
    add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
    add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
    return 200;
  }
  proxy_pass http://localhost:1317/;
}
# rpc2
location /node/rpc2 {
  add_header "Access-Control-Allow-Origin"  * always;

  if ($request_method = OPTIONS ) {
    add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
    add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
    return 200;
  }
  proxy_pass http://localhost:26657/;
}

Deploy

Method 1 – from source

$ git clone https://github.com/jim380/irisnet-explorer
$ cd irisnet-explorer
$ sudo npm i
$ ng serve

Method 2 – via docker

$ git clone https://github.com/jim380/irisnet-explorer
$ cd irisnet-explorer
$ docker build -t <image_name> .
$ docker run -i -v ${PWD}:/usr/src/<image_name> -v /usr/src/<image_name>/node_modules -p 4200:4200 --name <image_name> <container_name>

Open http://localhost:4200 in your browser to see the app in action.