Skip to content

Latest commit

 

History

History
124 lines (86 loc) · 2.67 KB

INSTALL.brc20.psql.ubuntu.md

File metadata and controls

124 lines (86 loc) · 2.67 KB

Detailed Installation Guide for OPI Light Client on Ubuntu 22.04

Installing PostgreSQL

  1. First install and run postgresql binaries.
sudo apt update
sudo apt install postgresql postgresql-contrib -y
sudo systemctl start postgresql.service
  1. Set some optional parameters, this step is optional.
sudo -u postgres psql -c "ALTER SYSTEM SET listen_addresses TO '*';"
sudo -u postgres psql -c "ALTER SYSTEM SET max_connections TO 2000;"
  1. Set the password for default user. Replace <password> with your password. (do not use ! in password, it may interfere with shell escape)
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '<password>';"
  1. Restart postgres service to apply new configuration.
sudo systemctl restart postgresql

Installing Python Libraries

  1. Install pip if you don't have it. guide.
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
rm get-pip.py

or

sudo apt update
sudo apt install python3-pip
  1. Install dependencies
python3 -m pip install python-dotenv;
python3 -m pip install psycopg2-binary;
python3 -m pip install buidl;

On some systems, requests is not installed by default. If you get "requests" not found error while running the client, run this:

python3 -m pip install requests;

Setup Light Client

  1. Download files, restore DB from last backup
git clone https://github.com/bestinslot-xyz/OPI-LC.git
cd OPI-LC/brc20/psql
wget http://s3.opi.network:9000/opi-light-client-files/db_4/light_client_brc20_last.dump
sudo -u postgres pg_restore -U postgres -Fc -d postgres < light_client_brc20_last.dump
rm light_client_brc20_last.dump
  1. Run initialise_psql.py to initialise .env config
python3 initialise_psql.py

Run OPI Light-Client

python3 brc20_light_client_psql.py

(Optional) Setup API

Installing NodeJS

These steps are following the guide at here.

sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

sudo apt-get update
sudo apt-get install nodejs -y

Installing node modules

cd OPI-LC/brc20/api; npm install;

Setup API

Run initialise_api.py to initialise .env config

python3 initialise_api.py

Run API

node api.js