feat: add more
This commit is contained in:
118
src/n8n/README.md
Normal file
118
src/n8n/README.md
Normal file
@@ -0,0 +1,118 @@
|
||||
# n8n
|
||||
|
||||
[English](./README.md) | [中文](./README.zh.md)
|
||||
|
||||
This service deploys n8n, a fair-code workflow automation platform with native AI capabilities.
|
||||
|
||||
## Services
|
||||
|
||||
- `n8n`: The main n8n application server.
|
||||
- `n8n-db`: PostgreSQL database for n8n (optional, uses SQLite by default).
|
||||
|
||||
## Profiles
|
||||
|
||||
- `default`: Runs n8n with SQLite (no external database required).
|
||||
- `postgres`: Runs n8n with PostgreSQL database.
|
||||
|
||||
To use PostgreSQL, start with:
|
||||
|
||||
```bash
|
||||
docker compose --profile postgres up -d
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable Name | Description | Default Value |
|
||||
| ----------------------- | ------------------------------------------------ | ------------------------ |
|
||||
| N8N_VERSION | n8n image version | `1.114.0` |
|
||||
| N8N_PORT | Host port mapping for n8n web interface | `5678` |
|
||||
| N8N_BASIC_AUTH_ACTIVE | Enable basic authentication | `true` |
|
||||
| N8N_BASIC_AUTH_USER | Basic auth username (required if auth is active) | `""` |
|
||||
| N8N_BASIC_AUTH_PASSWORD | Basic auth password (required if auth is active) | `""` |
|
||||
| N8N_HOST | Host address | `0.0.0.0` |
|
||||
| N8N_PROTOCOL | Protocol (http or https) | `http` |
|
||||
| WEBHOOK_URL | Webhook URL for external access | `http://localhost:5678/` |
|
||||
| GENERIC_TIMEZONE | Timezone for n8n | `UTC` |
|
||||
| TZ | System timezone | `UTC` |
|
||||
| DB_TYPE | Database type (sqlite or postgresdb) | `sqlite` |
|
||||
| DB_POSTGRESDB_DATABASE | PostgreSQL database name | `n8n` |
|
||||
| DB_POSTGRESDB_HOST | PostgreSQL host | `n8n-db` |
|
||||
| DB_POSTGRESDB_PORT | PostgreSQL port | `5432` |
|
||||
| DB_POSTGRESDB_USER | PostgreSQL username | `n8n` |
|
||||
| DB_POSTGRESDB_PASSWORD | PostgreSQL password | `n8n123` |
|
||||
| POSTGRES_VERSION | PostgreSQL image version | `17.2-alpine3.21` |
|
||||
| EXECUTIONS_MODE | Execution mode (regular or queue) | `regular` |
|
||||
| N8N_ENCRYPTION_KEY | Encryption key for credentials | `""` |
|
||||
|
||||
Please create a `.env` file and modify it as needed for your use case.
|
||||
|
||||
## Volumes
|
||||
|
||||
- `n8n_data`: A volume for storing n8n data (workflows, credentials, etc.).
|
||||
- `n8n_db_data`: A volume for storing PostgreSQL data (when using PostgreSQL profile).
|
||||
|
||||
## Getting Started
|
||||
|
||||
### SQLite (Default)
|
||||
|
||||
1. Create a `.env` file with authentication credentials:
|
||||
|
||||
```env
|
||||
N8N_BASIC_AUTH_USER=admin
|
||||
N8N_BASIC_AUTH_PASSWORD=your-secure-password
|
||||
```
|
||||
|
||||
2. Start the service:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
3. Access n8n at `http://localhost:5678`
|
||||
|
||||
### PostgreSQL
|
||||
|
||||
1. Create a `.env` file with authentication and database credentials:
|
||||
|
||||
```env
|
||||
N8N_BASIC_AUTH_USER=admin
|
||||
N8N_BASIC_AUTH_PASSWORD=your-secure-password
|
||||
DB_TYPE=postgresdb
|
||||
DB_POSTGRESDB_PASSWORD=your-db-password
|
||||
```
|
||||
|
||||
2. Start the service with PostgreSQL profile:
|
||||
|
||||
```bash
|
||||
docker compose --profile postgres up -d
|
||||
```
|
||||
|
||||
3. Access n8n at `http://localhost:5678`
|
||||
|
||||
## Features
|
||||
|
||||
- **Visual Workflow Builder**: Create workflows with an intuitive drag-and-drop interface
|
||||
- **400+ Integrations**: Connect to popular services and APIs
|
||||
- **AI-Native**: Built-in LangChain support for AI workflows
|
||||
- **Code When Needed**: Write JavaScript/Python or use visual nodes
|
||||
- **Self-Hosted**: Full control over your data and deployments
|
||||
- **Webhook Support**: Trigger workflows from external events
|
||||
- **Scheduled Executions**: Run workflows on a schedule
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [official n8n documentation](https://docs.n8n.io/).
|
||||
|
||||
## Community Resources
|
||||
|
||||
- [n8n Community Forum](https://community.n8n.io/)
|
||||
- [Workflow Templates](https://n8n.io/workflows)
|
||||
- [Integration List](https://n8n.io/integrations)
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Always set `N8N_BASIC_AUTH_USER` and `N8N_BASIC_AUTH_PASSWORD` in production
|
||||
- Use HTTPS in production environments (set `N8N_PROTOCOL=https`)
|
||||
- Consider setting `N8N_ENCRYPTION_KEY` for credential encryption
|
||||
- Regularly backup the n8n data volume
|
||||
- Keep n8n updated to the latest stable version
|
||||
118
src/n8n/README.zh.md
Normal file
118
src/n8n/README.zh.md
Normal file
@@ -0,0 +1,118 @@
|
||||
# n8n
|
||||
|
||||
[English](./README.md) | [中文](./README.zh.md)
|
||||
|
||||
此服务部署 n8n,一个具有原生 AI 功能的公平代码工作流自动化平台。
|
||||
|
||||
## 服务
|
||||
|
||||
- `n8n`: n8n 主应用服务器。
|
||||
- `n8n-db`: n8n 的 PostgreSQL 数据库(可选,默认使用 SQLite)。
|
||||
|
||||
## 配置文件
|
||||
|
||||
- `default`: 使用 SQLite 运行 n8n(不需要外部数据库)。
|
||||
- `postgres`: 使用 PostgreSQL 数据库运行 n8n。
|
||||
|
||||
要使用 PostgreSQL,请使用以下命令启动:
|
||||
|
||||
```bash
|
||||
docker compose --profile postgres up -d
|
||||
```
|
||||
|
||||
## 环境变量
|
||||
|
||||
| 变量名 | 描述 | 默认值 |
|
||||
| ----------------------- | -------------------------------- | ------------------------ |
|
||||
| N8N_VERSION | n8n 镜像版本 | `1.114.0` |
|
||||
| N8N_PORT | n8n Web 界面的主机端口映射 | `5678` |
|
||||
| N8N_BASIC_AUTH_ACTIVE | 启用基本认证 | `true` |
|
||||
| N8N_BASIC_AUTH_USER | 基本认证用户名(认证启用时必需) | `""` |
|
||||
| N8N_BASIC_AUTH_PASSWORD | 基本认证密码(认证启用时必需) | `""` |
|
||||
| N8N_HOST | 主机地址 | `0.0.0.0` |
|
||||
| N8N_PROTOCOL | 协议(http 或 https) | `http` |
|
||||
| WEBHOOK_URL | 外部访问的 Webhook URL | `http://localhost:5678/` |
|
||||
| GENERIC_TIMEZONE | n8n 时区 | `UTC` |
|
||||
| TZ | 系统时区 | `UTC` |
|
||||
| DB_TYPE | 数据库类型(sqlite 或 postgresdb) | `sqlite` |
|
||||
| DB_POSTGRESDB_DATABASE | PostgreSQL 数据库名 | `n8n` |
|
||||
| DB_POSTGRESDB_HOST | PostgreSQL 主机 | `n8n-db` |
|
||||
| DB_POSTGRESDB_PORT | PostgreSQL 端口 | `5432` |
|
||||
| DB_POSTGRESDB_USER | PostgreSQL 用户名 | `n8n` |
|
||||
| DB_POSTGRESDB_PASSWORD | PostgreSQL 密码 | `n8n123` |
|
||||
| POSTGRES_VERSION | PostgreSQL 镜像版本 | `17.2-alpine3.21` |
|
||||
| EXECUTIONS_MODE | 执行模式(regular 或 queue) | `regular` |
|
||||
| N8N_ENCRYPTION_KEY | 凭据加密密钥 | `""` |
|
||||
|
||||
请创建 `.env` 文件并根据需要进行修改。
|
||||
|
||||
## 数据卷
|
||||
|
||||
- `n8n_data`: 用于存储 n8n 数据(工作流、凭据等)的卷。
|
||||
- `n8n_db_data`: 用于存储 PostgreSQL 数据的卷(使用 PostgreSQL 配置文件时)。
|
||||
|
||||
## 快速开始
|
||||
|
||||
### SQLite(默认)
|
||||
|
||||
1. 创建包含认证凭据的 `.env` 文件:
|
||||
|
||||
```env
|
||||
N8N_BASIC_AUTH_USER=admin
|
||||
N8N_BASIC_AUTH_PASSWORD=your-secure-password
|
||||
```
|
||||
|
||||
2. 启动服务:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
3. 访问 `http://localhost:5678`
|
||||
|
||||
### PostgreSQL
|
||||
|
||||
1. 创建包含认证和数据库凭据的 `.env` 文件:
|
||||
|
||||
```env
|
||||
N8N_BASIC_AUTH_USER=admin
|
||||
N8N_BASIC_AUTH_PASSWORD=your-secure-password
|
||||
DB_TYPE=postgresdb
|
||||
DB_POSTGRESDB_PASSWORD=your-db-password
|
||||
```
|
||||
|
||||
2. 使用 PostgreSQL 配置文件启动服务:
|
||||
|
||||
```bash
|
||||
docker compose --profile postgres up -d
|
||||
```
|
||||
|
||||
3. 访问 `http://localhost:5678`
|
||||
|
||||
## 功能特性
|
||||
|
||||
- **可视化工作流构建器**: 使用直观的拖放界面创建工作流
|
||||
- **400+ 集成**: 连接到流行的服务和 API
|
||||
- **原生 AI**: 内置 LangChain 支持用于 AI 工作流
|
||||
- **按需编码**: 编写 JavaScript/Python 或使用可视化节点
|
||||
- **自托管**: 完全控制您的数据和部署
|
||||
- **Webhook 支持**: 通过外部事件触发工作流
|
||||
- **定时执行**: 按计划运行工作流
|
||||
|
||||
## 文档
|
||||
|
||||
更多信息请访问 [n8n 官方文档](https://docs.n8n.io/)。
|
||||
|
||||
## 社区资源
|
||||
|
||||
- [n8n 社区论坛](https://community.n8n.io/)
|
||||
- [工作流模板](https://n8n.io/workflows)
|
||||
- [集成列表](https://n8n.io/integrations)
|
||||
|
||||
## 安全提示
|
||||
|
||||
- 在生产环境中始终设置 `N8N_BASIC_AUTH_USER` 和 `N8N_BASIC_AUTH_PASSWORD`
|
||||
- 在生产环境中使用 HTTPS(设置 `N8N_PROTOCOL=https`)
|
||||
- 考虑设置 `N8N_ENCRYPTION_KEY` 用于凭据加密
|
||||
- 定期备份 n8n 数据卷
|
||||
- 保持 n8n 更新到最新稳定版本
|
||||
83
src/n8n/docker-compose.yaml
Normal file
83
src/n8n/docker-compose.yaml
Normal file
@@ -0,0 +1,83 @@
|
||||
x-default: &default
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- &localtime /etc/localtime:/etc/localtime:ro
|
||||
- &timezone /etc/timezone:/etc/timezone:ro
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
|
||||
services:
|
||||
n8n:
|
||||
<<: *default
|
||||
image: n8nio/n8n:${N8N_VERSION:-1.114.0}
|
||||
container_name: n8n
|
||||
ports:
|
||||
- "${N8N_PORT:-5678}:5678"
|
||||
volumes:
|
||||
- n8n_data:/home/node/.n8n
|
||||
environment:
|
||||
- N8N_BASIC_AUTH_ACTIVE=${N8N_BASIC_AUTH_ACTIVE:-true}
|
||||
- N8N_BASIC_AUTH_USER=${N8N_BASIC_AUTH_USER:-}
|
||||
- N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD:-}
|
||||
- N8N_HOST=${N8N_HOST:-0.0.0.0}
|
||||
- N8N_PORT=${N8N_PORT:-5678}
|
||||
- N8N_PROTOCOL=${N8N_PROTOCOL:-http}
|
||||
- WEBHOOK_URL=${WEBHOOK_URL:-http://localhost:5678/}
|
||||
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE:-UTC}
|
||||
- TZ=${TZ:-UTC}
|
||||
# Database configuration (optional, uses SQLite by default)
|
||||
- DB_TYPE=${DB_TYPE:-sqlite}
|
||||
- DB_POSTGRESDB_DATABASE=${DB_POSTGRESDB_DATABASE:-n8n}
|
||||
- DB_POSTGRESDB_HOST=${DB_POSTGRESDB_HOST:-n8n-db}
|
||||
- DB_POSTGRESDB_PORT=${DB_POSTGRESDB_PORT:-5432}
|
||||
- DB_POSTGRESDB_USER=${DB_POSTGRESDB_USER:-n8n}
|
||||
- DB_POSTGRESDB_PASSWORD=${DB_POSTGRESDB_PASSWORD:-}
|
||||
# Execution mode
|
||||
- EXECUTIONS_MODE=${EXECUTIONS_MODE:-regular}
|
||||
- N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY:-}
|
||||
depends_on:
|
||||
n8n-db:
|
||||
condition: service_healthy
|
||||
profiles:
|
||||
- default
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.0'
|
||||
memory: 2G
|
||||
reservations:
|
||||
cpus: '0.5'
|
||||
memory: 512M
|
||||
|
||||
n8n-db:
|
||||
<<: *default
|
||||
image: postgres:${POSTGRES_VERSION:-17.2-alpine3.21}
|
||||
container_name: n8n-db
|
||||
environment:
|
||||
- POSTGRES_USER=${DB_POSTGRESDB_USER:-n8n}
|
||||
- POSTGRES_PASSWORD=${DB_POSTGRESDB_PASSWORD:-n8n123}
|
||||
- POSTGRES_DB=${DB_POSTGRESDB_DATABASE:-n8n}
|
||||
volumes:
|
||||
- n8n_db_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_POSTGRESDB_USER:-n8n}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
profiles:
|
||||
- postgres
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.0'
|
||||
memory: 1G
|
||||
reservations:
|
||||
cpus: '0.25'
|
||||
memory: 256M
|
||||
|
||||
volumes:
|
||||
n8n_data:
|
||||
n8n_db_data:
|
||||
Reference in New Issue
Block a user