sequin.yaml
Reference for Sequin’s YAML configuration for infrastructure-as-code deployments.
Overview
Configure Sequin resources like databases, sinks, and HTTP endpoints using YAML.
You can provide YAML configuration to Sequin in three ways:
- Via a configuration file using the
CONFIG_FILE_PATH
environment variable - Directly as base64-encoded YAML using the
CONFIG_FILE_YAML
environment variable - Via the Sequin CLI using the
sequin config export|plan|apply
command group
Schema
Account configuration
Creating accounts is only supported on self-hosted Sequin.
User configuration
API token configuration
You can create API tokens for your account. This is intended for use in development or CI/CD workflows:
Creating API tokens is only supported on self-hosted Sequin.
Database configuration
Database connection retry
When creating a database, Sequin needs to be able to connect to the database in order to read the database’s schema. The await_database
configuration allows you to control how Sequin attempts to connect to your database during startup. This option is most relevant in development environments, where you might be provisioning Sequin and your database at the same time.
By default, Sequin will wait up to 30 seconds for the database to be ready and will retry every 3 seconds. You can customize this behavior by setting the timeout_ms
and interval_ms
options.
HTTP endpoint configuration
You can configure HTTP endpoints in three ways:
1. External URL
2. Local development endpoint
Sequin Cloud offers tunneling to your local machine for development. Learn more about tunneling in the CLI documentation.
3. Webhook.site testing endpoint
Sink configuration
A sink streams data from a table to a destination (sink). All sinks share these configuration options:
The destination
configuration varies by sink type. Below are the configurations for each sink type:
Webhook sink
For sending changes to HTTP endpoints:
Sequin Stream sink
Sequin Stream is a durable, scalable, and fault-tolerant message stream that you can use with Sequin in place of additional infrastructure like Kafka or SQS.
For pulling changes via the Sequin Stream API:
Kafka sink
For publishing changes to Kafka topics:
SQS sink
For sending changes to Amazon SQS queues:
Redis sink
For publishing changes to Redis streams:
RabbitMQ sink
For publishing changes to RabbitMQ exchanges:
GCP PubSub sink
For publishing changes to Google Cloud Pub/Sub topics:
The GCP PubSub sink requires a service account with permissions to publish to the specified topic. The credentials
field should contain the JSON key file contents for a service account with the roles/pubsub.publisher
role.
Project ID must be between 6 and 30 characters, start with a letter, and contain only lowercase letters, numbers, and hyphens. Topic ID must be between 3 and 255 characters and match the pattern: [a-zA-Z][a-zA-Z0-9-_.~+%]*
.
Sink filters
All sink types support filtering messages based on columns in your source table. The filtering syntax is consistent across sink types:
Additioanlly, you can specify actions to consume. By default, all actions are consumed.
Sink transforms
Transforms allow you to modify the structure of messages before they are sent to a sink. You can define transforms at the top level of your configuration and reference them in your sinks.
The path
field supports the following paths:
record
- The entire record objectchanges
- The changes object (only available for event messages)action
- The action type (insert, update, delete) (only available for event messages)metadata
- The metadata object
You can also use dot notation to access nested fields within these objects, for example:
record.id
- The ID field from the recordchanges.name
- The name field from the changesmetadata.transaction_annotations.user_id
- A custom transaction annotation
Example usage:
Change retention configuration
Environment variable substitution
Sequin supports environment variable substitution in your YAML configuration files using the following syntax:
This allows you to:
- Reference environment variables in your configuration
- Provide default values when the environment variable is not set
For example:
Using with dotenv
You can use tools like dotenv
to load environment variables from a .env
file before running Sequin commands:
This is particularly useful for:
- Managing environment-specific configurations
- Keeping sensitive values out of your YAML files
- Simplifying deployment across different environments
Example configuration
Here’s a complete example combining multiple resources:
YAML Anchors
YAML anchors allow you to reuse YAML configuration across multiple resources. For instance, you may want to create a sink for each table in a database. You can use anchors to avoid duplicating the sink configuration for each table.
This setup will fan-in changes from all three tables into a single sink destination, all using the same YAML block for each table.