Deploying Airnode
After integrating an API (API Integration) and creating the configuration files (Configuring Airnode), the next step is to deploy the Airnode.
Deploy with Docker
The recommended way to deploy Airnode is by using the Docker deployer image. This image is simply a wrapper around the deployer CLI. Try the Deploying an Airnode on AWS tutorial if you wish to become familiar with the deployer image first. There are also tutorials for GCP and a client Docker container as well as several repo based examples in the Airnode monorepo example package.
The deployer interacts with a cloud provider to deploy Airnode programmatically, without requiring you to click through a lot of ever-changing graphical interfaces. For it to do so, a cloud project setup and credentials are required and was discussed in Configuring an Airnode. There is additional guidance in the AWS and GCP quick start tutorials mentioned above.
Install Docker
The deployer image is containerized as a Docker image. This will deploy the Airnode to the cloud provider without the worry of installing dependencies and is the recommended way to do a deployment. If you do not already have docker installed go to the Docker website and install it.
Deployment
At this point a project should resemble the following. The config.json
, secrets.env
, aws.env
(if deploying to AWS) and gcp.json
(if deploying to GCP) files should be ready to go. Other files and folders added to the project are expected and are ignored by the deployer image.
my-airnode
├── aws.env
├── config.json
└── secrets.env
2
3
4
my-airnode
├── config.json
├── gcp.json
└── secrets.env
2
3
4
Warning about simultaneous deployments
Avoid running multiple deployments simultaneously as doing so might result in a broken deployment. If this occurs, the standard removal approach may not succeed and Manual Removal may be required.
From the root of the project directory run the Docker image command deploy as shown below to deploy the Airnode. When the deployment has completed a receipt.json
file will be written to the project directory, which is mounted to the /app/config
directory within the container. This file contains important configuration information about the Airnode and is needed to remove the Airnode should the need arise.
Normally (for Linux/Mac/WSL2) the deployer image deploy
command is run by the user root. This may cause permission issues when the receipt.json
file is generated. Optionally you can specify the UID (user identifier) and GID (group identifier) that the deployer image should use. Do so by setting the environment variables USER_ID and GROUP_ID, otherwise omit the line containing the variables.
docker run -it --rm \
-e USER_ID=$(id -u) -e GROUP_ID=$(id -g) \
-v "$(pwd):/app/config" \
api3/airnode-deployer:0.14.1 deploy
2
3
4
# For Windows, use CMD (not PowerShell).
docker run -it --rm ^
-v "%cd%:/app/config" ^
api3/airnode-deployer:0.14.1 deploy
2
3
4
receipt.json
The receipt.json
file is a product of a deployment attempt. It contains Airnode configuration and deployment information and is used to remove the Airnode. The field success
is important in that it specifies whether the deployment was successful or not.
{
"airnodeWallet": {
"airnodeAddress": "0xaBd9daAdf32fCd96eE4607bf3d5B31e19a244Cac",
"xpub": "xpub661MyMwAqRbcGHp9uC7...vbeziJwFHuNs"
},
"deployment": {
"deploymentId": "aws8fd2e911",
"cloudProvider": {
"type": "aws",
"region": "us-east-1",
"disableConcurrencyReservations": false
},
"stage": "dev",
"nodeVersion": "0.14.1",
"timestamp": "2022-03-26T02:37:55.506Z"
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Testing with HTTP Gateway
If you opted to enable the HTTP Gateway it can be used to test the Airnode while bypassing the chain it was deployed to. There are examples that detail how to do this.
- HTTP Gateways
- Deploying an Airnode on AWS
- Deploying an Airnode on GCP
- Deploying an Airnode locally using Docker
Make an RRP request of the Airnode
Once the Airnode is deployed, see Calling an Airnode to learn how requests are made using the request-response protocol (RRP).
Removing the Airnode
If you would like to remove a deployed Airnode, see the Docker image commands for remove or remove-with-receipt instructions.
FLEX_END_TAG