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

53
src/windmill/.env.example Normal file
View File

@@ -0,0 +1,53 @@
# Windmill Configuration
# Versions
WINDMILL_VERSION=main
WINDMILL_LSP_VERSION=latest
POSTGRES_VERSION=16-alpine
# Port Configuration
WINDMILL_PORT_OVERRIDE=8000
WINDMILL_LSP_PORT=3001
# Base URL
WINDMILL_BASE_URL=http://localhost:8000
# PostgreSQL Configuration
POSTGRES_DB=windmill
POSTGRES_USER=windmill
POSTGRES_PASSWORD=changeme
# Superadmin Credentials - IMPORTANT: Change these!
WINDMILL_SUPERADMIN_EMAIL=admin@windmill.dev
WINDMILL_SUPERADMIN_PASSWORD=changeme
# Optional: Enterprise License Key
WINDMILL_LICENSE_KEY=
# Worker Configuration
WINDMILL_WORKER_TAGS=
WINDMILL_NUM_WORKERS=3
# Logging
WINDMILL_LOG_LEVEL=info
# Timezone
TZ=UTC
# Resource Limits - Server
WINDMILL_SERVER_CPU_LIMIT=1.0
WINDMILL_SERVER_CPU_RESERVATION=0.25
WINDMILL_SERVER_MEMORY_LIMIT=1G
WINDMILL_SERVER_MEMORY_RESERVATION=256M
# Resource Limits - Worker
WINDMILL_WORKER_CPU_LIMIT=2.0
WINDMILL_WORKER_CPU_RESERVATION=0.5
WINDMILL_WORKER_MEMORY_LIMIT=2G
WINDMILL_WORKER_MEMORY_RESERVATION=512M
# Resource Limits - PostgreSQL
POSTGRES_CPU_LIMIT=1.0
POSTGRES_CPU_RESERVATION=0.25
POSTGRES_MEMORY_LIMIT=1G
POSTGRES_MEMORY_RESERVATION=256M

194
src/windmill/README.md Normal file
View File

@@ -0,0 +1,194 @@
# Windmill
Windmill is an open-source developer infrastructure platform that allows you to quickly build production-grade multi-step automations and internal apps from minimal Python, TypeScript, Go, Bash, SQL scripts.
## Features
- **Multi-Language Support**: Write scripts in Python, TypeScript, Go, Bash, SQL
- **Auto-Generated UIs**: Automatic UI generation from scripts
- **Visual Workflow Builder**: Build complex workflows with code execution
- **Scheduling**: Built-in cron-based scheduling
- **Webhooks**: Trigger scripts via HTTP webhooks
- **Version Control**: Built-in Git sync and audit logs
- **Multi-Tenant**: Workspace-based multi-tenancy
## Quick Start
1. Copy `.env.example` to `.env`:
```bash
cp .env.example .env
```
2. **IMPORTANT**: Edit `.env` and change:
- `WINDMILL_SUPERADMIN_EMAIL` - Your admin email
- `WINDMILL_SUPERADMIN_PASSWORD` - A strong password
- `POSTGRES_PASSWORD` - A strong database password
3. Start Windmill:
```bash
docker compose up -d
```
4. Wait for services to be ready
5. Access Windmill UI at `http://localhost:8000`
6. Log in with your configured superadmin credentials
## Default Configuration
| Service | Port | Description |
| --------------- | ---- | ----------------------------- |
| Windmill Server | 8000 | Web UI and API |
| PostgreSQL | 5432 | Database (internal) |
| Windmill LSP | 3001 | Language Server (dev profile) |
**Default Credentials** (Change these!):
- Email: `admin@windmill.dev`
- Password: `changeme`
## Environment Variables
Key environment variables (see `.env.example` for full list):
| Variable | Description | Default |
| ------------------------------ | ---------------------- | ----------------------- |
| `WINDMILL_VERSION` | Windmill image version | `main` |
| `WINDMILL_PORT_OVERRIDE` | Host port for UI | `8000` |
| `WINDMILL_BASE_URL` | Base URL | `http://localhost:8000` |
| `WINDMILL_SUPERADMIN_EMAIL` | Superadmin email | `admin@windmill.dev` |
| `WINDMILL_SUPERADMIN_PASSWORD` | Superadmin password | **Must change!** |
| `POSTGRES_PASSWORD` | Database password | `changeme` |
| `WINDMILL_NUM_WORKERS` | Number of workers | `3` |
| `WINDMILL_LICENSE_KEY` | Enterprise license | (empty) |
| `TZ` | Timezone | `UTC` |
## Resource Requirements
**Minimum**:
- CPU: 1 core
- RAM: 1GB
- Disk: 5GB
**Recommended**:
- CPU: 3+ cores (1 for server, 2+ for workers)
- RAM: 3GB+
- Disk: 20GB+
## Volumes
- `postgres_data`: PostgreSQL database data
- `windmill_server_data`: Windmill server data
- `windmill_worker_data`: Worker execution data
## Using Windmill
### Creating a Script
1. Access the UI at `http://localhost:8000`
2. Create a workspace or use default
3. Go to "Scripts" and click "New Script"
4. Write your script (Python example):
```python
def main(name: str = "world"):
return f"Hello {name}!"
```
5. Save and run
### Creating a Workflow
1. Go to "Flows" and click "New Flow"
2. Use the visual editor to add steps
3. Each step can be a script, flow, or approval
4. Configure inputs and outputs between steps
5. Deploy and run
### Using the API
Example: List scripts
```bash
curl -H "Authorization: Bearer YOUR_TOKEN" \
http://localhost:8000/api/w/workspace/scripts/list
```
### Scheduling
1. Open any script or flow
2. Click "Schedule"
3. Set cron expression or interval
4. Save
## Profiles
- `dev`: Include LSP service for code intelligence (port 3001)
To enable dev profile:
```bash
docker compose --profile dev up -d
```
## Security Considerations
1. **Change Default Credentials**: Always change superadmin credentials
2. **Database Password**: Use a strong PostgreSQL password
3. **Docker Socket**: Mounting Docker socket grants container control
4. **SSL/TLS**: Use reverse proxy with HTTPS in production
5. **License Key**: Keep enterprise license key secure if using
## Upgrading
To upgrade Windmill:
1. Update `WINDMILL_VERSION` in `.env`
2. Pull and restart:
```bash
docker compose pull
docker compose up -d
```
3. Check logs:
```bash
docker compose logs -f windmill-server
```
## Troubleshooting
**Service won't start:**
- Check logs: `docker compose logs windmill-server`
- Verify database: `docker compose ps postgres`
- Ensure Docker socket is accessible
**Cannot login:**
- Verify credentials in `.env`
- Check server logs for authentication errors
- Try resetting password via CLI
**Workers not processing:**
- Check worker logs: `docker compose logs windmill-worker`
- Verify database connection
- Increase `WINDMILL_NUM_WORKERS` if needed
## References
- Official Website: <https://windmill.dev>
- Documentation: <https://docs.windmill.dev>
- GitHub: <https://github.com/windmill-labs/windmill>
- Community: <https://discord.gg/V7PM2YHsPB>
## License
Windmill is licensed under AGPLv3. See [LICENSE](https://github.com/windmill-labs/windmill/blob/main/LICENSE) for more information.

194
src/windmill/README.zh.md Normal file
View File

@@ -0,0 +1,194 @@
# Windmill
Windmill 是一个开源的开发者基础设施平台,允许您从最少的 Python、TypeScript、Go、Bash、SQL 脚本快速构建生产级的多步骤自动化和内部应用。
## 功能特点
- **多语言支持**:使用 Python、TypeScript、Go、Bash、SQL 编写脚本
- **自动生成 UI**:从脚本自动生成用户界面
- **可视化工作流构建器**:通过代码执行构建复杂工作流
- **调度**:内置基于 cron 的调度
- **Webhook**:通过 HTTP webhook 触发脚本
- **版本控制**:内置 Git 同步和审计日志
- **多租户**:基于工作区的多租户
## 快速开始
1. 复制 `.env.example``.env`
```bash
copy .env.example .env
```
2. **重要**:编辑 `.env` 并更改:
- `WINDMILL_SUPERADMIN_EMAIL` - 您的管理员邮箱
- `WINDMILL_SUPERADMIN_PASSWORD` - 一个强密码
- `POSTGRES_PASSWORD` - 一个强数据库密码
3. 启动 Windmill
```bash
docker compose up -d
```
4. 等待服务就绪
5. 访问 Windmill UI`http://localhost:8000`
6. 使用配置的超级管理员凭证登录
## 默认配置
| 服务 | 端口 | 说明 |
| --------------- | ---- | -------------------------- |
| Windmill Server | 8000 | Web UI 和 API |
| PostgreSQL | 5432 | 数据库(内部) |
| Windmill LSP | 3001 | 语言服务器dev 配置文件) |
**默认凭证**(请更改!):
- 邮箱:`admin@windmill.dev`
- 密码:`changeme`
## 环境变量
主要环境变量(完整列表请参阅 `.env.example`
| 变量 | 说明 | 默认值 |
| ------------------------------ | ----------------- | ----------------------- |
| `WINDMILL_VERSION` | Windmill 镜像版本 | `main` |
| `WINDMILL_PORT_OVERRIDE` | UI 的主机端口 | `8000` |
| `WINDMILL_BASE_URL` | 基础 URL | `http://localhost:8000` |
| `WINDMILL_SUPERADMIN_EMAIL` | 超级管理员邮箱 | `admin@windmill.dev` |
| `WINDMILL_SUPERADMIN_PASSWORD` | 超级管理员密码 | **必须更改!** |
| `POSTGRES_PASSWORD` | 数据库密码 | `changeme` |
| `WINDMILL_NUM_WORKERS` | Worker 数量 | `3` |
| `WINDMILL_LICENSE_KEY` | 企业许可证 | (空) |
| `TZ` | 时区 | `UTC` |
## 资源需求
**最低要求**
- CPU1 核心
- 内存1GB
- 磁盘5GB
**推荐配置**
- CPU3+ 核心server 1 个,worker 2+ 个)
- 内存3GB+
- 磁盘20GB+
## 数据卷
- `postgres_data`PostgreSQL 数据库数据
- `windmill_server_data`Windmill 服务器数据
- `windmill_worker_data`Worker 执行数据
## 使用 Windmill
### 创建脚本
1. 访问 UI`http://localhost:8000`
2. 创建工作区或使用默认工作区
3. 进入 "Scripts" 并点击 "New Script"
4. 编写您的脚本Python 示例):
```python
def main(name: str = "world"):
return f"Hello {name}!"
```
5. 保存并运行
### 创建工作流
1. 进入 "Flows" 并点击 "New Flow"
2. 使用可视化编辑器添加步骤
3. 每个步骤可以是脚本、流程或审批
4. 配置步骤之间的输入和输出
5. 部署并运行
### 使用 API
示例:列出脚本
```bash
curl -H "Authorization: Bearer YOUR_TOKEN" \
http://localhost:8000/api/w/workspace/scripts/list
```
### 调度
1. 打开任何脚本或流程
2. 点击 "Schedule"
3. 设置 cron 表达式或间隔
4. 保存
## 配置文件
- `dev`:包含用于代码智能的 LSP 服务(端口 3001
启用 dev 配置文件:
```bash
docker compose --profile dev up -d
```
## 安全注意事项
1. **更改默认凭证**:始终更改超级管理员凭证
2. **数据库密码**:使用强 PostgreSQL 密码
3. **Docker Socket**:挂载 Docker socket 授予容器控制权限
4. **SSL/TLS**:在生产环境中使用带 HTTPS 的反向代理
5. **许可证密钥**:如果使用企业许可证,请妥善保管密钥
## 升级
升级 Windmill
1. 在 `.env` 中更新 `WINDMILL_VERSION`
2. 拉取并重启:
```bash
docker compose pull
docker compose up -d
```
3. 检查日志:
```bash
docker compose logs -f windmill-server
```
## 故障排除
**服务无法启动:**
- 检查日志:`docker compose logs windmill-server`
- 验证数据库:`docker compose ps postgres`
- 确保 Docker socket 可访问
**无法登录:**
- 验证 `.env` 中的凭证
- 检查服务器日志中的身份验证错误
- 尝试通过 CLI 重置密码
**Worker 未处理:**
- 检查 worker 日志:`docker compose logs windmill-worker`
- 验证数据库连接
- 如需要增加 `WINDMILL_NUM_WORKERS`
## 参考资料
- 官方网站:<https://windmill.dev>
- 文档:<https://docs.windmill.dev>
- GitHub<https://github.com/windmill-labs/windmill>
- 社区:<https://discord.gg/V7PM2YHsPB>
## 许可证
Windmill 使用 AGPLv3 许可证。详情请参阅 [LICENSE](https://github.com/windmill-labs/windmill/blob/main/LICENSE)。

View File

@@ -0,0 +1,164 @@
# Windmill - Developer Infrastructure Platform
# https://github.com/windmill-labs/windmill
#
# Windmill is an open-source developer platform and workflow engine that allows you to
# quickly build production-grade multi-step automations and internal apps from minimal
# scripts in Python, TypeScript, Go, Bash, SQL, or any Docker image.
#
# Key Features:
# - Write scripts in Python, TypeScript, Go, Bash, SQL
# - Auto-generated UIs from scripts
# - Visual workflow builder with code execution
# - Built-in scheduling and webhooks
# - Version control and audit logs
# - Multi-tenant workspaces
#
# Default Credentials:
# - Access UI at http://localhost:8000
# - Default email: admin@windmill.dev
# - Default password: changeme
#
# Security Notes:
# - Change default admin credentials immediately
# - Use strong database passwords
# - Enable SSL/TLS in production
# - Configure proper authentication (OAuth, SAML)
#
# License: AGPLv3 (https://github.com/windmill-labs/windmill/blob/main/LICENSE)
x-default: &default
restart: unless-stopped
logging:
driver: json-file
options:
max-size: 100m
max-file: "3"
services:
windmill-server:
<<: *default
image: ghcr.io/windmill-labs/windmill:${WINDMILL_VERSION:-main}
container_name: windmill-server
ports:
- "${WINDMILL_PORT_OVERRIDE:-8000}:8000"
environment:
# Database configuration
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable
# Server configuration
- MODE=server
- BASE_URL=${WINDMILL_BASE_URL:-http://localhost:8000}
# Authentication
- SUPERADMIN_EMAIL=${WINDMILL_SUPERADMIN_EMAIL:-admin@windmill.dev}
- SUPERADMIN_PASSWORD=${WINDMILL_SUPERADMIN_PASSWORD:-changeme}
# Optional: License key for enterprise features
- LICENSE_KEY=${WINDMILL_LICENSE_KEY:-}
# Other settings
- TZ=${TZ:-UTC}
- RUST_LOG=${WINDMILL_LOG_LEVEL:-info}
volumes:
- windmill_server_data:/tmp/windmill
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8000/api/version"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
deploy:
resources:
limits:
cpus: "${WINDMILL_SERVER_CPU_LIMIT:-1.0}"
memory: "${WINDMILL_SERVER_MEMORY_LIMIT:-1G}"
reservations:
cpus: "${WINDMILL_SERVER_CPU_RESERVATION:-0.25}"
memory: "${WINDMILL_SERVER_MEMORY_RESERVATION:-256M}"
windmill-worker:
<<: *default
image: ghcr.io/windmill-labs/windmill:${WINDMILL_VERSION:-main}
container_name: windmill-worker
environment:
# Database configuration
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable
# Worker configuration
- MODE=worker
- WORKER_TAGS=${WINDMILL_WORKER_TAGS:-}
- NUM_WORKERS=${WINDMILL_NUM_WORKERS:-3}
# Other settings
- TZ=${TZ:-UTC}
- RUST_LOG=${WINDMILL_LOG_LEVEL:-info}
volumes:
- windmill_worker_data:/tmp/windmill
- /var/run/docker.sock:/var/run/docker.sock:ro # For Docker execution
depends_on:
postgres:
condition: service_healthy
windmill-server:
condition: service_healthy
deploy:
resources:
limits:
cpus: "${WINDMILL_WORKER_CPU_LIMIT:-2.0}"
memory: "${WINDMILL_WORKER_MEMORY_LIMIT:-2G}"
reservations:
cpus: "${WINDMILL_WORKER_CPU_RESERVATION:-0.5}"
memory: "${WINDMILL_WORKER_MEMORY_RESERVATION:-512M}"
postgres:
<<: *default
image: postgres:${POSTGRES_VERSION:-16-alpine}
container_name: windmill-postgres
environment:
- POSTGRES_DB=${POSTGRES_DB:-windmill}
- POSTGRES_USER=${POSTGRES_USER:-windmill}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changeme}
- POSTGRES_INITDB_ARGS=--encoding=UTF8
- TZ=${TZ:-UTC}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-windmill} -d ${POSTGRES_DB:-windmill}"]
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}"
# Optional: LSP service for code intelligence
windmill-lsp:
<<: *default
image: ghcr.io/windmill-labs/windmill-lsp:${WINDMILL_LSP_VERSION:-latest}
container_name: windmill-lsp
profiles:
- dev
ports:
- "${WINDMILL_LSP_PORT:-3001}:3001"
deploy:
resources:
limits:
cpus: "0.5"
memory: "512M"
volumes:
postgres_data:
driver: local
windmill_server_data:
driver: local
windmill_worker_data:
driver: local