- 新增PostgreSQL数据库支持,包含内置和外部数据库两种部署模式 - 实现机台管理功能,包括保护状态控制和VHD关键词设置 - 添加用户认证系统,支持会话管理和权限控制 - 更新Docker配置,支持数据库持久化和健康检查 - 扩展API接口,提供完整的RESTful API文档 - 更新客户端代码以支持机台ID和保护检查功能 - 添加数据库初始化脚本和配置指南
59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
vhd-select-server:
|
|
image: lty271104/vhd-select-server:latest
|
|
ports:
|
|
- "8082:8080"
|
|
volumes:
|
|
- ./config:/app/config
|
|
- ./vhd-data:/app/vhd-data
|
|
# 内置数据库数据持久化
|
|
- vhd_db_data:/var/lib/postgresql/data
|
|
environment:
|
|
# 应用配置
|
|
- NODE_ENV=production
|
|
- PORT=8080
|
|
- CONFIG_PATH=/app/config
|
|
|
|
# 数据库配置 - 使用内置数据库
|
|
- USE_EMBEDDED_DB=true
|
|
- DB_HOST=localhost
|
|
- DB_PORT=5432
|
|
- DB_NAME=vhd_select
|
|
- DB_USER=postgres
|
|
- DB_PASSWORD=vhd_select_password
|
|
|
|
# 可选的数据库连接配置
|
|
- DB_MAX_CONNECTIONS=20
|
|
- DB_IDLE_TIMEOUT=30000
|
|
- DB_CONNECTION_TIMEOUT=5000
|
|
- DB_SSL=false
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
restart: unless-stopped
|
|
|
|
# 外部数据库示例配置(可选)
|
|
# 如果要使用外部数据库,请取消注释以下配置并修改上面的环境变量
|
|
# postgres:
|
|
# image: postgres:15-alpine
|
|
# environment:
|
|
# - POSTGRES_DB=vhd_select
|
|
# - POSTGRES_USER=postgres
|
|
# - POSTGRES_PASSWORD=vhd_select_password
|
|
# volumes:
|
|
# - postgres_data:/var/lib/postgresql/data
|
|
# - ./init-db.sql:/docker-entrypoint-initdb.d/init-db.sql
|
|
# ports:
|
|
# - "5432:5432"
|
|
# restart: unless-stopped
|
|
|
|
volumes:
|
|
vhd_db_data:
|
|
driver: local
|
|
# postgres_data:
|
|
# driver: local |