Update MinerU, Gitea, InfluxDB, Phoenix, and Selenium configurations
- Bump MinerU version from 2.7.1 to 2.7.2 in .env.example, Dockerfile, README files, and docker-compose.yaml. - Update Gitea version from 1.25.2-rootless to 1.25.4-rootless in .env.example and docker-compose.yaml. - Add InfluxDB configuration files including .env.example, README.md, README.zh.md, and docker-compose.yaml with version 2.8.0. - Bump Phoenix version from 12.28.1-nonroot to 12.31.2-nonroot in .env.example and docker-compose.yaml, and update README files. - Introduce Selenium standalone configuration with version 144.0-20260120, including .env.example, README.md, README.zh.md, and docker-compose.yaml.
This commit is contained in:
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"yzhang.markdown-all-in-one",
|
||||
"DavidAnson.vscode-markdownlint"
|
||||
"DavidAnson.vscode-markdownlint",
|
||||
"redhat.vscode-yaml"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ These services require building custom Docker images from source.
|
||||
| [goose](./builds/goose) | 1.18.0 |
|
||||
| [IOPaint](./builds/io-paint) | 1.6.0 |
|
||||
| [K3s inside DinD](./builds/k3s-inside-dind) | 0.2.2 |
|
||||
| [MinerU vLLM](./builds/mineru) | 2.7.1 |
|
||||
| [MinerU vLLM](./builds/mineru) | 2.7.2 |
|
||||
|
||||
## Supported Services
|
||||
|
||||
@@ -50,7 +50,7 @@ These services require building custom Docker images from source.
|
||||
| [frpc](./src/frpc) | 0.65.0 |
|
||||
| [frps](./src/frps) | 0.65.0 |
|
||||
| [Gitea Runner](./src/gitea-runner) | 0.2.13 |
|
||||
| [Gitea](./src/gitea) | 1.24.6 |
|
||||
| [Gitea](./src/gitea) | 1.25.4-rootless |
|
||||
| [GitLab Runner](./src/gitlab-runner) | 17.10.1 |
|
||||
| [GitLab](./src/gitlab) | 17.10.4-ce.0 |
|
||||
| [GPUStack](./src/gpustack) | v0.5.3 |
|
||||
@@ -60,6 +60,7 @@ These services require building custom Docker images from source.
|
||||
| [Halo](./src/halo) | 2.21.9 |
|
||||
| [Harbor](./src/harbor) | v2.12.0 |
|
||||
| [HashiCorp Consul](./src/consul) | 1.20.3 |
|
||||
| [InfluxDB](./src/influxdb) | 2.8.0 |
|
||||
| [Jenkins](./src/jenkins) | 2.486-lts |
|
||||
| [JODConverter](./src/jodconverter) | latest |
|
||||
| [Kestra](./src/kestra) | latest-full |
|
||||
@@ -96,7 +97,7 @@ These services require building custom Docker images from source.
|
||||
| [Odoo](./src/odoo) | 19.0 |
|
||||
| [Ollama](./src/ollama) | 0.12.0 |
|
||||
| [Open WebUI](./src/open-webui) | main |
|
||||
| [Phoenix (Arize)](./src/phoenix) | 12.28.1-nonroot |
|
||||
| [Phoenix (Arize)](./src/phoenix) | 12.31.2-nonroot |
|
||||
| [Pingora Proxy Manager](./src/pingora-proxy-manager) | v1.0.3 |
|
||||
| [Open WebUI Rust](./src/open-webui-rust) | latest |
|
||||
| [OpenCode](./src/opencode) | 1.1.27 |
|
||||
@@ -126,6 +127,7 @@ These services require building custom Docker images from source.
|
||||
| [Restate Cluster](./src/restate-cluster) | 1.5.3 |
|
||||
| [Restate](./src/restate) | 1.5.3 |
|
||||
| [SearXNG](./src/searxng) | 2025.1.20-1ce14ef99 |
|
||||
| [Selenium](./src/selenium) | 144.0-20260120 |
|
||||
| [SigNoz](./src/signoz) | 0.55.0 |
|
||||
| [Sim](./apps/sim) | latest |
|
||||
| [Stable Diffusion WebUI](./apps/stable-diffusion-webui-docker) | latest |
|
||||
|
||||
@@ -12,7 +12,7 @@ Compose Anything 通过提供一组高质量的 Docker Compose 配置文件,
|
||||
| [goose](./builds/goose) | 1.18.0 |
|
||||
| [IOPaint](./builds/io-paint) | 1.6.0 |
|
||||
| [K3s inside DinD](./builds/k3s-inside-dind) | 0.2.2 |
|
||||
| [MinerU vLLM](./builds/mineru) | 2.7.1 |
|
||||
| [MinerU vLLM](./builds/mineru) | 2.7.2 |
|
||||
|
||||
## 已经支持的服务
|
||||
|
||||
@@ -50,7 +50,7 @@ Compose Anything 通过提供一组高质量的 Docker Compose 配置文件,
|
||||
| [frpc](./src/frpc) | 0.65.0 |
|
||||
| [frps](./src/frps) | 0.65.0 |
|
||||
| [Gitea Runner](./src/gitea-runner) | 0.2.13 |
|
||||
| [Gitea](./src/gitea) | 1.24.6 |
|
||||
| [Gitea](./src/gitea) | 1.25.4-rootless |
|
||||
| [GitLab Runner](./src/gitlab-runner) | 17.10.1 |
|
||||
| [GitLab](./src/gitlab) | 17.10.4-ce.0 |
|
||||
| [GPUStack](./src/gpustack) | v0.5.3 |
|
||||
@@ -60,6 +60,7 @@ Compose Anything 通过提供一组高质量的 Docker Compose 配置文件,
|
||||
| [Halo](./src/halo) | 2.21.9 |
|
||||
| [Harbor](./src/harbor) | v2.12.0 |
|
||||
| [HashiCorp Consul](./src/consul) | 1.20.3 |
|
||||
| [InfluxDB](./src/influxdb) | 2.8.0 |
|
||||
| [Jenkins](./src/jenkins) | 2.486-lts |
|
||||
| [JODConverter](./src/jodconverter) | latest |
|
||||
| [Kestra](./src/kestra) | latest-full |
|
||||
@@ -96,7 +97,7 @@ Compose Anything 通过提供一组高质量的 Docker Compose 配置文件,
|
||||
| [Odoo](./src/odoo) | 19.0 |
|
||||
| [Ollama](./src/ollama) | 0.12.0 |
|
||||
| [Open WebUI](./src/open-webui) | main |
|
||||
| [Phoenix (Arize)](./src/phoenix) | 12.28.1-nonroot |
|
||||
| [Phoenix (Arize)](./src/phoenix) | 12.31.2-nonroot |
|
||||
| [Pingora Proxy Manager](./src/pingora-proxy-manager) | v1.0.3 |
|
||||
| [Open WebUI Rust](./src/open-webui-rust) | latest |
|
||||
| [OpenCode](./src/opencode) | 1.1.27 |
|
||||
@@ -126,6 +127,7 @@ Compose Anything 通过提供一组高质量的 Docker Compose 配置文件,
|
||||
| [Restate Cluster](./src/restate-cluster) | 1.5.3 |
|
||||
| [Restate](./src/restate) | 1.5.3 |
|
||||
| [SearXNG](./src/searxng) | 2025.1.20-1ce14ef99 |
|
||||
| [Selenium](./src/selenium) | 144.0-20260120 |
|
||||
| [SigNoz](./src/signoz) | 0.55.0 |
|
||||
| [Sim](./apps/sim) | latest |
|
||||
| [Stable Diffusion WebUI](./apps/stable-diffusion-webui-docker) | latest |
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# MinerU Docker image
|
||||
MINERU_VERSION=2.7.1
|
||||
MINERU_VERSION=2.7.2
|
||||
|
||||
# Port configurations
|
||||
MINERU_PORT_OVERRIDE_VLLM=30000
|
||||
|
||||
@@ -19,7 +19,7 @@ RUN apt-get update && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mineru latest
|
||||
RUN python3 -m pip install -U 'mineru[core]>=2.7.1' --break-system-packages && \
|
||||
RUN python3 -m pip install -U 'mineru[core]>=2.7.2' --break-system-packages && \
|
||||
python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
|
||||
@@ -39,7 +39,7 @@ mineru -p demo.pdf -o ./output -b vlm-http-client -u http://localhost:30000
|
||||
|
||||
## Configuration
|
||||
|
||||
- `MINERU_VERSION`: The version for MinerU, default is `2.7.1`.
|
||||
- `MINERU_VERSION`: The version for MinerU, default is `2.7.2`.
|
||||
- `MINERU_PORT_OVERRIDE_VLLM`: The host port for the VLLM server, default is `30000`.
|
||||
- `MINERU_PORT_OVERRIDE_API`: The host port for the API service, default is `8000`.
|
||||
- `MINERU_PORT_OVERRIDE_GRADIO`: The host port for the Gradio WebUI, default is `7860`.
|
||||
|
||||
@@ -39,7 +39,7 @@ mineru -p demo.pdf -o ./output -b vlm-http-client -u http://localhost:30000
|
||||
|
||||
## 配置
|
||||
|
||||
- `MINERU_VERSION`: MinerU 的 Docker 镜像版本,默认为 `2.7.1`。
|
||||
- `MINERU_VERSION`: MinerU 的 Docker 镜像版本,默认为 `2.7.2`。
|
||||
- `MINERU_PORT_OVERRIDE_VLLM`: VLLM 服务器的主机端口,默认为 `30000`。
|
||||
- `MINERU_PORT_OVERRIDE_API`: API 服务的主机端口,默认为 `8000`。
|
||||
- `MINERU_PORT_OVERRIDE_GRADIO`: Gradio WebUI 的主机端口,默认为 `7860`。
|
||||
|
||||
@@ -8,7 +8,7 @@ x-defaults: &defaults
|
||||
|
||||
x-mineru-vllm: &mineru-vllm
|
||||
<<: *defaults
|
||||
image: ${GLOBAL_REGISTRY:-}alexsuntop/mineru:${MINERU_VERSION:-2.7.1}
|
||||
image: ${GLOBAL_REGISTRY:-}alexsuntop/mineru:${MINERU_VERSION:-2.7.2}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Gitea Runner version
|
||||
GITEA_RUNNER_VERSION=0.2.13-dind
|
||||
GITEA_RUNNER_VERSION=0.2.13
|
||||
|
||||
# Gitea instance URL
|
||||
INSTANCE_URL=http://localhost:3000
|
||||
|
||||
@@ -36,7 +36,7 @@ runner:
|
||||
# It works when something like `uses: actions/checkout@v4` is used and DEFAULT_ACTIONS_URL is set to github,
|
||||
# and github_mirror is not empty. In this case,
|
||||
# it replaces https://github.com with the value here, which is useful for some special network environments.
|
||||
github_mirror: ''
|
||||
github_mirror: ""
|
||||
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
|
||||
# Like: "macos-arm64:host" or "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
||||
# Find more images provided by Gitea at https://gitea.com/docker.gitea.com/runner-images .
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Gitea Version
|
||||
GITEA_VERSION=1.25.2-rootless
|
||||
GITEA_VERSION=1.25.4-rootless
|
||||
|
||||
# Database configuration
|
||||
GITEA_DB_TYPE=postgres
|
||||
|
||||
@@ -9,7 +9,7 @@ x-defaults: &defaults
|
||||
services:
|
||||
gitea:
|
||||
<<: *defaults
|
||||
image: ${GLOBAL_REGISTRY:-}gitea/gitea:${GITEA_VERSION:-1.25.2-rootless}
|
||||
image: ${GLOBAL_REGISTRY:-}gitea/gitea:${GITEA_VERSION:-1.25.4-rootless}
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
|
||||
33
src/influxdb/.env.example
Normal file
33
src/influxdb/.env.example
Normal file
@@ -0,0 +1,33 @@
|
||||
# InfluxDB Version
|
||||
INFLUXDB_VERSION=2.8.0
|
||||
|
||||
# Timezone
|
||||
TZ=UTC
|
||||
|
||||
# Initialization mode (setup or upgrade)
|
||||
INFLUXDB_INIT_MODE=setup
|
||||
|
||||
# Admin user credentials
|
||||
INFLUXDB_ADMIN_USERNAME=admin
|
||||
INFLUXDB_ADMIN_PASSWORD=changeme123456
|
||||
|
||||
# Organization name
|
||||
INFLUXDB_ORG=myorg
|
||||
|
||||
# Default bucket name
|
||||
INFLUXDB_BUCKET=mybucket
|
||||
|
||||
# Retention period (0 means infinite)
|
||||
INFLUXDB_RETENTION=0
|
||||
|
||||
# Admin token for API access
|
||||
INFLUXDB_ADMIN_TOKEN=mytoken123456
|
||||
|
||||
# Port to bind to on the host machine
|
||||
INFLUXDB_PORT_OVERRIDE=8086
|
||||
|
||||
# Resource limits
|
||||
INFLUXDB_CPU_LIMIT=2.0
|
||||
INFLUXDB_MEMORY_LIMIT=2G
|
||||
INFLUXDB_CPU_RESERVATION=0.5
|
||||
INFLUXDB_MEMORY_RESERVATION=512M
|
||||
169
src/influxdb/README.md
Normal file
169
src/influxdb/README.md
Normal file
@@ -0,0 +1,169 @@
|
||||
# InfluxDB
|
||||
|
||||
InfluxDB is a high-performance, open-source time series database designed for handling high write and query loads. It is ideal for storing and analyzing metrics, events, and real-time analytics data.
|
||||
|
||||
## Features
|
||||
|
||||
- **Time Series Optimized**: Purpose-built for time-stamped data
|
||||
- **High Performance**: Fast writes and queries for time series data
|
||||
- **SQL-like Query Language**: Flux and InfluxQL for flexible data querying
|
||||
- **Built-in UI**: Web-based interface for data exploration and visualization
|
||||
- **Retention Policies**: Automatic data expiration and downsampling
|
||||
- **Multi-tenancy**: Organizations and buckets for data isolation
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Copy the environment file and customize it:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
2. Edit `.env` to configure your InfluxDB instance:
|
||||
- `INFLUXDB_ADMIN_USERNAME`: Admin username (default: admin)
|
||||
- `INFLUXDB_ADMIN_PASSWORD`: Admin password (default: changeme123456)
|
||||
- `INFLUXDB_ORG`: Organization name (default: myorg)
|
||||
- `INFLUXDB_BUCKET`: Default bucket name (default: mybucket)
|
||||
- `INFLUXDB_ADMIN_TOKEN`: API access token (default: mytoken123456)
|
||||
|
||||
3. Start InfluxDB:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
4. Access the InfluxDB UI at `http://localhost:8086`
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Description | Default |
|
||||
| ------------------------- | ----------------------------------- | ---------------- |
|
||||
| `INFLUXDB_VERSION` | InfluxDB version | `2.8.0` |
|
||||
| `TZ` | Timezone | `UTC` |
|
||||
| `INFLUXDB_INIT_MODE` | Initialization mode (setup/upgrade) | `setup` |
|
||||
| `INFLUXDB_ADMIN_USERNAME` | Admin username | `admin` |
|
||||
| `INFLUXDB_ADMIN_PASSWORD` | Admin password | `changeme123456` |
|
||||
| `INFLUXDB_ORG` | Organization name | `myorg` |
|
||||
| `INFLUXDB_BUCKET` | Default bucket name | `mybucket` |
|
||||
| `INFLUXDB_RETENTION` | Retention period (0 for infinite) | `0` |
|
||||
| `INFLUXDB_ADMIN_TOKEN` | Admin API token | `mytoken123456` |
|
||||
| `INFLUXDB_PORT_OVERRIDE` | Host port binding | `8086` |
|
||||
|
||||
### Volumes
|
||||
|
||||
- `influxdb_data`: Stores time series data
|
||||
- `influxdb_config`: Stores configuration files
|
||||
|
||||
## Usage
|
||||
|
||||
### Accessing the Web UI
|
||||
|
||||
Open your browser and navigate to:
|
||||
|
||||
```text
|
||||
http://localhost:8086
|
||||
```
|
||||
|
||||
Login with the credentials configured in your `.env` file.
|
||||
|
||||
### Using the CLI
|
||||
|
||||
Execute commands inside the container:
|
||||
|
||||
```bash
|
||||
docker compose exec influxdb influx
|
||||
```
|
||||
|
||||
### Writing Data
|
||||
|
||||
Using the Flux query language:
|
||||
|
||||
```bash
|
||||
docker compose exec influxdb influx write \
|
||||
--bucket mybucket \
|
||||
--org myorg \
|
||||
'measurement,tag=value field=42'
|
||||
```
|
||||
|
||||
### Querying Data
|
||||
|
||||
Query data using the CLI:
|
||||
|
||||
```bash
|
||||
docker compose exec influxdb influx query \
|
||||
--org myorg \
|
||||
'from(bucket: "mybucket") |> range(start: -1h)'
|
||||
```
|
||||
|
||||
## API Access
|
||||
|
||||
InfluxDB provides a RESTful API for programmatic access:
|
||||
|
||||
```bash
|
||||
curl -X POST "http://localhost:8086/api/v2/query?org=myorg" \
|
||||
-H "Authorization: Token mytoken123456" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"query": "from(bucket: \"mybucket\") |> range(start: -1h)"}'
|
||||
```
|
||||
|
||||
## Backup and Restore
|
||||
|
||||
### Backup
|
||||
|
||||
```bash
|
||||
docker compose exec influxdb influx backup /var/lib/influxdb2/backup
|
||||
docker compose cp influxdb:/var/lib/influxdb2/backup ./backup
|
||||
```
|
||||
|
||||
### Restore
|
||||
|
||||
```bash
|
||||
docker compose cp ./backup influxdb:/var/lib/influxdb2/backup
|
||||
docker compose exec influxdb influx restore /var/lib/influxdb2/backup
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
|
||||
1. **Change Default Credentials**: Always change the default admin password and token in production
|
||||
2. **Use Strong Tokens**: Generate cryptographically secure tokens for API access
|
||||
3. **Network Security**: Consider using a reverse proxy with HTTPS in production
|
||||
4. **Access Control**: Use InfluxDB's built-in authorization system to limit access
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Container won't start
|
||||
|
||||
Check the logs:
|
||||
|
||||
```bash
|
||||
docker compose logs influxdb
|
||||
```
|
||||
|
||||
### Cannot access web UI
|
||||
|
||||
Ensure port 8086 is not in use:
|
||||
|
||||
```bash
|
||||
netstat -an | grep 8086
|
||||
```
|
||||
|
||||
### Data persistence
|
||||
|
||||
Verify volumes are properly mounted:
|
||||
|
||||
```bash
|
||||
docker compose exec influxdb ls -la /var/lib/influxdb2
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [Official Documentation](https://docs.influxdata.com/influxdb/v2/)
|
||||
- [Flux Query Language](https://docs.influxdata.com/flux/v0/)
|
||||
- [Docker Hub](https://hub.docker.com/_/influxdb)
|
||||
- [GitHub Repository](https://github.com/influxdata/influxdb)
|
||||
|
||||
## License
|
||||
|
||||
InfluxDB is available under the MIT License. See the [LICENSE](https://github.com/influxdata/influxdb/blob/master/LICENSE) file for more information.
|
||||
169
src/influxdb/README.zh.md
Normal file
169
src/influxdb/README.zh.md
Normal file
@@ -0,0 +1,169 @@
|
||||
# InfluxDB
|
||||
|
||||
InfluxDB 是一个高性能的开源时序数据库,专为处理高写入和查询负载而设计。它非常适合存储和分析指标、事件以及实时分析数据。
|
||||
|
||||
## 功能特性
|
||||
|
||||
- **时序优化**:专为时间戳数据而构建
|
||||
- **高性能**:快速的时序数据写入和查询
|
||||
- **类 SQL 查询语言**:Flux 和 InfluxQL 提供灵活的数据查询
|
||||
- **内置 UI**:基于 Web 的数据探索和可视化界面
|
||||
- **保留策略**:自动数据过期和降采样
|
||||
- **多租户**:通过组织和桶实现数据隔离
|
||||
|
||||
## 快速开始
|
||||
|
||||
1. 复制环境配置文件并自定义:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
2. 编辑 `.env` 文件配置您的 InfluxDB 实例:
|
||||
- `INFLUXDB_ADMIN_USERNAME`:管理员用户名(默认:admin)
|
||||
- `INFLUXDB_ADMIN_PASSWORD`:管理员密码(默认:changeme123456)
|
||||
- `INFLUXDB_ORG`:组织名称(默认:myorg)
|
||||
- `INFLUXDB_BUCKET`:默认桶名称(默认:mybucket)
|
||||
- `INFLUXDB_ADMIN_TOKEN`:API 访问令牌(默认:mytoken123456)
|
||||
|
||||
3. 启动 InfluxDB:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
4. 访问 InfluxDB UI:`http://localhost:8086`
|
||||
|
||||
## 配置说明
|
||||
|
||||
### 环境变量
|
||||
|
||||
| 变量 | 说明 | 默认值 |
|
||||
| ------------------------- | --------------------------- | ---------------- |
|
||||
| `INFLUXDB_VERSION` | InfluxDB 版本 | `2.8.0` |
|
||||
| `TZ` | 时区 | `UTC` |
|
||||
| `INFLUXDB_INIT_MODE` | 初始化模式(setup/upgrade) | `setup` |
|
||||
| `INFLUXDB_ADMIN_USERNAME` | 管理员用户名 | `admin` |
|
||||
| `INFLUXDB_ADMIN_PASSWORD` | 管理员密码 | `changeme123456` |
|
||||
| `INFLUXDB_ORG` | 组织名称 | `myorg` |
|
||||
| `INFLUXDB_BUCKET` | 默认桶名称 | `mybucket` |
|
||||
| `INFLUXDB_RETENTION` | 保留期限(0 表示永久) | `0` |
|
||||
| `INFLUXDB_ADMIN_TOKEN` | 管理员 API 令牌 | `mytoken123456` |
|
||||
| `INFLUXDB_PORT_OVERRIDE` | 主机端口绑定 | `8086` |
|
||||
|
||||
### 数据卷
|
||||
|
||||
- `influxdb_data`:存储时序数据
|
||||
- `influxdb_config`:存储配置文件
|
||||
|
||||
## 使用方法
|
||||
|
||||
### 访问 Web UI
|
||||
|
||||
在浏览器中打开:
|
||||
|
||||
```text
|
||||
http://localhost:8086
|
||||
```
|
||||
|
||||
使用 `.env` 文件中配置的凭据登录。
|
||||
|
||||
### 使用命令行
|
||||
|
||||
在容器内执行命令:
|
||||
|
||||
```bash
|
||||
docker compose exec influxdb influx
|
||||
```
|
||||
|
||||
### 写入数据
|
||||
|
||||
使用 Flux 查询语言:
|
||||
|
||||
```bash
|
||||
docker compose exec influxdb influx write \
|
||||
--bucket mybucket \
|
||||
--org myorg \
|
||||
'measurement,tag=value field=42'
|
||||
```
|
||||
|
||||
### 查询数据
|
||||
|
||||
使用 CLI 查询数据:
|
||||
|
||||
```bash
|
||||
docker compose exec influxdb influx query \
|
||||
--org myorg \
|
||||
'from(bucket: "mybucket") |> range(start: -1h)'
|
||||
```
|
||||
|
||||
## API 访问
|
||||
|
||||
InfluxDB 提供 RESTful API 用于编程访问:
|
||||
|
||||
```bash
|
||||
curl -X POST "http://localhost:8086/api/v2/query?org=myorg" \
|
||||
-H "Authorization: Token mytoken123456" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"query": "from(bucket: \"mybucket\") |> range(start: -1h)"}'
|
||||
```
|
||||
|
||||
## 备份与恢复
|
||||
|
||||
### 备份
|
||||
|
||||
```bash
|
||||
docker compose exec influxdb influx backup /var/lib/influxdb2/backup
|
||||
docker compose cp influxdb:/var/lib/influxdb2/backup ./backup
|
||||
```
|
||||
|
||||
### 恢复
|
||||
|
||||
```bash
|
||||
docker compose cp ./backup influxdb:/var/lib/influxdb2/backup
|
||||
docker compose exec influxdb influx restore /var/lib/influxdb2/backup
|
||||
```
|
||||
|
||||
## 安全注意事项
|
||||
|
||||
1. **修改默认凭据**:在生产环境中务必修改默认的管理员密码和令牌
|
||||
2. **使用强令牌**:为 API 访问生成加密安全的令牌
|
||||
3. **网络安全**:生产环境中考虑使用带 HTTPS 的反向代理
|
||||
4. **访问控制**:使用 InfluxDB 的内置授权系统限制访问
|
||||
|
||||
## 故障排除
|
||||
|
||||
### 容器无法启动
|
||||
|
||||
查看日志:
|
||||
|
||||
```bash
|
||||
docker compose logs influxdb
|
||||
```
|
||||
|
||||
### 无法访问 Web UI
|
||||
|
||||
确保端口 8086 未被占用:
|
||||
|
||||
```bash
|
||||
netstat -an | grep 8086
|
||||
```
|
||||
|
||||
### 数据持久化
|
||||
|
||||
验证数据卷是否正确挂载:
|
||||
|
||||
```bash
|
||||
docker compose exec influxdb ls -la /var/lib/influxdb2
|
||||
```
|
||||
|
||||
## 参考资源
|
||||
|
||||
- [官方文档](https://docs.influxdata.com/influxdb/v2/)
|
||||
- [Flux 查询语言](https://docs.influxdata.com/flux/v0/)
|
||||
- [Docker Hub](https://hub.docker.com/_/influxdb)
|
||||
- [GitHub 仓库](https://github.com/influxdata/influxdb)
|
||||
|
||||
## 许可证
|
||||
|
||||
InfluxDB 采用 MIT 许可证发布。详情请参阅 [LICENSE](https://github.com/influxdata/influxdb/blob/master/LICENSE) 文件。
|
||||
45
src/influxdb/docker-compose.yaml
Normal file
45
src/influxdb/docker-compose.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
x-defaults: &defaults
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
max-file: "3"
|
||||
|
||||
services:
|
||||
influxdb:
|
||||
<<: *defaults
|
||||
image: ${GLOBAL_REGISTRY:-}influxdb:${INFLUXDB_VERSION:-2.8.0}
|
||||
environment:
|
||||
TZ: ${TZ:-UTC}
|
||||
# InfluxDB v2 initialization
|
||||
DOCKER_INFLUXDB_INIT_MODE: ${INFLUXDB_INIT_MODE:-setup}
|
||||
DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUXDB_ADMIN_USERNAME:-admin}
|
||||
DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUXDB_ADMIN_PASSWORD:-changeme123456}
|
||||
DOCKER_INFLUXDB_INIT_ORG: ${INFLUXDB_ORG:-myorg}
|
||||
DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUXDB_BUCKET:-mybucket}
|
||||
DOCKER_INFLUXDB_INIT_RETENTION: ${INFLUXDB_RETENTION:-0}
|
||||
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_ADMIN_TOKEN:-mytoken123456}
|
||||
volumes:
|
||||
- influxdb_data:/var/lib/influxdb2
|
||||
- influxdb_config:/etc/influxdb2
|
||||
ports:
|
||||
- "${INFLUXDB_PORT_OVERRIDE:-8086}:8086"
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: ${INFLUXDB_CPU_LIMIT:-2.0}
|
||||
memory: ${INFLUXDB_MEMORY_LIMIT:-2G}
|
||||
reservations:
|
||||
cpus: ${INFLUXDB_CPU_RESERVATION:-0.5}
|
||||
memory: ${INFLUXDB_MEMORY_RESERVATION:-512M}
|
||||
healthcheck:
|
||||
test: ["CMD", "influx", "ping"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
volumes:
|
||||
influxdb_data:
|
||||
influxdb_config:
|
||||
@@ -3,7 +3,7 @@
|
||||
COMPOSE_PROFILES=sqlite
|
||||
|
||||
# Phoenix version
|
||||
PHOENIX_VERSION=12.28.1-nonroot
|
||||
PHOENIX_VERSION=12.31.2-nonroot
|
||||
|
||||
# Timezone
|
||||
TZ=UTC
|
||||
|
||||
@@ -32,7 +32,7 @@ This project supports two modes of operation via Docker Compose profiles:
|
||||
| Variable Name | Description | Default Value |
|
||||
| -------------------------------- | ---------------------------------------- | ----------------- |
|
||||
| COMPOSE_PROFILES | Active profiles (`sqlite` or `postgres`) | `sqlite` |
|
||||
| PHOENIX_VERSION | Phoenix image version | `12.28.1-nonroot` |
|
||||
| PHOENIX_VERSION | Phoenix image version | `12.31.2-nonroot` |
|
||||
| PHOENIX_PORT_OVERRIDE | Host port for Phoenix UI and HTTP API | `6006` |
|
||||
| PHOENIX_GRPC_PORT_OVERRIDE | Host port for OTLP gRPC collector | `4317` |
|
||||
| PHOENIX_PROMETHEUS_PORT_OVERRIDE | Host port for Prometheus metrics | `9090` |
|
||||
|
||||
@@ -32,7 +32,7 @@ Arize Phoenix 是一个开源的 AI 可观测性平台,专为 LLM 应用设计
|
||||
| 变量名 | 描述 | 默认值 |
|
||||
| -------------------------------- | ---------------------------------------- | ----------------- |
|
||||
| COMPOSE_PROFILES | 激活的配置文件(`sqlite` 或 `postgres`) | `sqlite` |
|
||||
| PHOENIX_VERSION | Phoenix 镜像版本 | `12.28.1-nonroot` |
|
||||
| PHOENIX_VERSION | Phoenix 镜像版本 | `12.31.2-nonroot` |
|
||||
| PHOENIX_PORT_OVERRIDE | Phoenix UI 和 HTTP API 的主机端口 | `6006` |
|
||||
| PHOENIX_GRPC_PORT_OVERRIDE | OTLP gRPC 采集器的主机端口 | `4317` |
|
||||
| PHOENIX_PROMETHEUS_PORT_OVERRIDE | Prometheus 指标的主机端口 | `9090` |
|
||||
|
||||
@@ -11,7 +11,7 @@ x-defaults: &defaults
|
||||
|
||||
x-phoenix-common: &phoenix-common
|
||||
<<: *defaults
|
||||
image: ${GLOBAL_REGISTRY:-}arizephoenix/phoenix:${PHOENIX_VERSION:-12.28.1-nonroot}
|
||||
image: ${GLOBAL_REGISTRY:-}arizephoenix/phoenix:${PHOENIX_VERSION:-12.31.2-nonroot}
|
||||
ports:
|
||||
- "${PHOENIX_PORT_OVERRIDE:-6006}:6006" # UI and OTLP HTTP collector
|
||||
- "${PHOENIX_GRPC_PORT_OVERRIDE:-4317}:4317" # OTLP gRPC collector
|
||||
|
||||
48
src/selenium/.env.example
Normal file
48
src/selenium/.env.example
Normal file
@@ -0,0 +1,48 @@
|
||||
# Selenium Standalone Configuration
|
||||
|
||||
# Image Registry (optional)
|
||||
# GLOBAL_REGISTRY=
|
||||
|
||||
# Selenium Version (stable version tag recommended)
|
||||
# Visit https://hub.docker.com/r/selenium/standalone-chrome/tags for available versions
|
||||
# Format: <browser-version>-<date> or <browser-version>-chromedriver-<driver-version>-grid-<grid-version>-<date>
|
||||
SELENIUM_VERSION=144.0-20260120
|
||||
|
||||
# Shared Memory Size (required for browser stability)
|
||||
# Chrome and Firefox need sufficient shared memory to prevent crashes
|
||||
SELENIUM_SHM_SIZE=2g
|
||||
|
||||
# Port Configuration
|
||||
# Selenium Grid HTTP port
|
||||
SELENIUM_GRID_PORT_OVERRIDE=4444
|
||||
# VNC port for viewing browser sessions (browser debugger)
|
||||
SELENIUM_VNC_PORT_OVERRIDE=7900
|
||||
|
||||
# Timezone
|
||||
TZ=UTC
|
||||
|
||||
# Screen Resolution Settings
|
||||
SE_SCREEN_WIDTH=1920
|
||||
SE_SCREEN_HEIGHT=1080
|
||||
SE_SCREEN_DEPTH=24
|
||||
SE_SCREEN_DPI=96
|
||||
|
||||
# VNC Configuration
|
||||
# Password for VNC access (default: secret)
|
||||
SE_VNC_PASSWORD=secret
|
||||
|
||||
# Session Configuration
|
||||
# Maximum concurrent sessions per container
|
||||
SE_NODE_MAX_SESSIONS=1
|
||||
# Session timeout in seconds (default: 300)
|
||||
SE_NODE_SESSION_TIMEOUT=300
|
||||
|
||||
# Xvfb Configuration
|
||||
# Start virtual display server (required for headless mode in Chrome/Chromium v127+)
|
||||
SE_START_XVFB=true
|
||||
|
||||
# Resource Limits
|
||||
SELENIUM_CPU_LIMIT=2.0
|
||||
SELENIUM_MEMORY_LIMIT=2G
|
||||
SELENIUM_CPU_RESERVATION=1.0
|
||||
SELENIUM_MEMORY_RESERVATION=1G
|
||||
281
src/selenium/README.md
Normal file
281
src/selenium/README.md
Normal file
@@ -0,0 +1,281 @@
|
||||
# Selenium Standalone with Chrome
|
||||
|
||||
[](https://hub.docker.com/r/selenium/standalone-chrome)
|
||||
[](https://hub.docker.com/r/selenium/standalone-chrome)
|
||||
[](https://github.com/SeleniumHQ/docker-selenium/blob/trunk/LICENSE.md)
|
||||
|
||||
Selenium Grid in Standalone mode with Chrome browser for browser automation at scale.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Start the service
|
||||
docker compose up -d
|
||||
|
||||
# Verify the service is running
|
||||
docker compose ps
|
||||
|
||||
# View logs
|
||||
docker compose logs -f
|
||||
|
||||
# Stop the service
|
||||
docker compose down
|
||||
```
|
||||
|
||||
## Service Information
|
||||
|
||||
### Ports
|
||||
|
||||
| Port | Service | Description |
|
||||
| ---- | ------------- | -------------------------------------------- |
|
||||
| 4444 | Selenium Grid | HTTP endpoint for WebDriver |
|
||||
| 7900 | noVNC | Browser viewing interface (password: secret) |
|
||||
|
||||
### Default Credentials
|
||||
|
||||
- VNC Password: `secret` (configurable via `SE_VNC_PASSWORD`)
|
||||
|
||||
### Volumes
|
||||
|
||||
- `selenium_downloads`: Browser downloads directory (`/home/seluser/Downloads`)
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
All configuration can be customized via the `.env` file:
|
||||
|
||||
```bash
|
||||
# Copy the example configuration
|
||||
cp .env.example .env
|
||||
|
||||
# Edit the configuration
|
||||
nano .env
|
||||
```
|
||||
|
||||
Key configurations:
|
||||
|
||||
| Variable | Default | Description |
|
||||
| ----------------------------- | ---------------- | --------------------------------------------------- |
|
||||
| `SELENIUM_VERSION` | `144.0-20260120` | Docker image tag (Chrome version + date) |
|
||||
| `SELENIUM_SHM_SIZE` | `2g` | Shared memory size (required for browser stability) |
|
||||
| `SELENIUM_GRID_PORT_OVERRIDE` | `4444` | Grid HTTP endpoint port |
|
||||
| `SELENIUM_VNC_PORT_OVERRIDE` | `7900` | noVNC viewer port |
|
||||
| `SE_SCREEN_WIDTH` | `1920` | Browser screen width |
|
||||
| `SE_SCREEN_HEIGHT` | `1080` | Browser screen height |
|
||||
| `SE_NODE_MAX_SESSIONS` | `1` | Max concurrent sessions per container |
|
||||
| `SE_NODE_SESSION_TIMEOUT` | `300` | Session timeout in seconds |
|
||||
|
||||
For a complete list of environment variables, see the [Selenium Docker documentation](https://github.com/SeleniumHQ/docker-selenium/blob/trunk/ENV_VARIABLES.md).
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic WebDriver Test (Python)
|
||||
|
||||
```python
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Configure Chrome options
|
||||
options = Options()
|
||||
|
||||
# Connect to Selenium Grid
|
||||
driver = webdriver.Remote(
|
||||
command_executor='http://localhost:4444',
|
||||
options=options
|
||||
)
|
||||
|
||||
# Run your test
|
||||
driver.get('https://www.selenium.dev/')
|
||||
print(driver.title)
|
||||
|
||||
# Clean up
|
||||
driver.quit()
|
||||
```
|
||||
|
||||
### Basic WebDriver Test (Node.js)
|
||||
|
||||
```javascript
|
||||
const { Builder } = require('selenium-webdriver');
|
||||
const chrome = require('selenium-webdriver/chrome');
|
||||
|
||||
(async function example() {
|
||||
let driver = await new Builder()
|
||||
.forBrowser('chrome')
|
||||
.usingServer('http://localhost:4444')
|
||||
.build();
|
||||
|
||||
try {
|
||||
await driver.get('https://www.selenium.dev/');
|
||||
console.log(await driver.getTitle());
|
||||
} finally {
|
||||
await driver.quit();
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
### Viewing Browser Sessions
|
||||
|
||||
You can watch tests execute in real-time using noVNC:
|
||||
|
||||
1. Open your browser to `http://localhost:7900/?autoconnect=1&resize=scale&password=secret`
|
||||
2. The default VNC password is `secret`
|
||||
3. You'll see the browser session in real-time
|
||||
|
||||
Alternatively, use a VNC client to connect to `localhost:5900` (if exposed).
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
### Changing Browser Version
|
||||
|
||||
To use a specific Chrome version, update the `SELENIUM_VERSION` in your `.env` file:
|
||||
|
||||
```bash
|
||||
# Use Chrome 143.0
|
||||
SELENIUM_VERSION=143.0-20260120
|
||||
|
||||
# Or use a specific Selenium Grid version
|
||||
SELENIUM_VERSION=144.0-chromedriver-144.0-grid-4.40.0-20260120
|
||||
```
|
||||
|
||||
Visit [Docker Hub](https://hub.docker.com/r/selenium/standalone-chrome/tags) for available versions.
|
||||
|
||||
### Increasing Concurrent Sessions
|
||||
|
||||
To run multiple concurrent sessions in one container (not recommended for production):
|
||||
|
||||
```bash
|
||||
SE_NODE_MAX_SESSIONS=5
|
||||
```
|
||||
|
||||
**Note:** For better stability, scale containers instead:
|
||||
|
||||
```bash
|
||||
docker compose up -d --scale selenium-chrome=3
|
||||
```
|
||||
|
||||
### Retrieving Downloaded Files
|
||||
|
||||
To access files downloaded during tests, mount the downloads directory:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- ./downloads:/home/seluser/Downloads
|
||||
```
|
||||
|
||||
**Linux users:** Set proper permissions before mounting:
|
||||
|
||||
```bash
|
||||
mkdir -p ./downloads
|
||||
sudo chown 1200:1201 ./downloads
|
||||
```
|
||||
|
||||
### Running in Headless Mode
|
||||
|
||||
For newer Chrome versions (127+), headless mode requires Xvfb:
|
||||
|
||||
```bash
|
||||
SE_START_XVFB=true
|
||||
```
|
||||
|
||||
Then configure headless in your test:
|
||||
|
||||
```python
|
||||
options = Options()
|
||||
options.add_argument('--headless=new')
|
||||
```
|
||||
|
||||
### Custom Screen Resolution
|
||||
|
||||
Adjust screen resolution for your test needs:
|
||||
|
||||
```bash
|
||||
SE_SCREEN_WIDTH=1366
|
||||
SE_SCREEN_HEIGHT=768
|
||||
SE_SCREEN_DEPTH=24
|
||||
SE_SCREEN_DPI=74
|
||||
```
|
||||
|
||||
## Health Check
|
||||
|
||||
The container includes a built-in health check that polls the Grid status endpoint every 30 seconds:
|
||||
|
||||
```bash
|
||||
# Check container health
|
||||
docker compose ps
|
||||
|
||||
# Or inspect the health status
|
||||
docker inspect --format='{{json .State.Health.Status}}' <container-id>
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Browser Crashes
|
||||
|
||||
If you see errors like "Chrome failed to start" or "invalid argument: can't kill an exited process":
|
||||
|
||||
1. **Ensure sufficient shared memory:** The default `2g` should work for most cases
|
||||
|
||||
```bash
|
||||
SELENIUM_SHM_SIZE=2g
|
||||
```
|
||||
|
||||
2. **Check headless mode configuration:** Make sure `SE_START_XVFB=true` if using headless mode with Chrome 127+
|
||||
|
||||
### Permission Issues (Linux)
|
||||
|
||||
When mounting volumes on Linux, ensure correct permissions:
|
||||
|
||||
```bash
|
||||
# For downloads directory
|
||||
mkdir -p ./downloads
|
||||
sudo chown 1200:1201 ./downloads
|
||||
|
||||
# Check user/group IDs in container
|
||||
docker compose exec selenium-chrome id
|
||||
```
|
||||
|
||||
### Resource Constraints
|
||||
|
||||
If tests are slow or containers are being OOM killed:
|
||||
|
||||
```bash
|
||||
# Increase resource limits
|
||||
SELENIUM_CPU_LIMIT=4.0
|
||||
SELENIUM_MEMORY_LIMIT=4G
|
||||
```
|
||||
|
||||
### VNC Connection Issues
|
||||
|
||||
If you can't connect to VNC:
|
||||
|
||||
1. Check that port 7900 is not in use
|
||||
2. Verify the VNC password is correct (default: `secret`)
|
||||
3. Try disabling VNC authentication: `SE_VNC_NO_PASSWORD=true`
|
||||
|
||||
## Multi-Browser Support
|
||||
|
||||
For running multiple browser types (Chrome, Firefox, Edge), consider using:
|
||||
|
||||
- **Hub & Nodes architecture:** See `docker-compose-grid.yaml` example
|
||||
- **Dynamic Grid:** Automatically spawns containers on demand
|
||||
- **Selenium Grid 4:** Full distributed mode with Router, Distributor, etc.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Selenium Documentation](https://www.selenium.dev/documentation/)
|
||||
- [Docker Selenium GitHub](https://github.com/SeleniumHQ/docker-selenium)
|
||||
- [Selenium Grid Configuration](https://www.selenium.dev/documentation/grid/)
|
||||
- [Environment Variables Reference](https://github.com/SeleniumHQ/docker-selenium/blob/trunk/ENV_VARIABLES.md)
|
||||
|
||||
## Security Notes
|
||||
|
||||
- **VNC Password:** Change the default `secret` password in production
|
||||
- **Network Exposure:** Do not expose Selenium Grid directly to the internet
|
||||
- **Resource Limits:** Always set CPU and memory limits to prevent resource exhaustion
|
||||
- **User Permissions:** Selenium runs as non-root user `seluser` (UID 1200, GID 1201)
|
||||
|
||||
## License
|
||||
|
||||
This configuration is provided under the Apache License 2.0, following the Selenium project's licensing.
|
||||
The Selenium Docker images are maintained by the SeleniumHQ team and community contributors.
|
||||
281
src/selenium/README.zh.md
Normal file
281
src/selenium/README.zh.md
Normal file
@@ -0,0 +1,281 @@
|
||||
# Selenium Standalone Chrome
|
||||
|
||||
[](https://hub.docker.com/r/selenium/standalone-chrome)
|
||||
[](https://hub.docker.com/r/selenium/standalone-chrome)
|
||||
[](https://github.com/SeleniumHQ/docker-selenium/blob/trunk/LICENSE.md)
|
||||
|
||||
Selenium Grid 独立模式,配备 Chrome 浏览器,用于大规模浏览器自动化。
|
||||
|
||||
## 快速开始
|
||||
|
||||
```bash
|
||||
# 启动服务
|
||||
docker compose up -d
|
||||
|
||||
# 验证服务运行状态
|
||||
docker compose ps
|
||||
|
||||
# 查看日志
|
||||
docker compose logs -f
|
||||
|
||||
# 停止服务
|
||||
docker compose down
|
||||
```
|
||||
|
||||
## 服务信息
|
||||
|
||||
### 端口
|
||||
|
||||
| 端口 | 服务 | 说明 |
|
||||
| ---- | ------------- | ------------------------------ |
|
||||
| 4444 | Selenium Grid | WebDriver HTTP 端点 |
|
||||
| 7900 | noVNC | 浏览器查看界面(密码:secret) |
|
||||
|
||||
### 默认凭据
|
||||
|
||||
- VNC 密码:`secret`(可通过 `SE_VNC_PASSWORD` 配置)
|
||||
|
||||
### 数据卷
|
||||
|
||||
- `selenium_downloads`:浏览器下载目录(`/home/seluser/Downloads`)
|
||||
|
||||
## 配置说明
|
||||
|
||||
### 环境变量
|
||||
|
||||
所有配置都可以通过 `.env` 文件自定义:
|
||||
|
||||
```bash
|
||||
# 复制示例配置文件
|
||||
cp .env.example .env
|
||||
|
||||
# 编辑配置
|
||||
nano .env
|
||||
```
|
||||
|
||||
主要配置:
|
||||
|
||||
| 变量 | 默认值 | 说明 |
|
||||
| ----------------------------- | ---------------- | ------------------------------------- |
|
||||
| `SELENIUM_VERSION` | `144.0-20260120` | Docker 镜像标签(Chrome 版本 + 日期) |
|
||||
| `SELENIUM_SHM_SIZE` | `2g` | 共享内存大小(浏览器稳定性所需) |
|
||||
| `SELENIUM_GRID_PORT_OVERRIDE` | `4444` | Grid HTTP 端点端口 |
|
||||
| `SELENIUM_VNC_PORT_OVERRIDE` | `7900` | noVNC 查看器端口 |
|
||||
| `SE_SCREEN_WIDTH` | `1920` | 浏览器屏幕宽度 |
|
||||
| `SE_SCREEN_HEIGHT` | `1080` | 浏览器屏幕高度 |
|
||||
| `SE_NODE_MAX_SESSIONS` | `1` | 每个容器最大并发会话数 |
|
||||
| `SE_NODE_SESSION_TIMEOUT` | `300` | 会话超时时间(秒) |
|
||||
|
||||
完整的环境变量列表请参考 [Selenium Docker 文档](https://github.com/SeleniumHQ/docker-selenium/blob/trunk/ENV_VARIABLES.md)。
|
||||
|
||||
## 使用方法
|
||||
|
||||
### 基础 WebDriver 测试(Python)
|
||||
|
||||
```python
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# 配置 Chrome 选项
|
||||
options = Options()
|
||||
|
||||
# 连接到 Selenium Grid
|
||||
driver = webdriver.Remote(
|
||||
command_executor='http://localhost:4444',
|
||||
options=options
|
||||
)
|
||||
|
||||
# 运行测试
|
||||
driver.get('https://www.selenium.dev/')
|
||||
print(driver.title)
|
||||
|
||||
# 清理资源
|
||||
driver.quit()
|
||||
```
|
||||
|
||||
### 基础 WebDriver 测试(Node.js)
|
||||
|
||||
```javascript
|
||||
const { Builder } = require('selenium-webdriver');
|
||||
const chrome = require('selenium-webdriver/chrome');
|
||||
|
||||
(async function example() {
|
||||
let driver = await new Builder()
|
||||
.forBrowser('chrome')
|
||||
.usingServer('http://localhost:4444')
|
||||
.build();
|
||||
|
||||
try {
|
||||
await driver.get('https://www.selenium.dev/');
|
||||
console.log(await driver.getTitle());
|
||||
} finally {
|
||||
await driver.quit();
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
### 查看浏览器会话
|
||||
|
||||
您可以使用 noVNC 实时查看测试执行过程:
|
||||
|
||||
1. 在浏览器中打开 `http://localhost:7900/?autoconnect=1&resize=scale&password=secret`
|
||||
2. 默认 VNC 密码是 `secret`
|
||||
3. 您将实时看到浏览器会话
|
||||
|
||||
或者,使用 VNC 客户端连接到 `localhost:5900`(如果已暴露)。
|
||||
|
||||
## 高级配置
|
||||
|
||||
### 更改浏览器版本
|
||||
|
||||
要使用特定的 Chrome 版本,请在 `.env` 文件中更新 `SELENIUM_VERSION`:
|
||||
|
||||
```bash
|
||||
# 使用 Chrome 143.0
|
||||
SELENIUM_VERSION=143.0-20260120
|
||||
|
||||
# 或使用特定的 Selenium Grid 版本
|
||||
SELENIUM_VERSION=144.0-chromedriver-144.0-grid-4.40.0-20260120
|
||||
```
|
||||
|
||||
访问 [Docker Hub](https://hub.docker.com/r/selenium/standalone-chrome/tags) 查看可用版本。
|
||||
|
||||
### 增加并发会话数
|
||||
|
||||
在单个容器中运行多个并发会话(生产环境不推荐):
|
||||
|
||||
```bash
|
||||
SE_NODE_MAX_SESSIONS=5
|
||||
```
|
||||
|
||||
**注意:** 为了更好的稳定性,建议通过扩展容器来实现:
|
||||
|
||||
```bash
|
||||
docker compose up -d --scale selenium-chrome=3
|
||||
```
|
||||
|
||||
### 获取下载的文件
|
||||
|
||||
要访问测试期间下载的文件,挂载下载目录:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- ./downloads:/home/seluser/Downloads
|
||||
```
|
||||
|
||||
**Linux 用户:** 挂载前设置正确的权限:
|
||||
|
||||
```bash
|
||||
mkdir -p ./downloads
|
||||
sudo chown 1200:1201 ./downloads
|
||||
```
|
||||
|
||||
### 无头模式运行
|
||||
|
||||
对于新版 Chrome(127+),无头模式需要 Xvfb:
|
||||
|
||||
```bash
|
||||
SE_START_XVFB=true
|
||||
```
|
||||
|
||||
然后在测试中配置无头模式:
|
||||
|
||||
```python
|
||||
options = Options()
|
||||
options.add_argument('--headless=new')
|
||||
```
|
||||
|
||||
### 自定义屏幕分辨率
|
||||
|
||||
根据测试需求调整屏幕分辨率:
|
||||
|
||||
```bash
|
||||
SE_SCREEN_WIDTH=1366
|
||||
SE_SCREEN_HEIGHT=768
|
||||
SE_SCREEN_DEPTH=24
|
||||
SE_SCREEN_DPI=74
|
||||
```
|
||||
|
||||
## 健康检查
|
||||
|
||||
容器包含内置的健康检查,每 30 秒轮询 Grid 状态端点:
|
||||
|
||||
```bash
|
||||
# 检查容器健康状态
|
||||
docker compose ps
|
||||
|
||||
# 或检查健康状态详情
|
||||
docker inspect --format='{{json .State.Health.Status}}' <container-id>
|
||||
```
|
||||
|
||||
## 故障排除
|
||||
|
||||
### 浏览器崩溃
|
||||
|
||||
如果看到 "Chrome failed to start" 或 "invalid argument: can't kill an exited process" 等错误:
|
||||
|
||||
1. **确保足够的共享内存:** 默认的 `2g` 应该适用于大多数情况
|
||||
|
||||
```bash
|
||||
SELENIUM_SHM_SIZE=2g
|
||||
```
|
||||
|
||||
2. **检查无头模式配置:** 如果在 Chrome 127+ 中使用无头模式,请确保 `SE_START_XVFB=true`
|
||||
|
||||
### 权限问题(Linux)
|
||||
|
||||
在 Linux 上挂载卷时,确保正确的权限:
|
||||
|
||||
```bash
|
||||
# 对于下载目录
|
||||
mkdir -p ./downloads
|
||||
sudo chown 1200:1201 ./downloads
|
||||
|
||||
# 检查容器中的用户/组 ID
|
||||
docker compose exec selenium-chrome id
|
||||
```
|
||||
|
||||
### 资源限制
|
||||
|
||||
如果测试缓慢或容器被 OOM 终止:
|
||||
|
||||
```bash
|
||||
# 增加资源限制
|
||||
SELENIUM_CPU_LIMIT=4.0
|
||||
SELENIUM_MEMORY_LIMIT=4G
|
||||
```
|
||||
|
||||
### VNC 连接问题
|
||||
|
||||
如果无法连接到 VNC:
|
||||
|
||||
1. 检查端口 7900 是否被占用
|
||||
2. 验证 VNC 密码是否正确(默认:`secret`)
|
||||
3. 尝试禁用 VNC 认证:`SE_VNC_NO_PASSWORD=true`
|
||||
|
||||
## 多浏览器支持
|
||||
|
||||
要运行多种浏览器类型(Chrome、Firefox、Edge),请考虑使用:
|
||||
|
||||
- **Hub & Nodes 架构:** 参见 `docker-compose-grid.yaml` 示例
|
||||
- **动态 Grid:** 按需自动生成容器
|
||||
- **Selenium Grid 4:** 完整的分布式模式,包含 Router、Distributor 等
|
||||
|
||||
## 其他资源
|
||||
|
||||
- [Selenium 文档](https://www.selenium.dev/documentation/)
|
||||
- [Docker Selenium GitHub](https://github.com/SeleniumHQ/docker-selenium)
|
||||
- [Selenium Grid 配置](https://www.selenium.dev/documentation/grid/)
|
||||
- [环境变量参考](https://github.com/SeleniumHQ/docker-selenium/blob/trunk/ENV_VARIABLES.md)
|
||||
|
||||
## 安全注意事项
|
||||
|
||||
- **VNC 密码:** 生产环境中更改默认的 `secret` 密码
|
||||
- **网络暴露:** 不要将 Selenium Grid 直接暴露到互联网
|
||||
- **资源限制:** 始终设置 CPU 和内存限制以防止资源耗尽
|
||||
- **用户权限:** Selenium 以非 root 用户 `seluser` 运行(UID 1200,GID 1201)
|
||||
|
||||
## 许可证
|
||||
|
||||
本配置遵循 Apache License 2.0 提供,与 Selenium 项目的许可保持一致。
|
||||
Selenium Docker 镜像由 SeleniumHQ 团队和社区贡献者维护。
|
||||
50
src/selenium/docker-compose.yaml
Normal file
50
src/selenium/docker-compose.yaml
Normal file
@@ -0,0 +1,50 @@
|
||||
# Selenium Standalone with Chrome
|
||||
# This configuration runs Selenium Grid in Standalone mode with Chrome browser
|
||||
# Suitable for single-browser automation needs
|
||||
|
||||
x-defaults: &defaults
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
max-file: "3"
|
||||
|
||||
services:
|
||||
selenium-chrome:
|
||||
<<: *defaults
|
||||
image: ${GLOBAL_REGISTRY:-}selenium/standalone-chrome:${SELENIUM_VERSION:-144.0-20260120}
|
||||
shm_size: ${SELENIUM_SHM_SIZE:-2g}
|
||||
ports:
|
||||
- "${SELENIUM_GRID_PORT_OVERRIDE:-4444}:4444"
|
||||
- "${SELENIUM_VNC_PORT_OVERRIDE:-7900}:7900"
|
||||
volumes:
|
||||
- selenium_downloads:/home/seluser/Downloads
|
||||
environment:
|
||||
- TZ=${TZ:-UTC}
|
||||
- SE_SCREEN_WIDTH=${SE_SCREEN_WIDTH:-1920}
|
||||
- SE_SCREEN_HEIGHT=${SE_SCREEN_HEIGHT:-1080}
|
||||
- SE_SCREEN_DEPTH=${SE_SCREEN_DEPTH:-24}
|
||||
- SE_SCREEN_DPI=${SE_SCREEN_DPI:-96}
|
||||
- SE_VNC_PASSWORD=${SE_VNC_PASSWORD:-secret}
|
||||
- SE_NODE_MAX_SESSIONS=${SE_NODE_MAX_SESSIONS:-1}
|
||||
- SE_NODE_SESSION_TIMEOUT=${SE_NODE_SESSION_TIMEOUT:-300}
|
||||
- SE_START_XVFB=${SE_START_XVFB:-true}
|
||||
healthcheck:
|
||||
test:
|
||||
["CMD", "/opt/bin/check-grid.sh", "--host", "0.0.0.0", "--port", "4444"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: ${SELENIUM_CPU_LIMIT:-2.0}
|
||||
memory: ${SELENIUM_MEMORY_LIMIT:-2G}
|
||||
reservations:
|
||||
cpus: ${SELENIUM_CPU_RESERVATION:-1.0}
|
||||
memory: ${SELENIUM_MEMORY_RESERVATION:-1G}
|
||||
|
||||
volumes:
|
||||
selenium_downloads:
|
||||
Reference in New Issue
Block a user