Learn how to prepare your external adapter for serverless executionPublished 21st February 2019 • Updated 21st February 2019
In order to use serverless execution, such as AWS Lambda and GCP cloud functions, you need to prepare your external adapter. This mainly consists of installing dependencies for the adapter and placing it in a zip file.
Please note that each individual adapter could have a different process for preparing for AWS/GCP, and this guide should only serve as a way to get familiar with what is happening. Adapters are written in different programming languages too, which require some different steps. We will cover some of the most common languages: NodeJS and Python.
For this example we will use OracleFinder.com's CoinMarketCap adapter, which can be found at https://github.com/OracleFinder/CMCExternalAdapter. If you want to use a different adapter, just change the github URL and any names referencing CMCExternalAdapter in this guide.
Start out by downloading the adapter. There are many different ways to do this – use the method you are most comfortable with!
git clone https://github.com/OracleFinder/CMCExternalAdapter
When you have downloaded the adapter, enter the folder/directory you have it downloaded to:
$ cd CMCExternalAdapter/
CMCExternalAdapterwith the folder you downloaded/unzipped it to. If you chose the "download zip" method, it would likely just be called
At this point, things can change based on which programming language the adapter was made in. For our example adapter, we will continue to NodeJS. If your adapter does not use NodeJS, jump to the appropriate language below:
For Node.js, we need to use NPM to install our dependencies. To get NPM, please install Node.js here: https://nodejs.org/en/.
Once you have Node.JS installed, run:
When that has completed, zip up your folder:
zip -r chainlink-cloud-adapter.zip .
That's it, your adapter is ready for the cloud! You can now upload the zip file you created to AWS Lambda or GCP cloud functions.