π Automation Examples
π Table of Contentsβ
- Overview
- RabbitMQ Automation
- Kafka/Strimzi Automation
- FastAPI Automation
- k6 Load Testing Automation
- OpenTelemetry (OTEL) Automation
- Valkey (Redis Alternative) Automation
- Best Practices
- Additional Resources
Overviewβ
This chapter provides real-world examples of service automation and relationships generated by Stacktic. These examples demonstrate how Stacktic automates configurations based on best-practice patterns, creating the necessary resources, documentation, and relationships to support full-stack demands.
Important Notesβ
β οΈ Scope Notice: These are examples only, not complete automation implementations.
The full automation is generated into your target repository's documentation with all configurations, secrets, and operational procedures.
What Gets Automatedβ
| Service | Automated Components | Key Features |
|---|---|---|
| RabbitMQ | Exchanges, queues, bindings, users | Message flow configuration |
| Kafka | Topics, bridges, connectors, sinks | Event streaming setup |
| FastAPI | Routes, endpoints, documentation | API gateway integration |
| k6 | Test scripts, CRDs, plugins | Performance testing |
π RabbitMQ Automationβ
Component Architectureβ
RabbitMQ automation demonstrates how Stacktic handles message queue patterns with sub-components and relationships.
Sub-Component Creationβ
You can create sub-components such as:
- Exchanges - Message routing logic
- Queues - Message storage
- Bindings - Flow definitions between exchanges and queues
Relationship Configurationβ
The link between an exchange and a queue represents the binding configuration:
Generated Configurationβ
Secret Configuration Exampleβ
The automation generates a complete RabbitMQ configuration stored as a Kubernetes secret:
cat k8s/deploy/base/rabbitmq/secret/definitions.json
{
"vhosts": [
{ "name": "/" }
],
"users": [
{
"name": "user",
"password_hash": "EJBKv6SgKs6UFaLurzia3tPUIxQ/d4NIfwXG0OUWD2ayoCRd",
"tags": "management"
},
{
"name": "admin",
"password_hash": "C5pNaWoy+Fb7WeHsIgtP/6DvaimpRJkdo4BQQYlO+yluv0b/",
"tags": "administrator"
}
],
"permissions": [
{ "user": "user", "vhost": "/", "configure": ".*", "write": ".*", "read": ".*" },
{ "user": "admin", "vhost": "/", "configure": ".*", "write": ".*", "read": ".*" }
],
"parameters": [],
"global_parameters": [
{ "name": "cluster_name", "value": "rabbit@my-rabbit" }
],
"policies": [],
"bindings": [{
"source": "api-system",
"destination": "systems",
"destination_type": "queue",
"vhost": "/",
"routing_key": "#"
}],
"queues": [{
"name": "systems",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {}
}],
"exchanges": [{
"name": "api-system",
"type": "topic",
"vhost": "/",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
}]
}
Additional Configurationsβ
| Configuration Type | Location | Purpose |
|---|---|---|
| Versioning | Component level | RabbitMQ version management |
| Resources | Component attributes | CPU/Memory allocation |
| Security | Component & links | Authentication, TLS, network policies |
| Monitoring | Auto-generated | Prometheus metrics, Grafana dashboards |
π Note: Additional configuration related to versioning, resources, and security exists within the RabbitMQ component itself.
π¦ Kafka Automationβ
Advanced Event Streamingβ
Kafka Strimzi is a more complex component but follows similar automation principles.
Sub-Component Typesβ
| Sub-Component | Purpose | Automation Features |
|---|---|---|
| Topics | Event streams | Partitions, replication, retention |
| Bridges | HTTP integration | REST API exposure |
| Connectors | External systems | Database sinks, source connectors |
| Users | Access control | ACLs, authentication |
Integration Capabilitiesβ
API Gateway Integrationβ
- Bridge connects to API gateway
- Integrates with OIDC via Keycloak
- Automatic authentication setup
Database Integrationβ
- Topic sub-components connect to databases for sink operations
- Automated Kafka Connect configuration
- End-to-end setup including connectors and secrets
Example Resourcesβ
Demo Repositoryβ
Explore a sample implementation (not full automation):
π Basic Strimzi Setup
Connectors Exampleβ
Review automated connector configurations:
π Kafka Connectors
Automated Componentsβ
| Component | Generated Assets |
|---|---|
| Kafka Cluster | StatefulSets, services, config |
| Kafka Connect | Deployment, connector definitions |
| Schema Registry | Deployment, schemas |
| Monitoring | JMX exporters, dashboards |
β‘ FastAPI Automationβ
API Development Accelerationβ
FastAPI automation streamlines API configuration and documentation through intelligent relationship management.
Automatic Configurationβ
When you connect FastAPI to a queue or database, Stacktic automatically:
| Action | Generated Assets |
|---|---|
| Adds dependencies | Python packages, requirements.txt |
| Configures routes | API endpoints, middleware |
| Creates services | Business logic templates |
| Generates endpoints | GET, POST, DELETE, PUT methods |
| Documents APIs | OpenAPI/Swagger specs |
API Gateway Integrationβ
Connect FastAPI to APISIX API Gateway for production-ready deployment:
- Automatic route registration
- Load balancing configuration
- Health check setup
- Rate limiting rules
Validation & Testingβ
Validate the configuration by testing the FastAPI endpoints and viewing generated documentation:
sub_component for custom APIβ
Stacktic acts as version control for your stack.
You can:
- Create your own API on the existing FastAPI service in the
mainbranch. - Modify an existing API.
- Or use sub-components to define APIs.
When you add a sub-component, Stacktic automatically generates the API code inside the existing structure.
You donβt need to manually touch main