refactor: playwright 替换 selenium

This commit is contained in:
xuwei-fit2cloud
2026-03-11 15:58:04 +08:00
parent 511247b4c5
commit 11f6909284
6 changed files with 32 additions and 31 deletions

View File

@@ -0,0 +1,23 @@
version: '3.8'
services:
api:
image: registry.cn-qingdao.aliyuncs.com/dataease/de-playwright-api:v1.58.2-noble
container_name: de-playwright-api
privileged: true
environment:
- CONCURRENCY=${DE_PLAYWRIGHT_CONCURRENCY}
volumes:
- ${DE_BASE}/dataease2.0/logs:/opt/app/logs
restart: unless-stopped
init: true
ipc: host
shm_size: ${DE_PLAYWRIGHT_SHM_SIZE}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
networks:
- dataease-network

View File

@@ -1,19 +0,0 @@
version: '3'
services:
de-selenium:
image: registry.cn-qingdao.aliyuncs.com/dataease/standalone-chromium:123.0
container_name: de-selenium
shm_size: 2gb
privileged: true
deploy:
resources:
limits:
cpus: ${DE_SELENIUM_CPU_LIMIT}
memory: ${DE_SELENIUM_MEM_LIMIT}
environment:
- SE_ENABLE_BROWSER_LEFTOVERS_CLEANUP=true
- SE_NODE_OVERRIDE_MAX_SESSIONS=true
- SE_NODE_MAX_SESSIONS=5
- TZ=Asia/Shanghai
networks:
- dataease-network

View File

@@ -23,8 +23,8 @@ dataease:
limit: ${DE_EXPORT_DATASET_LIMIT}
origin-list: ${DE_ORIGIN_LIST}
login_timeout: ${DE_LOGIN_TIMEOUT}
selenium-server: ${DE_SELENIUM_SERVER}
dataease-servers: ${DE_SERVERS}
playwright-server: ${DE_PLAYWRIGHT_SERVER}
task:
executor:
address: http://sync-task-actuator:9001

View File

@@ -58,8 +58,8 @@ function _generate_compose_file_args() {
compose_files="${compose_files} -f docker-compose-task.yml"
fi
if [[ -f $DE_RUNNING_BASE/docker-compose-selenium.yml ]] && [[ "$DE_EXTERNAL_SELENIUM" != "true" ]];then
compose_files="${compose_files} -f docker-compose-selenium.yml"
if [[ -f $DE_RUNNING_BASE/docker-compose-playwright.yml ]] && [[ "$DE_EXTERNAL_PLAYWRIGHT" != "true" ]];then
compose_files="${compose_files} -f docker-compose-playwright.yml"
fi
fi
}

View File

@@ -27,14 +27,11 @@ DE_MYSQL_PASSWORD=Password123@mysql
DE_MYSQL_PARAMS="autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true"
# 定时报告镜像配置
## 是否使用外部 Selenium若使用外部 Selenium,则限制参数无效
DE_EXTERNAL_SELENIUM=false
## Selenium 服务地址
DE_SELENIUM_SERVER=http://de-selenium:4444/wd/hub
## selenium 镜像 CPU 限制
DE_SELENIUM_CPU_LIMIT='1'
## selenium 镜像 内存 限制
DE_SELENIUM_MEM_LIMIT=2g
## 是否使用外部 Playwright若使用外部 Playwright,则限制参数无效
DE_EXTERNAL_PLAYWRIGHT=false
DE_PLAYWRIGHT_SERVER=http://de-playwright-api:3000/screenshot
DE_PLAYWRIGHT_CONCURRENCY=4
DE_PLAYWRIGHT_SHM_SIZE=2gb
# APISIX配置
## 是否使用外部 APISIX