feat: Add Temporal and Windmill services with configuration files

- Implemented Temporal service with Docker Compose, including PostgreSQL setup and environment variables for configuration.
- Added Temporal README and Chinese translation for documentation.
- Introduced Windmill service with Docker Compose, including PostgreSQL setup and environment variables for configuration.
- Added Windmill README and Chinese translation for documentation.
- Updated MongoDB configurations to use host.docker.internal for better compatibility.
This commit is contained in:
Sun-ZhenXing
2025-11-01 19:40:54 +08:00
parent 843ebc24a1
commit 0f54723be1
22 changed files with 2805 additions and 6 deletions

39
src/kestra/.env.example Normal file
View File

@@ -0,0 +1,39 @@
# Kestra Configuration
# Versions
KESTRA_VERSION=latest-full
POSTGRES_VERSION=16-alpine
# Port Configuration
KESTRA_PORT_OVERRIDE=8080
KESTRA_MANAGEMENT_PORT=8081
# PostgreSQL Configuration
POSTGRES_DB=kestra
POSTGRES_USER=kestra
POSTGRES_PASSWORD=k3str4
# Basic Authentication (optional, set enabled=true to activate)
KESTRA_BASIC_AUTH_ENABLED=false
KESTRA_BASIC_AUTH_USERNAME=admin
KESTRA_BASIC_AUTH_PASSWORD=admin
# Java Options
KESTRA_JAVA_OPTS=-Xmx1g
# Timezone
TZ=UTC
# Logging - removed, using template defaults
# Resource Limits - Kestra
KESTRA_CPU_LIMIT=2.0
KESTRA_CPU_RESERVATION=0.5
KESTRA_MEMORY_LIMIT=2G
KESTRA_MEMORY_RESERVATION=512M
# Resource Limits - PostgreSQL
POSTGRES_CPU_LIMIT=1.0
POSTGRES_CPU_RESERVATION=0.25
POSTGRES_MEMORY_LIMIT=1G
POSTGRES_MEMORY_RESERVATION=256M

185
src/kestra/README.md Normal file
View File

@@ -0,0 +1,185 @@
# Kestra
Kestra is an infinitely scalable orchestration and scheduling platform that allows you to declare, run, schedule, and monitor millions of workflows declaratively in code.
## Features
- **Declarative YAML**: Define workflows in simple YAML syntax
- **Event-Driven**: Trigger workflows based on events, schedules, or APIs
- **Multi-Language Support**: Execute Python, Node.js, Shell, SQL, and more
- **Real-Time Monitoring**: Live logs and execution tracking
- **Plugin Ecosystem**: Extensive library of integrations
- **Version Control**: Git integration for workflow versioning
- **Scalable**: Handle millions of workflow executions
## Quick Start
1. Copy `.env.example` to `.env`:
```bash
cp .env.example .env
```
2. (Optional) Edit `.env` to customize settings, especially if enabling basic auth
3. Start Kestra:
```bash
docker compose up -d
```
4. Wait for services to be ready (check with `docker compose logs -f kestra`)
5. Access Kestra UI at `http://localhost:8080`
## Default Configuration
| Service | Port | Description |
| ----------------- | ---- | -------------------- |
| Kestra | 8080 | Web UI and API |
| Kestra Management | 8081 | Management endpoints |
| PostgreSQL | 5432 | Database (internal) |
**Authentication**: No authentication by default. Set `KESTRA_BASIC_AUTH_ENABLED=true` in `.env` to enable basic authentication.
## Environment Variables
Key environment variables (see `.env.example` for full list):
| Variable | Description | Default |
| ---------------------------- | -------------------- | ------------- |
| `KESTRA_VERSION` | Kestra image version | `latest-full` |
| `KESTRA_PORT_OVERRIDE` | Host port for UI/API | `8080` |
| `KESTRA_MANAGEMENT_PORT` | Management port | `8081` |
| `POSTGRES_DB` | Database name | `kestra` |
| `POSTGRES_USER` | Database user | `kestra` |
| `POSTGRES_PASSWORD` | Database password | `k3str4` |
| `KESTRA_BASIC_AUTH_ENABLED` | Enable basic auth | `false` |
| `KESTRA_BASIC_AUTH_USERNAME` | Auth username | `admin` |
| `KESTRA_BASIC_AUTH_PASSWORD` | Auth password | `admin` |
| `TZ` | Timezone | `UTC` |
## Resource Requirements
**Minimum**:
- CPU: 1 core
- RAM: 1GB
- Disk: 5GB
**Recommended**:
- CPU: 2+ cores
- RAM: 2GB+
- Disk: 20GB+
## Volumes
- `postgres_data`: PostgreSQL database data
- `kestra_data`: Kestra storage (workflow outputs, files)
- `kestra_logs`: Kestra application logs
## Using Kestra
### Creating a Workflow
1. Access the UI at `http://localhost:8080`
2. Go to "Flows" and click "Create"
3. Define your workflow in YAML:
```yaml
id: hello-world
namespace: company.team
tasks:
- id: hello
type: io.kestra.plugin.core.log.Log
message: Hello, World!
```
4. Save and execute
### Using the API
Example: List flows
```bash
curl http://localhost:8080/api/v1/flows/search
```
Example: Trigger execution
```bash
curl -X POST http://localhost:8080/api/v1/executions/company.team/hello-world
```
### CLI
Install Kestra CLI:
```bash
curl -o kestra https://github.com/kestra-io/kestra/releases/latest/download/kestra
chmod +x kestra
```
### Docker Task Runner
Kestra can execute tasks in Docker containers. The compose file mounts `/var/run/docker.sock` to enable this feature. Use the `io.kestra.plugin.scripts.runner.docker.Docker` task type.
## Security Considerations
1. **Authentication**: Enable basic auth or configure SSO (OIDC) for production
2. **Database Passwords**: Use strong passwords for PostgreSQL
3. **Docker Socket**: Mounting Docker socket grants container control; ensure proper security
4. **Network Access**: Restrict access with firewall rules
5. **SSL/TLS**: Use reverse proxy with HTTPS in production
## Upgrading
To upgrade Kestra:
1. Update `KESTRA_VERSION` in `.env`
2. Pull and restart:
```bash
docker compose pull
docker compose up -d
```
3. Check logs:
```bash
docker compose logs -f kestra
```
## Troubleshooting
**Service won't start:**
- Check logs: `docker compose logs kestra`
- Verify database: `docker compose ps postgres`
- Ensure Docker socket is accessible
**Cannot execute Docker tasks:**
- Verify `/var/run/docker.sock` is mounted
- Check Docker daemon is running
- Review task logs in Kestra UI
**Performance issues:**
- Increase resource limits in `.env`
- Check database performance
- Monitor Java heap usage (adjust `KESTRA_JAVA_OPTS`)
## References
- Official Website: <https://kestra.io>
- Documentation: <https://kestra.io/docs>
- GitHub: <https://github.com/kestra-io/kestra>
- Community: <https://kestra.io/slack>
- Plugin Hub: <https://kestra.io/plugins>
## License
Kestra is licensed under Apache-2.0. See [LICENSE](https://github.com/kestra-io/kestra/blob/develop/LICENSE) for more information.

185
src/kestra/README.zh.md Normal file
View File

@@ -0,0 +1,185 @@
# Kestra
Kestra 是一个无限可扩展的编排和调度平台,允许您以声明方式在代码中定义、运行、调度和监控数百万个工作流。
## 功能特点
- **声明式 YAML**:使用简单的 YAML 语法定义工作流
- **事件驱动**:基于事件、计划或 API 触发工作流
- **多语言支持**:执行 Python、Node.js、Shell、SQL 等
- **实时监控**:实时日志和执行跟踪
- **插件生态系统**:丰富的集成库
- **版本控制**Git 集成用于工作流版本管理
- **可扩展**:处理数百万个工作流执行
## 快速开始
1. 复制 `.env.example``.env`
```bash
copy .env.example .env
```
2. (可选)编辑 `.env` 自定义设置,特别是启用基本身份验证
3. 启动 Kestra
```bash
docker compose up -d
```
4. 等待服务就绪(使用 `docker compose logs -f kestra` 检查)
5. 访问 Kestra UI`http://localhost:8080`
## 默认配置
| 服务 | 端口 | 说明 |
| ----------------- | ---- | -------------- |
| Kestra | 8080 | Web UI 和 API |
| Kestra Management | 8081 | 管理端点 |
| PostgreSQL | 5432 | 数据库(内部) |
**身份验证**:默认无身份验证。在 `.env` 中设置 `KESTRA_BASIC_AUTH_ENABLED=true` 以启用基本身份验证。
## 环境变量
主要环境变量(完整列表请参阅 `.env.example`
| 变量 | 说明 | 默认值 |
| ---------------------------- | ----------------- | ------------- |
| `KESTRA_VERSION` | Kestra 镜像版本 | `latest-full` |
| `KESTRA_PORT_OVERRIDE` | UI/API 的主机端口 | `8080` |
| `KESTRA_MANAGEMENT_PORT` | 管理端口 | `8081` |
| `POSTGRES_DB` | 数据库名称 | `kestra` |
| `POSTGRES_USER` | 数据库用户 | `kestra` |
| `POSTGRES_PASSWORD` | 数据库密码 | `k3str4` |
| `KESTRA_BASIC_AUTH_ENABLED` | 启用基本身份验证 | `false` |
| `KESTRA_BASIC_AUTH_USERNAME` | 验证用户名 | `admin` |
| `KESTRA_BASIC_AUTH_PASSWORD` | 验证密码 | `admin` |
| `TZ` | 时区 | `UTC` |
## 资源需求
**最低要求**
- CPU1 核心
- 内存1GB
- 磁盘5GB
**推荐配置**
- CPU2+ 核心
- 内存2GB+
- 磁盘20GB+
## 数据卷
- `postgres_data`PostgreSQL 数据库数据
- `kestra_data`Kestra 存储(工作流输出、文件)
- `kestra_logs`Kestra 应用日志
## 使用 Kestra
### 创建工作流
1. 访问 UI`http://localhost:8080`
2. 进入 "Flows" 并点击 "Create"
3. 用 YAML 定义您的工作流:
```yaml
id: hello-world
namespace: company.team
tasks:
- id: hello
type: io.kestra.plugin.core.log.Log
message: Hello, World!
```
4. 保存并执行
### 使用 API
示例:列出流
```bash
curl http://localhost:8080/api/v1/flows/search
```
示例:触发执行
```bash
curl -X POST http://localhost:8080/api/v1/executions/company.team/hello-world
```
### CLI
安装 Kestra CLI
```bash
curl -o kestra https://github.com/kestra-io/kestra/releases/latest/download/kestra
chmod +x kestra
```
### Docker 任务运行器
Kestra 可以在 Docker 容器中执行任务。compose 文件挂载了 `/var/run/docker.sock` 以启用此功能。使用 `io.kestra.plugin.scripts.runner.docker.Docker` 任务类型。
## 安全注意事项
1. **身份验证**:生产环境中启用基本身份验证或配置 SSOOIDC
2. **数据库密码**:为 PostgreSQL 使用强密码
3. **Docker Socket**:挂载 Docker socket 授予容器控制权限,确保适当的安全性
4. **网络访问**:使用防火墙规则限制访问
5. **SSL/TLS**:在生产环境中使用带 HTTPS 的反向代理
## 升级
升级 Kestra
1. 在 `.env` 中更新 `KESTRA_VERSION`
2. 拉取并重启:
```bash
docker compose pull
docker compose up -d
```
3. 检查日志:
```bash
docker compose logs -f kestra
```
## 故障排除
**服务无法启动:**
- 检查日志:`docker compose logs kestra`
- 验证数据库:`docker compose ps postgres`
- 确保 Docker socket 可访问
**无法执行 Docker 任务:**
- 验证 `/var/run/docker.sock` 已挂载
- 检查 Docker 守护进程是否运行
- 在 Kestra UI 中查看任务日志
**性能问题:**
- 在 `.env` 中增加资源限制
- 检查数据库性能
- 监控 Java 堆使用(调整 `KESTRA_JAVA_OPTS`
## 参考资料
- 官方网站:<https://kestra.io>
- 文档:<https://kestra.io/docs>
- GitHub<https://github.com/kestra-io/kestra>
- 社区:<https://kestra.io/slack>
- 插件中心:<https://kestra.io/plugins>
## 许可证
Kestra 使用 Apache-2.0 许可证。详情请参阅 [LICENSE](https://github.com/kestra-io/kestra/blob/develop/LICENSE)。

View File

@@ -0,0 +1,125 @@
# Kestra - Event-driven Orchestration Platform
# https://github.com/kestra-io/kestra
#
# Kestra is an infinitely scalable orchestration and scheduling platform that allows
# you to declare, run, schedule, and monitor millions of workflows declaratively in code.
#
# Key Features:
# - Declarative YAML-based workflow definitions
# - Event-driven orchestration with triggers
# - Built-in scheduling and cron support
# - Support for multiple programming languages (Python, Node.js, etc.)
# - Real-time monitoring and logging
# - Plugin ecosystem for integrations
#
# Default Credentials:
# - Access UI at http://localhost:8080
# - No authentication by default (configure in production)
#
# Security Notes:
# - Configure authentication in production (basic auth, OAuth2, OIDC)
# - Use strong database passwords
# - Enable SSL/TLS in production
# - Restrict network access appropriately
#
# License: Apache-2.0 (https://github.com/kestra-io/kestra/blob/develop/LICENSE)
x-default: &default
restart: unless-stopped
logging:
driver: json-file
options:
max-size: 100m
max-file: "3"
services:
kestra:
<<: *default
image: kestra/kestra:${KESTRA_VERSION:-latest-full}
container_name: kestra
command: server standalone
ports:
- "${KESTRA_PORT_OVERRIDE:-8080}:8080"
- "${KESTRA_MANAGEMENT_PORT:-8081}:8081"
environment:
# Database configuration
- KESTRA_CONFIGURATION=datasources.postgres.url=jdbc:postgresql://postgres:5432/${POSTGRES_DB}
- KESTRA_CONFIGURATION_datasources_postgres_username=${POSTGRES_USER}
- KESTRA_CONFIGURATION_datasources_postgres_password=${POSTGRES_PASSWORD}
- KESTRA_CONFIGURATION_datasources_postgres_driverClassName=org.postgresql.Driver
# Server configuration
- KESTRA_CONFIGURATION_micronaut_server_port=8080
- KESTRA_CONFIGURATION_kestra_server_basic--auth_enabled=${KESTRA_BASIC_AUTH_ENABLED:-false}
- KESTRA_CONFIGURATION_kestra_server_basic--auth_username=${KESTRA_BASIC_AUTH_USERNAME:-admin}
- KESTRA_CONFIGURATION_kestra_server_basic--auth_password=${KESTRA_BASIC_AUTH_PASSWORD:-admin}
# Storage configuration
- KESTRA_CONFIGURATION_kestra_storage_type=local
- KESTRA_CONFIGURATION_kestra_storage_local_base--path=/app/storage
# Repository configuration
- KESTRA_CONFIGURATION_kestra_repository_type=postgres
# Queue configuration
- KESTRA_CONFIGURATION_kestra_queue_type=postgres
# Other settings
- TZ=${TZ:-UTC}
- JAVA_OPTS=${KESTRA_JAVA_OPTS:--Xmx1g}
volumes:
- kestra_data:/app/storage
- kestra_logs:/app/logs
- /var/run/docker.sock:/var/run/docker.sock:ro # For Docker task runner
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
deploy:
resources:
limits:
cpus: "${KESTRA_CPU_LIMIT:-2.0}"
memory: "${KESTRA_MEMORY_LIMIT:-2G}"
reservations:
cpus: "${KESTRA_CPU_RESERVATION:-0.5}"
memory: "${KESTRA_MEMORY_RESERVATION:-512M}"
postgres:
<<: *default
image: postgres:${POSTGRES_VERSION:-16-alpine}
container_name: kestra-postgres
environment:
- POSTGRES_DB=${POSTGRES_DB:-kestra}
- POSTGRES_USER=${POSTGRES_USER:-kestra}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-k3str4}
- POSTGRES_INITDB_ARGS=--encoding=UTF8
- TZ=${TZ:-UTC}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-kestra} -d ${POSTGRES_DB:-kestra}"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: "${POSTGRES_CPU_LIMIT:-1.0}"
memory: "${POSTGRES_MEMORY_LIMIT:-1G}"
reservations:
cpus: "${POSTGRES_CPU_RESERVATION:-0.25}"
memory: "${POSTGRES_MEMORY_RESERVATION:-256M}"
volumes:
postgres_data:
driver: local
kestra_data:
driver: local
kestra_logs:
driver: local