Chainlink Python Serverless External Adapter Template

Overview

Chainlink Python Serverless External Adapter Template

Lint and unit testing

This template shows a basic usecase of an external adapter written in Python for the CryptoCompare API. It can be ran locally, in Docker, AWS Lambda, or GCP Functions.

Install

pipenv install

Test

pipenv run pytest

Run with Docker

Build the image

docker build . -t cl-ea

Run the container

docker run -it -p 8080:8080 cl-ea

Run with Serverless

Create the zip

pipenv lock -r > requirements.txt
pipenv run pip install -r requirements.txt -t ./package
pipenv run python -m zipfile -c cl-ea.zip main.py adapter.py bridge.py ./package/*

Install to AWS Lambda

  • In Lambda Functions, create function
  • On the Create function page:
    • Give the function a name
    • Use Python 3.7 for the runtime
    • Choose an existing role or create a new one
    • Click Create Function
  • Under Function code, select "Upload a .zip file" from the Code entry type drop-down
  • Click Upload and select the cl-ea.zip file
  • Change the Handler to main.lambda_handler
  • Save

To Set Up an API Gateway

An API Gateway is necessary for the function to be called by external services.

  • Click Add Trigger
  • Select API Gateway in Trigger configuration
  • Under API, click Create an API
  • Choose REST API
  • Select the security for the API
  • Click Add
  • Click the API Gateway trigger
  • Click the name of the trigger (this is a link, a new window opens)
  • Click Integration Request
  • Uncheck Use Lamba Proxy integration
  • Click OK on the two dialogs
  • Return to your function
  • Remove the API Gateway and Save
  • Click Add Trigger and use the same API Gateway
  • Select the deployment stage and security
  • Click Add

Install to Google Cloud Funcions

  • In Functions, create a new function
  • Use HTTP for the Trigger
  • Optionally check the box to allow unauthenticated invocations
  • Choose ZIP upload under Source Code
  • Use Python 3.7 for the runtime
  • Click Browse and select the cl-ea.zip file
  • Select a Storage Bucket to keep the zip in
  • Function to execute: gcs_handler
  • Click Create
Owner
Chainlink Hackathon - Insureblox
Chainlink Hackathon - Insureblox
Python Serverless Microframework for AWS

AWS Chalice Chalice is a framework for writing serverless apps in python. It allows you to quickly create and deploy applications that use AWS Lambda.

Amazon Web Services 9.4k Jan 08, 2023
Serverless Public Key Infrastructure Framework

Ottr: Serverless Public Key Infrastructure Framework Ottr is a serverless framework for Public Key Infrastructure (PKI) that aims to provide a robust

Airbnb 259 Dec 28, 2022
Chainlink Python Serverless External Adapter Template

This template shows a basic usecase of an external adapter written in Python for the CryptoCompare API. It can be ran locally, in Docker, AWS Lambda, or GCP Functions.

Chainlink Hackathon - Insureblox 1 Nov 17, 2021
Zappa makes it super easy to build and deploy server-less, event-driven Python applications on AWS Lambda + API Gateway.

Zappa makes it super easy to build and deploy server-less, event-driven Python applications (including, but not limited to, WSGI web apps) on AWS Lambda + API Gateway. Think of it as "serverless" web

Zappa 2.2k Jan 09, 2023
Serverless console based chat program made with PyDrive2.

Nautilus Serverless console based chat program made with PyDrive2. How To Use: After installing the program files from GitHub, they can be put anywher

legitimately_the_1984th_year_of_the_common_era_&_anno_domini_designations 0 Jul 30, 2022
⚡ Serverless Framework – Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions

⚡ Serverless Framework – Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more! –

Serverless 44k Jan 03, 2023
Serverless function for replicating weather underground data to an influxDB database

Weather Underground → Influx DB 🌤 Serverless function for replicating Weather U

Ben Meier 1 Dec 30, 2021
Repository for Research Paper: Serverless Thumbnail Generation

Serverless deployment on IBM Cloud Code Engine that uses the Lithops Framework to process images in parallel

Luca Mueller 2 Jan 12, 2022
Portfolio-tracker - This serverless application let's you keep track of your investment portfolios

Portfolio-tracker - This serverless application let's you keep track of your investment portfolios

José Coelho 1 Jan 23, 2022