Running the agent on GCP
The Airplane agent can be deployed to GCP through running containers on VMs. The following instructions provide a quick way to create an instance group from the command line.
Support for deploying to GCP via Terraform is coming soon. If you'd like to use Terraform, please let us know!
To follow the installation instructions below, you'll need the following values:
YOUR_API_TOKEN
: generate a new token by runningairplane apikeys create <token name>
from the Airplane CLI.YOUR_TEAM_ID
: get your team ID viaairplane auth info
or visit the Team Settings page.
Creating a managed instance group
To install the agent on GCP, we'll be creating managed instance groups running the Airplane
agent Docker image: us-docker.pkg.dev/airplane-prod/public/agent:1
. (See the GCP docs for
additional details on
deploying the container
and
rolling out updates.)
First, create an instance template defining the instance properties. Note that you'll need to
give the template a unique name (e.g. airplane-agent-SOME_NUMBER
) and fill in YOUR_API_TOKEN
and YOUR_TEAM_ID
.
bashCopied1gcloud compute instance-templates create-with-container airplane-agent-0 \2--container-image us-docker.pkg.dev/airplane-prod/public/agent:1 \3--container-privileged \4--container-env \5AP_API_TOKEN=YOUR_API_TOKEN,AP_TEAM_ID=YOUR_TEAM_ID,AP_LABELS="cloud:gcp" \6--container-mount-host-path \7mount-path=/var/run/docker.sock,host-path=/var/run/docker.sock,mode=rw \8--boot-disk-size 256GB
Setting the AP_LABELS
environment variable will add the provided labels to the agent for use in
run constraints. For details on using labels, see
Execute rules & constraints.
Next, create an instance group with that template:
bashCopied1gcloud compute instance-groups managed create airplane-agents \2--base-instance-name airplane-agent \3--size 2 \4--template airplane-agent-0
That's it! You can visit your Instance groups to see the new group start launching instances.
After a few minutes, you should be able to see the new agents appear at https://app.airplane.dev/agents.
Updating a managed instance group
To pull in the latest version of the agent image, you simply need to recycle the instances by performing a rolling replace.
Copied1gcloud compute instance-groups managed rolling-action replace airplane-agents
If you need to update the instance template, create a new one (e.g. airplane-agent-1
):
Copied1gcloud compute instance-templates create-with-container airplane-agent-1 \2# Your other settings here
And update using the Instance Group updater:
Copied1gcloud compute instance-groups managed rolling-action \2start-update airplane-agents \3--version=template=airplane-agent-1