NEX Deployment

Steps to deploy the NEX for production on chain:

1. Prerequisites

Install the build dependencies on Linux using apt-get command line tool. It is the tool which helps in handling the packages in Linux. The main purpose of the tool is to retrieve the information and packages from an authenticated source for installation, upgrade, and removal of packages with dependencies.

$ apt-get update 

// update the package index files on the system, display information about available package, version.
$ apt-get install build-essential nasm

// Install the build to compile software

2. Installation

Node v16+ is required and it can be installed using nvm following the below instruction

Installing & updating

To install or update nvm run the install script. There are many ways to install, download and run the script manually, or use cURL or Wget command

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

Running either of the above commands download the script and run it. The script clones the nvm repository to ~/.nvm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).

Command to load the nvm is given below

Click the below link to learn in detail about the nvm installation, troubleshooting, and usage

Check whether you are in the application's root directory and then install app dependencies:

To install node using nvm

The script create a nvm repository and it will be used for cloning.

Clone the repository created by using the below command:

If the user creates a node in their own network, then <branch name> has to given by the User. By default, the branch name will be the production branch name.

Install npm using the below command

3. ENV configuration

Create a file name .env in the root of the repository:

In the .env file update the required details,

Example code to fill the .env file,

If the NEXT_PUBLIC_DEFAULT_CHAIN_ID is not equal to mainnet chain id (6b6b5f0ce7a36d323768e534f3edb41c6d6332a541a95725b98e28d140850134), then the app will use testnet nodes.

4. Node list

The node list has the collection of nodes and their respective region. If the user has created a node in their own network, then the information has to be updated to the nodeslist.ts file.

The file is available in the location: /src/api/params/nodesList.ts

nodesList.ts

The User has to add their node and region in the file. An example is shown below,

5. Manual starting after installation and ENV configuration

Development

Open http://localhost:3000 with your browser to see the results.

Production

Install pm2 globally

Make sure you are in the application's root directory,

A. Build production distribution

B. Serve the application

Now, the application is ready to be used.

6. NGINX configuration - Example configuration to create Proxy

Click the below link to have a glance at the readme.md file to check the steps

https://gitlab.com/PBSA/NEX/-/blob/main/README.md

Glossary

Glossary
Description

APT

Advanced Packaging Tool

Build Essential

Form of meta packages that are essential to compile software.

nvm

Node version manager for node.js designed to be installed per-user and invoked per-shell.

nasm

Netwide Assembler, a portable 80x80 assembler

pm2

PM2 is a node.js process manager that comes with a built-in load balancer. It helps facilitate production deployments and enables you to keep running applications alive indefinitely.

NGINX

NGINX is open source software for web serving, reverse proxying, caching, load balancing, media streaming, and more. It started out as a web server designed for maximum performance and stability.

Last updated

Was this helpful?