This repository helps you install a high-available pool of chainlink nodes on Google Cloud Platform, running on Kubernetes. The setup follows the best practices put forward by the Chainlink documentation.
In order to have a smooth installation, it is assumed you have created a project on Google Cloud Platform and have installed and authenticated the Google Cloud SDK on your local machine.
Make sure you can run the following command to validate gcloud is installed correctly and you are authenticated with the correct Google account:
gcloud auth list
You will also need to install Terraform. This setup has been tested with version 0.14.9
. Run the following to confirm your version:
terraform version
If you installed the deployment with container version 0.7.5
, you need to upgrade to chainlink version 0.9.10
first before upgrading to version 0.10.3
in order to run migrations.
While all steps have been tested on Mac OS X 11.2.3 Big Sur, they should be portable to any other OS capable of running Terraform and the Google Cloud SDK.
We'll need the files in this repo, so go ahead and clone it to your local machine. If you're unfamiliar with git, download a ZIP of this repo and extract it.
git clone https://github.com/Pega88/chainlink-gcp
cd chainlink-gcp
Follow Google's documentation and create a new project and enable billing on the project. Remember the project id you chose.
Run the setup.sh
script passing 2 paramters:
- the project id of the project you created (not the project name). If you are unsure, you can run
gcloud projects list
to get the list of your projects ids. - the email address you wish to use for your Chainlink Node login. A password will be generated and shown as output of the script.
for example
sh setup.sh chainlink-dryrun-3 admin@gmail.com
This script will prepare the environment for you with the following steps. Please have 10 minutes patience for it to complete. While this script is an easy onboarding into running a Chainlink node on Kubernetes in Google Cloud, it is recommended to digest the script and adapt the Terraform code to own needs, as well as configuring a remote backend (e.g. Google Cloud Storage bucket). Therefore, this repository should be used as a quickstart and not as a production-ready deployment.
- Create Google Service Account & Generate Key
- Grant Service Account access to create required resources
- Run terraform
The terraform code will:
- Create a Google Kubernetes Engine Cluster on Google Cloud
- Create a
chainlink
namespace - Deploy a postgres database in the cluster
- Deploy a Chainlink Node in the cluster
- Expose the Node using a HTTP L7 Google Cloud Global Load Balancer
To read more about the advantages of this GCLB, please visit the docs.
If you are live following the deployment from the Google Cloud Console, be aware it's expected to have pending pods or restart loops, as the chainlink node requires the postgres database to be fully initialized first. Terraform will only return when everything is fully functional, so please be patient.
The output of the script will provide you with an IP address, a chainlink node password (api-credentials) and a wallet password for your ethereum wallet of the node.
Visit the IP address to login using the email address you provided before and the password shown in the output. Please note that it can take up to 20 minutes for Google to fully provision the Load Balancer. In the meantime you can get 502 and 404 errors.
Expected output should look as follows: