Skip to content

oxor-io/debridge-launcher

 
 

Repository files navigation

This repo allows to setup the oracles for few chains quickly with the same credentials. In order to set up a node on the DeBridge network, we need to:

1) Install prerequisite packages on your VM:

  1. docker - https://docs.docker.com/engine/install/ubuntu/
  2. docker-compose - https://docs.docker.com/compose/install/
  3. nodejs - https://github.com/nodesource/distributions/blob/master/README.md
  4. psql sudo apt-get install postgresql-client

2) Set up the Chainlink environment:

  1. Install full testnet nodes
  1. Set ETH_URL (use the Websocket Endpoints) in each of the following files: chainlink-eth.env, chainlink-bsc.env, chainlink-heco.env
  2. Set support chainlink configs(chainid, debridgeaddr, provider, interval) to ./initiator/config/chains_config.json
  3. Change default (postgreschainlink) postgress password in .env.
  4. Create the apicredentials file with your desired chainlink email and password. example docs. After that, we need to change CHAINLINK_EMAIL, CHAINLINK_PASSWORD in initiator/.env to match the information written in the apicredentials file.
  5. Now, we're going to need to create a keystore for our node, based on a private key. We have script in folder generate-keystore. To start generate new keystore info
  • npm i
  • node index.js

Script will show new generated ethereum address, private key, password for keystore and keystore info. You need to copy pasword to password.txt, keystore info to /secrets/keystore.json

  1. Put the keystore file under secrets/keystore.json.
  2. Store the password that decrypts the key from keystore in the password.txt file.
  3. Make your oracle-operator address to be whitelisted by deBridge governance (contact the DeBridge team for that)
  4. Run the command docker-compose up --build -d.
  5. Run the script to create the initiators and prepare the jobs and store main configurations in the database:
bash chainlink-init-scripts/setup-initiators-and-jobs.sh
  1. Run the command docker-compose restart initiator.
  2. If you want to start multiple instances on one server or one postgresql you can do this:
  • checkout or copy repo to new directory
  • change DOCKER_ID variable in .env
  • start as previously described

Use separate apicredentials

  1. create several apicredentials like apicredentials-bsc and apicredentials-heco
  2. create several secrets in docker-compose.conf
  3. change start arguments(entrypoint) and secrets of docker-compose chainlink config
  4. create initiator/config/credentials.json with custom credentials(please see example initiator/config/credentials_example.json)

Add new chain support

  1. Create and configure chainlink-[{CHAIN_TICKER}].env. At least the followed params should be added:
ROOT
ETH_CHAIN_ID
LINK_CONTRACT_ADDRESS
CHAINLINK_TLS_PORT
SECURE_COOKIES
GAS_UPDATER_ENABLED
ALLOW_ORIGINS
ETH_URL
CHAINLINK_BASEURL
FEATURE_EXTERNAL_INITIATORS
CHAINLINK_DEV
CHAINLINK_PORT
CLIENT_NODE_URL

For more details, see the docs

  1. Add the container to the docker-compose.yml
  chainlink-[{CHAIN_TICKER}]:
    container_name: chainlink-[{CHAIN_TICKER}]${DOCKER_ID}
    image: smartcontract/chainlink:0.10.2
    entrypoint: /bin/sh -c "chainlink node import /run/secrets/keystore && chainlink node start -d -p /run/secrets/node_password -a /run/secrets/apicredentials"
    restart: always
    env_file:
      - chainlink-[{CHAIN_TICKER}].env
    environment:
      - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${HECO_DATABASE}?sslmode=disable
    secrets:
      - node_password
      - apicredentials
      - keystore
    depends_on:
      - postgres
    networks:
      - chainlink
  1. Add the new database name specified in DATABASE_URL to .env at the end of POSTGRES_MULTIPLE_DATABASES using coma separator.

Note: if the database already exist the scrypt that creates the database won't be run. So the database either should be created manually or the volume with previous database can be removed:

docker volume rm pgdata

See Initialization scripts section in docs.

  1. Run the command docker-compose up.

  2. Extend setup-initiators-and-jobs.sh. Add to the end of the file:

echo "Add initiator for $NETWORK"
network=[[NETWORK_NAME]]
chain_id=[[NETWORK_CHAIN_ID]]
container_name=$(docker-compose ps | grep [[NETWORK_NAME]] | awk '{print $1}')
cl_url="http://$container_name:6688"
add_initiator $network

echo "Add jobs for $NETWORK"
add_jobs $network

echo "Prepare table for $NETWORK ie"
create_ei_table $chain_id $cl_url $network

echo "Add record for $NETWORK ie"
add_record $network

Miscellaneous

Connect to the database(if you use docker-compose):

docker exec -it $(docker-compose ps | grep postgres | awk '{print $1}') psql -v ON_ERROR_STOP=1 --username postgres -d $DATABASE_NAME

Mandatory for monitoring

  1. Basic monitoring of the server/virtual machine(cpu, memory, disk space).
  2. Availability check(may be connectivity):
  • all of full nodes(heco, bsc, etc). It is also good to check the synchronization status
  • database
  • initiator and chainlinks
  1. Strongly recommend to check docker-compose logs for ERROR.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 70.2%
  • Shell 29.3%
  • Dockerfile 0.5%