Deploy with Kestra#
Introduction to Kestra#
Kestra is an open-source, scalable orchestration platform that enables
engineers to manage business-critical workflows declaratively in code. By applying
infrastructure as code best practices to data, process, and microservice orchestration, you
can build and manage reliable workflows.
Kestra facilitates reliable workflow management, offering advanced settings for resiliency,
triggers, real-time monitoring, and integration capabilities, making it a valuable tool for data
engineers and developers.
Kestra features#
Kestra provides a robust orchestration engine with features including:
- Workflows accessible through a user interface, event-driven
automation, and an embedded visual studio code editor. - It also offers embedded documentation, a live-updating topology view, and access to over 400
plugins, enhancing its versatility. - Kestra supports Git & CI/CD integrations, basic authentication, and benefits from community
support.
To know more, please refer to Kestra's documentation.
Building data pipelines with dlt#
dlt is an open-source Python library that allows you to declaratively load data sources
into well-structured tables or datasets. It does this through automatic schema inference and evolution.
The library simplifies building data pipelines by providing functionality to support the entire extract
and load process.
How does dlt integrate with Kestra for pipeline orchestration?#
To illustrate setting up a pipeline in Kestra, we’ll be using the following example:
From Inbox to Insights: AI-Enhanced Email Analysis with dlt and Kestra.
The example demonstrates automating a workflow to load data from Gmail to BigQuery using the dlt,
complemented by AI-driven summarization and sentiment analysis. You can refer to the project's
GitHub repo by clicking here.
Here is the summary of the steps:
-
Start by creating a virtual environment.
-
Generate an
.envfile: Inside your project repository, create an.envfile to store
credentials in "base64" format, prefixed with 'SECRET_' for compatibility with Kestra'ssecret()
function. -
As per Kestra’s recommendation, install Docker Desktop on your machine.
-
Ensure Docker is running, then download the Docker Compose file with:
curl -o docker-compose.yml \ https://raw.githubusercontent.com/kestra-io/kestra/develop/docker-compose.yml -
Configure Docker Compose file:
Edit the downloaded Docker Compose file to link the.envfile for environment
variables.kestra: image: kestra/kestra:latest env_file: - .env -
Enable auto-restart: In your
docker-compose.yml, setrestart: alwaysfor both PostgreSQL and
Kestra services to ensure they reboot automatically after a system restart. -
Launch Kestra server: Execute
docker compose up -dto start the server. -
Access Kestra UI: Navigate to
http://localhost:8080/to use the Kestra user interface. -
Create and configure flows:
- Go to 'Flows', then 'Create'.
- Configure the flow files in the editor.
- Save your flows.
-
Understand flow components:
- Each flow must have an
id,namespace, and a list oftaskswith their respectiveidand
type. - The main flow orchestrates tasks like loading data from a source to a destination.
- Each flow must have an
By following these steps, you establish a structured workflow within Kestra, leveraging its powerful
features for efficient data pipeline orchestration.