Back to Openhands

Resend Sync Service

enterprise/sync/README.md

1.7.01.7 KB
Original Source

Resend Sync Service

This service syncs users from Keycloak to a Resend.com audience. It runs as a Kubernetes CronJob that periodically queries the Keycloak database and adds any new users to the specified Resend audience.

Features

  • Syncs users from Keycloak to Resend.com audience
  • Handles rate limiting and retries with exponential backoff
  • Runs as a Kubernetes CronJob
  • Configurable batch size and sync frequency

Configuration

The service is configured using environment variables:

VariableDescriptionDefault
RESEND_API_KEYResend API key(required)
RESEND_AUDIENCE_IDResend audience ID(required)
KEYCLOAK_REALMKeycloak realmall-hands
BATCH_SIZENumber of users to process in each batch100
MAX_RETRIESMaximum number of retries for API calls3
INITIAL_BACKOFF_SECONDSInitial backoff time for retries1
MAX_BACKOFF_SECONDSMaximum backoff time for retries60
BACKOFF_FACTORBackoff factor for retries2
RATE_LIMITRate limit for API calls (requests per second)2

Deployment

The service is deployed as part of the openhands Helm chart. To enable it, set the following in your values.yaml:

yaml
resendSync:
  enabled: true
  audienceId: "your-audience-id"

Prerequisites

  • Kubernetes cluster with the openhands chart deployed
  • Resend.com API key stored in a Kubernetes secret named resend-api-key
  • Resend.com audience ID

Running Manually

You can run the sync job manually by executing:

bash
python -m app.sync.resend

Make sure all required environment variables are set before running the script.