This repository contains a template for deploying WarpStream Agents to fly.io.
- Sign up for a WarpStream account.
- Sign up for a fly.io account and download flyctl.
- Clone this repository and cd into it.
- Review and edit
fly.toml
to fill in your specific details. At the very least you should:- Pick a name for your WarpStream cluster and put it in the value of
app
. - Edit
WARPSTREAM_DISCOVERY_KAFKA_HOSTNAME_OVERRIDE
to use the same value asapp
. For example if yourapp
name iswarpstream_fly_123
then the value ofWARPSTREAM_DISCOVERY_KAFKA_HOSTNAME_OVERRIDE
should bewarpstream_fly_123.fly.dev
. - Determine which fly.io region you want to deploy to and set that in
primary_region
. - Fill in the value of
WARPSTREAM_DEFAULT_VIRTUAL_CLUSTER_ID
from the WarpStream Admin Console. - Fill in the value of
WARPSTREAM_BUCKET_URL
. If you don't have an object store / bucket selected already, we've found that Cloudflare R2 works well with fly.io. We have more documentation on how to set that up here.
- Pick a name for your WarpStream cluster and put it in the value of
- Run
flyctl launch
to create your WarpStream cluster. - Run
flyctl deploy
to make sure your cluster is deployed. - Run
flyctl ips allocate-v4
to create a public IP4 address at which your WarpStream cluster can be reached. - Run
fly secrets set AWS_ACCESS_KEY_ID=XXXXXXXX
with whatever the value of your object store access key is. - Run
fly secrets set AWS_SECRET_ACCESS_KEY=XXXXXXXX
with whatever the value of your object store secret access key is. - Run
fly secrets set WARPSTREAM_API_KEY=XXXXXXXX
with your WarpStream API key from the admin console. - Run
fly scale show
to see what machines your WarpStream Agents are running on. - The flyctl default machines are a bit too underpowered for the WarpStream Agents, so run
fly scale vm performance-2x
to get a bit more CPU and RAM. - If you want high availability, run
fly scale count 2
orfly scale count 3
to run more than one instance of the WarpStream Agents.
Congrats! You have a fully functional WarpStream cluster running on fly.io now backed by Cloudflare R2 object storage.
Before you attempt to use the cluster, make sure that authentication is properly enabled. Run the following command:
warpstream kcmd -type diagnose-connection -bootstrap-host $YOUR_APP_NAME.fly.dev -tls
You should an error about how SASL authentication failed which means your cluster is properly enforcing authentication. If you see success, DO NOT USE THIS CLUSTER AS IT IS NOT PROPERLY ENFORCING AUTHENTICATION.
Now that we've confirmed authentication is enforced, navigate to the WarpStream Admin Console and create a new set of credentials for this cluster.
Once you have the credentials, try the diagnose-connection
command again, but this time with credentials:
warpstream kcmd -type diagnose-connection -bootstrap-host warpstream-agent-demo.fly.dev -tls -username ccun_XXXXXXXX -password ccp_XXXXXXXX
This time you should get a successful response. That means your WarpStream cluster is ready to go!