Running a Chainlink Node on MacOS
This document will walk through the steps to get a Chainlink node running locally using Docker on Mac OS in a few steps.
Note: replace any values [LIKE_THIS] with the appropriate value
Create The Docker Environment
-
Create a directory to house the image and settings
mkdir chainlink-kovan cd chainlink-kovan
Within this directory you need a few files.
-
Create
.env
โ this will house the docker environment variables for the Chainlink NodeROOT=/chainlink LOG_LEVEL=debug ETH_CHAIN_ID=42 MIN_OUTGOING_CONFIRMATIONS=2 LINK_CONTRACT_ADDRESS=0xa36085F69e2889c224210F603D836748e7dC0088 CHAINLINK_TLS_PORT=0 SECURE_COOKIES=false GAS_UPDATER_ENABLED=true ALLOW_ORIGINS=* ETH_URL=wss://eth-kovan.alchemyapi.io/v2/[YOUR_API_KEY] DATABASE_URL=postgresql://postgres:[PG_PASSWORD]@[DOCKER_IMAGE]:5432/chainlink?sslmode=disable DATABASE_TIMEOUT=0
๐
[YOUR_API_KEY]
can be found via alchemy -
Create
database.env
โ this will house the docker environment variables for the PostgreSQL NodePOSTGRES_USER=postgres POSTGRES_PASSWORD=[PG_PASSWORD] POSTGRES_DB=chainlink
-
Create
docker-compose.yml
โ this will house the configuration for your docker images.version: '3' services: pg_chainlink: image: "postgres" ports: - "5432:5432" env_file: - database.env volumes: - [PATH_TO_POSTGRES_DATA]:/var/lib/postgressql/data/ chainlink: image: "smartcontract/chainlink:[CURRENT_VERSION]" env_file: .env depends_on: - pg_chainlink ports: - "6688:6688" volumes: - [PATH_TO_CHAINLINK_VOLUME]:/chainlink/ command: node start --password /chainlink/password.txt --api /chainlink/apicredentials.txt
[PATH_TO_POSTGRES_DATA]
is the location of the PostgreSQL data directory. For me it is:/Library/PostgreSQL/14/data
[PATH_TO_CHAINLINK_VOLUME]
should be a directory that will house a few more items. I created it withinchainlink-kovan
mkdir chainlink-volume cd chainlink-volume pwd
Use the results and use that for
[PATH_TO_CHAINLINK_VOLUME]
-
While still in the chainlink-volume create a few files In
password.txt
add, feel free to change the passwordsecret
In
apicredentials.txt
add, this will be the username and password for the web UIyour-email@address.com password
Prep Docker
- Add the PostgreSQL and Chainlink volumes to docker
Start docker
-
Run
docker compose up
You will see the following error
This is expected. The database for PostgreSQL has not been created
-
Create the PostgreSQL database for chainlink
-
Stop docker if itโs still running
ctrl-c
and re-rundocker compose up
You should see a flurry of activity and something like this ๐
Now that your node is running, open the operator interface.
Open the operator interface
-
Head to http://localhost:6688
-
Login with the credentials you set in
apicredentials.txt