[1] Google Cloud SDK installed
[2] GCP Account & Project Created
[3] Docker installed locally
-
Install Terraform. After installation, run
terraform --version
to ensure it works. -
Install Terragrunt. After installation, run
terragrunt --version
to ensure it works. -
[Prepare Google Cloud SDK]
Login to Google Cloud SDK to allow terragrunt & terraform access
gcloud auth application-default login
Enable depedent GCP services
gcloud services enable containerregistry.googleapis.com
gcloud auth configure-docker
Within Google Cloud SDK:
docker pull public.ecr.aws/chainlink/adapters/coingecko-adapter:1.9.1
docker tag public.ecr.aws/chainlink/adapters/coingecko-adapter:1.9.1 gcr.io/chainlink-test-external-adapter/docker/coingecko-adapter:1.9.1
docker push gcr.io/chainlink-test-external-adapter/docker/coingecko-adapter:1.9.1
- If the GCS bucket does not exist yet, run this once:
terragrunt init --terragrunt-working-dir="C:\your\local\directory\path\Terragrunt-Chainlink-External-Adapter-GCP-Cloud-Run" --terragrunt-non-interactive
Note: Once the GCS bucket is created, there is no need to run this command again.
- To determine changes needed to be applied to the infrastructure:
terragrunt run-all plan --terragrunt-working-dir="C:\your\local\directory\path\Terragrunt-Chainlink-External-Adapter-GCP-Cloud-Run" --terragrunt-non-interactive
- To provision the entire infrastructure by running each module and resolving any module dependencies:
terragrunt apply-all --terragrunt-working-dir="C:\your\local\directory\path\Terragrunt-Chainlink-External-Adapter-GCP-Cloud-Run" --terragrunt-non-interactive
- To deprovision the entire infrastructure:
terragrunt destroy-all --terragrunt-working-dir="C:\your\local\directory\path\Terragrunt-Chainlink-External-Adapter-GCP-Cloud-Run" --terragrunt-non-interactive
Test the cloud run URL
curl --header "Content-Type: application/json" -d '{"id":"2","data": {"base": "LINK", "to": "USD"}}' https://output-trigger-url
The Coingecko External Adapter is now ready to be added to a Chainlink Server via:
GUI http://localhost:6688
-> Bridge -> New Bridge
This repo can be cloned and Terragrunt related commands to be executed automatically on pushes/updates to the main/master branch with Github Actions. To implement this change the module source to your github cloned repo, and add your GCP projects service account key (flattened, e.g. single line) json file to your Github Repo's secrets:
key=GOOGLE_CREDENTIALS
value=flattened single line .json contents
[1] https://cloud.google.com/container-registry/docs/quickstart?hl=en-GB
[2] https://github.com/smartcontractkit/external-adapters-js/tree/develop/packages/sources/coingecko
[3] https://gallery.ecr.aws/chainlink/adapters/coingecko-adapter
[4] https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_service
[5] https://www.terraform.io/language/modules/sources#generic-git-repository