feat: add Langflow
This commit is contained in:
@@ -10,32 +10,32 @@ x-default: &default
|
||||
max-size: 100m
|
||||
max-file: "3"
|
||||
|
||||
# Example service structure:
|
||||
# services:
|
||||
# service-name:
|
||||
# <<: *default
|
||||
# image: image:${VERSION:-latest}
|
||||
# ports:
|
||||
# - "${PORT_OVERRIDE:-8080}:8080"
|
||||
# volumes:
|
||||
# - service_data:/data
|
||||
# environment:
|
||||
# - TZ=${TZ:-UTC}
|
||||
# - ENV_VAR=${ENV_VAR:-default_value}
|
||||
# healthcheck:
|
||||
# test: ["CMD", "command", "to", "check", "health"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 3
|
||||
# start_period: 10s
|
||||
# deploy:
|
||||
# resources:
|
||||
# limits:
|
||||
# cpus: '1.00'
|
||||
# memory: 512M
|
||||
# reservations:
|
||||
# cpus: '0.25'
|
||||
# memory: 128M
|
||||
#
|
||||
# volumes:
|
||||
# service_data:
|
||||
#! Example service structure:
|
||||
services:
|
||||
service-name:
|
||||
<<: *default
|
||||
image: image:${VERSION:-latest}
|
||||
ports:
|
||||
- "${PORT_OVERRIDE:-8080}:8080"
|
||||
volumes:
|
||||
- service_data:/data
|
||||
environment:
|
||||
- TZ=${TZ:-UTC}
|
||||
- ENV_VAR=${ENV_VAR:-default_value}
|
||||
healthcheck:
|
||||
test: ["CMD", "command", "to", "check", "health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 512M
|
||||
reservations:
|
||||
cpus: '0.25'
|
||||
memory: 128M
|
||||
|
||||
volumes:
|
||||
service_data:
|
||||
|
||||
@@ -111,6 +111,4 @@ services:
|
||||
|
||||
volumes:
|
||||
budibase_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
|
||||
@@ -134,8 +134,5 @@ services:
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
elasticsearch_data:
|
||||
driver: local
|
||||
conductor_logs:
|
||||
driver: local
|
||||
|
||||
@@ -118,8 +118,5 @@ services:
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
kestra_data:
|
||||
driver: local
|
||||
kestra_logs:
|
||||
driver: local
|
||||
|
||||
63
src/langflow/.env.example
Normal file
63
src/langflow/.env.example
Normal file
@@ -0,0 +1,63 @@
|
||||
# Langflow Configuration
|
||||
|
||||
# Versions
|
||||
LANGFLOW_VERSION=latest
|
||||
POSTGRES_VERSION=16-alpine
|
||||
|
||||
# Port Configuration
|
||||
LANGFLOW_PORT_OVERRIDE=7860
|
||||
|
||||
# PostgreSQL Configuration
|
||||
POSTGRES_DB=langflow
|
||||
POSTGRES_USER=langflow
|
||||
POSTGRES_PASSWORD=langflow
|
||||
|
||||
# Storage Configuration
|
||||
LANGFLOW_CONFIG_DIR=/app/langflow
|
||||
|
||||
# Server Configuration
|
||||
LANGFLOW_HOST=0.0.0.0
|
||||
LANGFLOW_WORKERS=1
|
||||
|
||||
# Authentication - IMPORTANT: Configure for production!
|
||||
# Set LANGFLOW_AUTO_LOGIN=false to require login
|
||||
LANGFLOW_AUTO_LOGIN=true
|
||||
LANGFLOW_SUPERUSER=langflow
|
||||
LANGFLOW_SUPERUSER_PASSWORD=langflow
|
||||
|
||||
# Security - IMPORTANT: Generate a secure secret key for production!
|
||||
# Use: python -c "from secrets import token_urlsafe; print(token_urlsafe(32))"
|
||||
LANGFLOW_SECRET_KEY=
|
||||
|
||||
# Features
|
||||
LANGFLOW_AUTO_SAVING=true
|
||||
LANGFLOW_AUTO_SAVING_INTERVAL=1000
|
||||
LANGFLOW_STORE_ENVIRONMENT_VARIABLES=true
|
||||
LANGFLOW_FALLBACK_TO_ENV_VAR=true
|
||||
|
||||
# Optional: Custom components directory
|
||||
LANGFLOW_COMPONENTS_PATH=
|
||||
|
||||
# Optional: Load flows from directory on startup
|
||||
LANGFLOW_LOAD_FLOWS_PATH=
|
||||
|
||||
# Logging
|
||||
LANGFLOW_LOG_LEVEL=error
|
||||
|
||||
# Timezone
|
||||
TZ=UTC
|
||||
|
||||
# Analytics
|
||||
DO_NOT_TRACK=false
|
||||
|
||||
# Resource Limits - Langflow
|
||||
LANGFLOW_CPU_LIMIT=2.0
|
||||
LANGFLOW_CPU_RESERVATION=0.5
|
||||
LANGFLOW_MEMORY_LIMIT=2G
|
||||
LANGFLOW_MEMORY_RESERVATION=512M
|
||||
|
||||
# Resource Limits - PostgreSQL
|
||||
POSTGRES_CPU_LIMIT=1.0
|
||||
POSTGRES_CPU_RESERVATION=0.25
|
||||
POSTGRES_MEMORY_LIMIT=1G
|
||||
POSTGRES_MEMORY_RESERVATION=256M
|
||||
230
src/langflow/README.md
Normal file
230
src/langflow/README.md
Normal file
@@ -0,0 +1,230 @@
|
||||
# Langflow
|
||||
|
||||
Langflow is a low-code visual framework for building AI applications. It's Python-based and agnostic to any model, API, or database, making it easy to build RAG applications, multi-agent systems, and custom AI workflows.
|
||||
|
||||
## Features
|
||||
|
||||
- **Visual Flow Builder**: Drag-and-drop interface for building AI applications
|
||||
- **Multi-Model Support**: Works with OpenAI, Anthropic, Google, HuggingFace, and more
|
||||
- **RAG Components**: Built-in support for vector databases and retrieval
|
||||
- **Custom Components**: Create your own Python components
|
||||
- **Agent Support**: Build multi-agent systems with memory and tools
|
||||
- **Real-Time Monitoring**: Track executions and debug flows
|
||||
- **API Integration**: REST API for programmatic access
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Copy `.env.example` to `.env`:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
2. (Optional) Edit `.env` to customize settings:
|
||||
- Generate a secure `LANGFLOW_SECRET_KEY` for production
|
||||
- Set `LANGFLOW_AUTO_LOGIN=false` to require authentication
|
||||
- Configure superuser credentials
|
||||
- Add API keys for LLM providers
|
||||
|
||||
3. Start Langflow:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
4. Wait for services to be ready
|
||||
|
||||
5. Access Langflow UI at `http://localhost:7860`
|
||||
|
||||
6. Start building your AI application!
|
||||
|
||||
## Default Configuration
|
||||
|
||||
| Service | Port | Description |
|
||||
| ---------- | ---- | ------------------- |
|
||||
| Langflow | 7860 | Web UI and API |
|
||||
| PostgreSQL | 5432 | Database (internal) |
|
||||
|
||||
**Default Credentials** (if authentication enabled):
|
||||
|
||||
- Username: `langflow`
|
||||
- Password: `langflow`
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Key environment variables (see `.env.example` for full list):
|
||||
|
||||
| Variable | Description | Default |
|
||||
| ----------------------------- | ----------------------------- | ---------- |
|
||||
| `LANGFLOW_VERSION` | Langflow image version | `latest` |
|
||||
| `LANGFLOW_PORT_OVERRIDE` | Host port for UI | `7860` |
|
||||
| `POSTGRES_PASSWORD` | Database password | `langflow` |
|
||||
| `LANGFLOW_AUTO_LOGIN` | Auto-login (disable for auth) | `true` |
|
||||
| `LANGFLOW_SUPERUSER` | Superuser username | `langflow` |
|
||||
| `LANGFLOW_SUPERUSER_PASSWORD` | Superuser password | `langflow` |
|
||||
| `LANGFLOW_SECRET_KEY` | Secret key for sessions | (empty) |
|
||||
| `LANGFLOW_COMPONENTS_PATH` | Custom components directory | (empty) |
|
||||
| `LANGFLOW_LOAD_FLOWS_PATH` | Auto-load flows directory | (empty) |
|
||||
| `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
|
||||
- `langflow_data`: Langflow configuration, flows, and logs
|
||||
|
||||
## Using Langflow
|
||||
|
||||
### Building Your First Flow
|
||||
|
||||
1. Access the UI at `http://localhost:7860`
|
||||
2. Click "New Flow" or use a template
|
||||
3. Drag components from the sidebar to the canvas
|
||||
4. Connect components by dragging between ports
|
||||
5. Configure component parameters
|
||||
6. Click "Run" to test your flow
|
||||
7. Use the API or integrate with your application
|
||||
|
||||
### Adding API Keys
|
||||
|
||||
You can add API keys for LLM providers in two ways:
|
||||
|
||||
#### Option 1: Global Variables (Recommended)
|
||||
|
||||
1. Click your profile icon → Settings
|
||||
2. Go to "Global Variables"
|
||||
3. Add your API keys (e.g., `OPENAI_API_KEY`)
|
||||
4. Reference them in components using `{OPENAI_API_KEY}`
|
||||
|
||||
#### Option 2: Environment Variables
|
||||
|
||||
Add to your `.env` file:
|
||||
|
||||
```text
|
||||
OPENAI_API_KEY=sk-...
|
||||
ANTHROPIC_API_KEY=sk-ant-...
|
||||
GOOGLE_API_KEY=...
|
||||
```
|
||||
|
||||
Langflow will automatically create global variables from these.
|
||||
|
||||
### Using the API
|
||||
|
||||
Get your API token from the UI:
|
||||
|
||||
1. Click your profile icon → Settings
|
||||
2. Go to "API Keys"
|
||||
3. Create a new API key
|
||||
|
||||
Example: Run a flow
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:7860/api/v1/run/YOUR_FLOW_ID \
|
||||
-H "Authorization: Bearer YOUR_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"input_value": "Hello"}'
|
||||
```
|
||||
|
||||
### Custom Components
|
||||
|
||||
1. Create a directory for your components
|
||||
2. Set `LANGFLOW_COMPONENTS_PATH` in `.env`
|
||||
3. Create Python files with your component classes
|
||||
4. Restart Langflow to load them
|
||||
|
||||
Example component structure:
|
||||
|
||||
```python
|
||||
from langflow import CustomComponent
|
||||
|
||||
class MyComponent(CustomComponent):
|
||||
display_name = "My Component"
|
||||
description = "Does something cool"
|
||||
|
||||
def build(self):
|
||||
# Your component logic
|
||||
return result
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
|
||||
1. **Secret Key**: Generate a strong `LANGFLOW_SECRET_KEY` for production:
|
||||
|
||||
```bash
|
||||
python -c "from secrets import token_urlsafe; print(token_urlsafe(32))"
|
||||
```
|
||||
|
||||
2. **Authentication**: Set `LANGFLOW_AUTO_LOGIN=false` to require login
|
||||
3. **Database Password**: Use a strong PostgreSQL password
|
||||
4. **API Keys**: Store sensitive keys as global variables, not in flows
|
||||
5. **SSL/TLS**: Use reverse proxy with HTTPS in production
|
||||
6. **Network Access**: Restrict access with firewall rules
|
||||
|
||||
## Upgrading
|
||||
|
||||
To upgrade Langflow:
|
||||
|
||||
1. Update `LANGFLOW_VERSION` in `.env` (or use `latest`)
|
||||
2. Pull and restart:
|
||||
|
||||
```bash
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
3. Check logs:
|
||||
|
||||
```bash
|
||||
docker compose logs -f langflow
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Service won't start:**
|
||||
|
||||
- Check logs: `docker compose logs langflow`
|
||||
- Verify database: `docker compose ps postgres`
|
||||
- Ensure sufficient resources allocated
|
||||
|
||||
**Cannot access UI:**
|
||||
|
||||
- Check port 7860 is not in use: `netstat -an | findstr 7860`
|
||||
- Verify firewall settings
|
||||
- Check container health: `docker compose ps`
|
||||
|
||||
**API key not working:**
|
||||
|
||||
- Verify the key is set in Global Variables
|
||||
- Check the variable name matches in your components
|
||||
- Ensure `LANGFLOW_STORE_ENVIRONMENT_VARIABLES=true`
|
||||
|
||||
**Flow execution errors:**
|
||||
|
||||
- Check component configurations
|
||||
- Review logs in the UI under each component
|
||||
- Verify API keys have sufficient credits/permissions
|
||||
|
||||
## References
|
||||
|
||||
- Official Website: <https://langflow.org>
|
||||
- Documentation: <https://docs.langflow.org>
|
||||
- GitHub: <https://github.com/langflow-ai/langflow>
|
||||
- Discord Community: <https://discord.gg/EqksyE2EX9>
|
||||
- Docker Hub: <https://hub.docker.com/r/langflowai/langflow>
|
||||
|
||||
## License
|
||||
|
||||
Langflow is licensed under MIT. See [LICENSE](https://github.com/langflow-ai/langflow/blob/main/LICENSE) for more information.
|
||||
230
src/langflow/README.zh.md
Normal file
230
src/langflow/README.zh.md
Normal file
@@ -0,0 +1,230 @@
|
||||
# Langflow
|
||||
|
||||
Langflow 是一个低代码可视化框架,用于构建 AI 应用。它基于 Python,与任何模型、API 或数据库无关,可轻松构建 RAG 应用、多智能体系统和自定义 AI 工作流。
|
||||
|
||||
## 功能特点
|
||||
|
||||
- **可视化流构建器**:拖放界面构建 AI 应用
|
||||
- **多模型支持**:支持 OpenAI、Anthropic、Google、HuggingFace 等
|
||||
- **RAG 组件**:内置向量数据库和检索支持
|
||||
- **自定义组件**:创建您自己的 Python 组件
|
||||
- **智能体支持**:构建具有记忆和工具的多智能体系统
|
||||
- **实时监控**:跟踪执行并调试流程
|
||||
- **API 集成**:用于编程访问的 REST API
|
||||
|
||||
## 快速开始
|
||||
|
||||
1. 复制 `.env.example` 到 `.env`:
|
||||
|
||||
```bash
|
||||
copy .env.example .env
|
||||
```
|
||||
|
||||
2. (可选)编辑 `.env` 自定义设置:
|
||||
- 为生产环境生成安全的 `LANGFLOW_SECRET_KEY`
|
||||
- 设置 `LANGFLOW_AUTO_LOGIN=false` 以要求身份验证
|
||||
- 配置超级用户凭证
|
||||
- 为 LLM 提供商添加 API 密钥
|
||||
|
||||
3. 启动 Langflow:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
4. 等待服务就绪
|
||||
|
||||
5. 访问 Langflow UI:`http://localhost:7860`
|
||||
|
||||
6. 开始构建您的 AI 应用!
|
||||
|
||||
## 默认配置
|
||||
|
||||
| 服务 | 端口 | 说明 |
|
||||
| ---------- | ---- | -------------- |
|
||||
| Langflow | 7860 | Web UI 和 API |
|
||||
| PostgreSQL | 5432 | 数据库(内部) |
|
||||
|
||||
**默认凭证**(如果启用了身份验证):
|
||||
|
||||
- 用户名:`langflow`
|
||||
- 密码:`langflow`
|
||||
|
||||
## 环境变量
|
||||
|
||||
主要环境变量(完整列表请参阅 `.env.example`):
|
||||
|
||||
| 变量 | 说明 | 默认值 |
|
||||
| ----------------------------- | ------------------------------ | ---------- |
|
||||
| `LANGFLOW_VERSION` | Langflow 镜像版本 | `latest` |
|
||||
| `LANGFLOW_PORT_OVERRIDE` | UI 的主机端口 | `7860` |
|
||||
| `POSTGRES_PASSWORD` | 数据库密码 | `langflow` |
|
||||
| `LANGFLOW_AUTO_LOGIN` | 自动登录(禁用以启用身份验证) | `true` |
|
||||
| `LANGFLOW_SUPERUSER` | 超级用户用户名 | `langflow` |
|
||||
| `LANGFLOW_SUPERUSER_PASSWORD` | 超级用户密码 | `langflow` |
|
||||
| `LANGFLOW_SECRET_KEY` | 会话密钥 | (空) |
|
||||
| `LANGFLOW_COMPONENTS_PATH` | 自定义组件目录 | (空) |
|
||||
| `LANGFLOW_LOAD_FLOWS_PATH` | 自动加载流目录 | (空) |
|
||||
| `TZ` | 时区 | `UTC` |
|
||||
|
||||
## 资源需求
|
||||
|
||||
**最低要求**:
|
||||
|
||||
- CPU:1 核心
|
||||
- 内存:1GB
|
||||
- 磁盘:5GB
|
||||
|
||||
**推荐配置**:
|
||||
|
||||
- CPU:2+ 核心
|
||||
- 内存:2GB+
|
||||
- 磁盘:20GB+
|
||||
|
||||
## 数据卷
|
||||
|
||||
- `postgres_data`:PostgreSQL 数据库数据
|
||||
- `langflow_data`:Langflow 配置、流和日志
|
||||
|
||||
## 使用 Langflow
|
||||
|
||||
### 构建您的第一个流
|
||||
|
||||
1. 访问 UI:`http://localhost:7860`
|
||||
2. 点击 "New Flow" 或使用模板
|
||||
3. 从侧边栏拖动组件到画布
|
||||
4. 通过在端口之间拖动来连接组件
|
||||
5. 配置组件参数
|
||||
6. 点击 "Run" 测试您的流
|
||||
7. 使用 API 或与您的应用集成
|
||||
|
||||
### 添加 API 密钥
|
||||
|
||||
您可以通过两种方式为 LLM 提供商添加 API 密钥:
|
||||
|
||||
#### 方法 1:全局变量(推荐)
|
||||
|
||||
1. 点击您的个人资料图标 → Settings
|
||||
2. 进入 "Global Variables"
|
||||
3. 添加您的 API 密钥(例如 `OPENAI_API_KEY`)
|
||||
4. 在组件中使用 `{OPENAI_API_KEY}` 引用它们
|
||||
|
||||
#### 方法 2:环境变量
|
||||
|
||||
添加到您的 `.env` 文件:
|
||||
|
||||
```text
|
||||
OPENAI_API_KEY=sk-...
|
||||
ANTHROPIC_API_KEY=sk-ant-...
|
||||
GOOGLE_API_KEY=...
|
||||
```
|
||||
|
||||
Langflow 会自动从这些创建全局变量。
|
||||
|
||||
### 使用 API
|
||||
|
||||
从 UI 获取您的 API 令牌:
|
||||
|
||||
1. 点击您的个人资料图标 → Settings
|
||||
2. 进入 "API Keys"
|
||||
3. 创建新的 API 密钥
|
||||
|
||||
示例:运行流
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:7860/api/v1/run/YOUR_FLOW_ID \
|
||||
-H "Authorization: Bearer YOUR_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"input_value": "Hello"}'
|
||||
```
|
||||
|
||||
### 自定义组件
|
||||
|
||||
1. 为您的组件创建一个目录
|
||||
2. 在 `.env` 中设置 `LANGFLOW_COMPONENTS_PATH`
|
||||
3. 使用您的组件类创建 Python 文件
|
||||
4. 重启 Langflow 以加载它们
|
||||
|
||||
示例组件结构:
|
||||
|
||||
```python
|
||||
from langflow import CustomComponent
|
||||
|
||||
class MyComponent(CustomComponent):
|
||||
display_name = "My Component"
|
||||
description = "Does something cool"
|
||||
|
||||
def build(self):
|
||||
# Your component logic
|
||||
return result
|
||||
```
|
||||
|
||||
## 安全注意事项
|
||||
|
||||
1. **密钥**:为生产环境生成强 `LANGFLOW_SECRET_KEY`:
|
||||
|
||||
```bash
|
||||
python -c "from secrets import token_urlsafe; print(token_urlsafe(32))"
|
||||
```
|
||||
|
||||
2. **身份验证**:设置 `LANGFLOW_AUTO_LOGIN=false` 以要求登录
|
||||
3. **数据库密码**:使用强 PostgreSQL 密码
|
||||
4. **API 密钥**:将敏感密钥存储为全局变量,而不是在流中
|
||||
5. **SSL/TLS**:在生产环境中使用带 HTTPS 的反向代理
|
||||
6. **网络访问**:使用防火墙规则限制访问
|
||||
|
||||
## 升级
|
||||
|
||||
升级 Langflow:
|
||||
|
||||
1. 在 `.env` 中更新 `LANGFLOW_VERSION`(或使用 `latest`)
|
||||
2. 拉取并重启:
|
||||
|
||||
```bash
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
3. 检查日志:
|
||||
|
||||
```bash
|
||||
docker compose logs -f langflow
|
||||
```
|
||||
|
||||
## 故障排除
|
||||
|
||||
**服务无法启动:**
|
||||
|
||||
- 检查日志:`docker compose logs langflow`
|
||||
- 验证数据库:`docker compose ps postgres`
|
||||
- 确保分配了足够的资源
|
||||
|
||||
**无法访问 UI:**
|
||||
|
||||
- 检查端口 7860 未被占用:`netstat -an | findstr 7860`
|
||||
- 验证防火墙设置
|
||||
- 检查容器健康:`docker compose ps`
|
||||
|
||||
**API 密钥不工作:**
|
||||
|
||||
- 验证密钥已在全局变量中设置
|
||||
- 检查变量名称在组件中匹配
|
||||
- 确保 `LANGFLOW_STORE_ENVIRONMENT_VARIABLES=true`
|
||||
|
||||
**流执行错误:**
|
||||
|
||||
- 检查组件配置
|
||||
- 在 UI 中每个组件下查看日志
|
||||
- 验证 API 密钥有足够的额度/权限
|
||||
|
||||
## 参考资料
|
||||
|
||||
- 官方网站:<https://langflow.org>
|
||||
- 文档:<https://docs.langflow.org>
|
||||
- GitHub:<https://github.com/langflow-ai/langflow>
|
||||
- Discord 社区:<https://discord.gg/EqksyE2EX9>
|
||||
- Docker Hub:<https://hub.docker.com/r/langflowai/langflow>
|
||||
|
||||
## 许可证
|
||||
|
||||
Langflow 使用 MIT 许可证。详情请参阅 [LICENSE](https://github.com/langflow-ai/langflow/blob/main/LICENSE)。
|
||||
129
src/langflow/docker-compose.yaml
Normal file
129
src/langflow/docker-compose.yaml
Normal file
@@ -0,0 +1,129 @@
|
||||
# Langflow - Visual Framework for Building AI Applications
|
||||
# https://github.com/langflow-ai/langflow
|
||||
#
|
||||
# Langflow is a low-code app builder for RAG and multi-agent AI applications.
|
||||
# It's Python-based and agnostic to any model, API, or database.
|
||||
#
|
||||
# Key Features:
|
||||
# - Visual flow builder for AI applications
|
||||
# - Support for multiple LLMs (OpenAI, Anthropic, Google, etc.)
|
||||
# - Built-in components for RAG, agents, and chains
|
||||
# - Custom component support
|
||||
# - Real-time monitoring and logging
|
||||
# - Multi-user support with authentication
|
||||
#
|
||||
# Default Credentials:
|
||||
# - Access UI at http://localhost:7860
|
||||
# - No authentication by default (set LANGFLOW_AUTO_LOGIN=false to enable)
|
||||
#
|
||||
# Security Notes:
|
||||
# - Set LANGFLOW_SECRET_KEY for production
|
||||
# - Use strong database passwords
|
||||
# - Enable authentication in production
|
||||
# - Store API keys as global variables, not in flows
|
||||
# - Enable SSL/TLS in production
|
||||
#
|
||||
# License: MIT (https://github.com/langflow-ai/langflow/blob/main/LICENSE)
|
||||
|
||||
x-default: &default
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
max-file: "3"
|
||||
|
||||
services:
|
||||
langflow:
|
||||
<<: *default
|
||||
image: langflowai/langflow:${LANGFLOW_VERSION:-latest}
|
||||
pull_policy: always
|
||||
container_name: langflow
|
||||
ports:
|
||||
- "${LANGFLOW_PORT_OVERRIDE:-7860}:7860"
|
||||
environment:
|
||||
# Database configuration
|
||||
- LANGFLOW_DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
|
||||
|
||||
# Storage configuration
|
||||
- LANGFLOW_CONFIG_DIR=${LANGFLOW_CONFIG_DIR:-/app/langflow}
|
||||
|
||||
# Server configuration
|
||||
- LANGFLOW_HOST=${LANGFLOW_HOST:-0.0.0.0}
|
||||
- LANGFLOW_PORT=7860
|
||||
- LANGFLOW_WORKERS=${LANGFLOW_WORKERS:-1}
|
||||
|
||||
# Authentication - IMPORTANT: Configure for production
|
||||
- LANGFLOW_AUTO_LOGIN=${LANGFLOW_AUTO_LOGIN:-true}
|
||||
- LANGFLOW_SUPERUSER=${LANGFLOW_SUPERUSER:-langflow}
|
||||
- LANGFLOW_SUPERUSER_PASSWORD=${LANGFLOW_SUPERUSER_PASSWORD:-langflow}
|
||||
- LANGFLOW_SECRET_KEY=${LANGFLOW_SECRET_KEY:-}
|
||||
|
||||
# Features
|
||||
- LANGFLOW_AUTO_SAVING=${LANGFLOW_AUTO_SAVING:-true}
|
||||
- LANGFLOW_AUTO_SAVING_INTERVAL=${LANGFLOW_AUTO_SAVING_INTERVAL:-1000}
|
||||
- LANGFLOW_STORE_ENVIRONMENT_VARIABLES=${LANGFLOW_STORE_ENVIRONMENT_VARIABLES:-true}
|
||||
- LANGFLOW_FALLBACK_TO_ENV_VAR=${LANGFLOW_FALLBACK_TO_ENV_VAR:-true}
|
||||
|
||||
# Optional: Custom components path
|
||||
- LANGFLOW_COMPONENTS_PATH=${LANGFLOW_COMPONENTS_PATH:-}
|
||||
|
||||
# Optional: Load flows from directory
|
||||
- LANGFLOW_LOAD_FLOWS_PATH=${LANGFLOW_LOAD_FLOWS_PATH:-}
|
||||
|
||||
# Logging
|
||||
- LANGFLOW_LOG_LEVEL=${LANGFLOW_LOG_LEVEL:-error}
|
||||
|
||||
# Other settings
|
||||
- TZ=${TZ:-UTC}
|
||||
- DO_NOT_TRACK=${DO_NOT_TRACK:-false}
|
||||
|
||||
volumes:
|
||||
- langflow_data:${LANGFLOW_CONFIG_DIR:-/app/langflow}
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:7860/health_check', timeout=5)"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "${LANGFLOW_CPU_LIMIT:-2.0}"
|
||||
memory: "${LANGFLOW_MEMORY_LIMIT:-2G}"
|
||||
reservations:
|
||||
cpus: "${LANGFLOW_CPU_RESERVATION:-0.5}"
|
||||
memory: "${LANGFLOW_MEMORY_RESERVATION:-512M}"
|
||||
|
||||
postgres:
|
||||
<<: *default
|
||||
image: postgres:${POSTGRES_VERSION:-16-alpine}
|
||||
container_name: langflow-postgres
|
||||
environment:
|
||||
- POSTGRES_DB=${POSTGRES_DB:-langflow}
|
||||
- POSTGRES_USER=${POSTGRES_USER:-langflow}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-langflow}
|
||||
- POSTGRES_INITDB_ARGS=--encoding=UTF8
|
||||
- TZ=${TZ:-UTC}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-langflow} -d ${POSTGRES_DB:-langflow}"]
|
||||
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:
|
||||
langflow_data:
|
||||
@@ -129,6 +129,9 @@ services:
|
||||
tty: true
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
cpus: "0.1"
|
||||
memory: "128M"
|
||||
limits:
|
||||
cpus: "0.5"
|
||||
memory: "256M"
|
||||
@@ -161,6 +164,4 @@ services:
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
temporal_data:
|
||||
driver: local
|
||||
|
||||
@@ -151,14 +151,14 @@ services:
|
||||
- "${WINDMILL_LSP_PORT:-3001}:3001"
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
cpus: "0.1"
|
||||
memory: "128M"
|
||||
limits:
|
||||
cpus: "0.5"
|
||||
memory: "512M"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
windmill_server_data:
|
||||
driver: local
|
||||
windmill_worker_data:
|
||||
driver: local
|
||||
|
||||
Reference in New Issue
Block a user