Run your own Chainlink developer Node with Okteto

Hello Everyone,

Jeevanjot Singh
5 min readOct 4, 2020

Today’s Objective is to run Chainlink own development environment with Okteto

Okteto cloud is a cloud-native platform to make suitable development environments without the need of installing any dependency on the local machine.

Chainlink network provides your smart contract power to interact with outside Ethereum Chain services (Through APIs).

To learn more please visit their appropriate Websites.

To start we need Okteto cloud account that you can get if you have a GitHub account and their free tier provide more than enough resources required to run a single Chainlink Node.

Prerequisite

Setup Database

Go to https://cloud.okteto.com/ then click Deploy

Change your Configs Accordingly

After Deploying you will have your own Postgres database running with enough amount require to run Chainlink Node.

Setup Chainlink Node Container

Now it’s time to have your own Chainlink Node Running to serve your requests for development purposes.

Create a new Directory

Create a new directory and start terminal in that directory, I am using Powershell, After that run this command in the terminal and choose other.

okteto init

You will have these files (above image) in your directory after that

Let’s work on Okteto Manifest

Okteto.yml defines all the configurations that will create your pod. Remove Existing content in Okteto.yml and change it like below

name: chainlinkimage: smartcontract/chainlink:latestcommand:  - bashworkdir: /appforward:  - 6689:6688remote: 22003persistentVolume:enabled: true

Start Chainlink Node

Create a new file to define Chainlink Node Configs name .env in this file add the following text.

That’s for Kovan Testnet

ROOT=/chainlink
LOG_LEVEL=debug
ETH_CHAIN_ID=42
MIN_OUTGOING_CONFIRMATIONS=2
LINK_CONTRACT_ADDRESS=0xa36085F69e2889c224210F603D836748e7dC0088
SECURE_COOKIES=false
CHAINLINK_TLS_PORT=0
GAS_UPDATER_ENABLED=true
ALLOW_ORIGINS=*
CHAINLINK_PORT=6688
ETH_URL=wss://kovan.infura.io/ws/v3/<project_id>
DATABASE_URL=postgresql://username:password@<db_string>:5432/db_name?sslmode=disable
DATABASE_TIMEOUT=0
TX_ATTEMPT_LIMIT=-1
MINIMUM_CONTRACT_PAYMENT=10000000000000000

Some important definitions:

  • ETH_CHAIN_ID is the chain id that we use, For Kovan it is 42 for Mainnet it is 1
  • LINK_CONTRACT_ADDRESS it represent the LINK token address in the Kovan network 0xa36085F69e2889c224210F603D836748e7dC0088
  • ETH_URL is the WebSocket supported endpoint of your node, Or if not your own node then Infura has a free quota to obtain which I am using, Copy WSS protocol URL and paste it in this place.
  • DATABASE_URL is used to provide access to the database that chainlink can use. Please fill this very carefully.
username:password

username and password you can get when you defined your config while deploying the database (See Setup Database Section), Or click on Redeploy to see them(But don’t Redeploy it).

<db_string>

Get your database string on the okteto cloud logs panel

:5432

For Port Number that is the default port

/db_name

After slash, it is required to add your database name which you can check just like the username/password in the configs.

sslmode=disable

The above query with the string is required.

Run Chainlink Node

And now we should be ready to Start our Container and run our job use

okteto up

This will create and start your new development environment that will forward port 6689 to 6688 of your cloud environment (according to our okteto.yml) and sync the directory files with the cloud app directory as per our okteto.yml.

If you don’t see any output for some time then press return key or something in the terminal

Now Run

chainlink local n

This will do all DB operations for you to create schemas and lock it up etc.

If the first time, it will ask you to setup Passwords, Email, etc.

Visit Chainlink Dashboard

Now that everything should be running. You can visit chainlink dashboard with http://localhost:6689/signin

Since our 6689 port is forwarded to cloud-hosted container.

Add your email and password to it and after that, we have a running chainlink node here for developing smart contracts to server oracle requests.

Remember that if you close your terminal running right now then the node will stop too.

To keep it running you have to set it up with a docker image and make sure to store all your password and API email etc. files to run it without needing any input at the start. To make a match up for this soltution visit https://docs.chain.link/docs/miscellaneous#use-password-and-api-files-on-startup and this example https://github.com/okteto/movies/blob/master/api/Dockerfile but instead of running movies you have to run chainlink local n (command)

--

--