update
This commit is contained in:
@ -1,18 +1,20 @@
|
||||
# 生产部署 compose(放在前端仓库根,服务器结构见 DEPLOY.md)
|
||||
# 生产部署 compose(放在前端仓库根;服务器结构见仓库 README)
|
||||
# 前端仓: /opt/fashion/test (本文件所在)
|
||||
# 后端仓: /opt/fashion/backend (注意:已对齐到当前活跃开发的后端,原 admin/backend 为旧扁平版)
|
||||
# 后端仓: /opt/fashion/backend (已对齐到当前活跃开发的后端,仅支持 PostgreSQL + pgvector)
|
||||
services:
|
||||
# ---- 数据库 ----
|
||||
# ---- 数据库 (PostgreSQL + pgvector) ----
|
||||
# 注意:后端代码仅支持 PostgreSQL + pgvector(gorm pgx 驱动),切勿换回 MySQL。
|
||||
db:
|
||||
image: mysql:8.0
|
||||
image: ankane/pgvector:latest # 预编译好 pgvector 的 PG 镜像(latest 当前底层为 PG17)
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-root}
|
||||
MYSQL_DATABASE: ${DB_NAME:-fashionadmin}
|
||||
POSTGRES_USER: fashion
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-fashion_dev_2026} # 生产务必换强密码
|
||||
POSTGRES_DB: fashion
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql
|
||||
- db_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-p${DB_PASSWORD:-root}"]
|
||||
test: ["CMD-SHELL", "pg_isready -U fashion -d fashion"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
@ -29,11 +31,15 @@ services:
|
||||
HASHID_SECRET: ${HASHID_SECRET:-} # 公开 ID 混淆盐值:生产务必注入随机串(改值会使旧链接失效,谨慎变更)
|
||||
GIN_MODE: release
|
||||
JWT_SECRET: ${JWT_SECRET:-change-me-in-prod}
|
||||
CORS_ALLOW_ORIGINS: ${CORS_ALLOW_ORIGINS:-https://xisoa.com,https://www.xisoa.com}
|
||||
RATE_LIMIT_ENABLED: ${RATE_LIMIT_ENABLED:-false}
|
||||
RATE_LIMIT_RPS: ${RATE_LIMIT_RPS:-20}
|
||||
RATE_LIMIT_BURST: ${RATE_LIMIT_BURST:-40}
|
||||
DB_HOST: db
|
||||
DB_PORT: 3306
|
||||
DB_USER: ${DB_USER:-root}
|
||||
DB_PASSWORD: ${DB_PASSWORD:-root}
|
||||
DB_NAME: ${DB_NAME:-fashionadmin}
|
||||
DB_PORT: 5432
|
||||
DB_USER: ${DB_USER:-fashion}
|
||||
DB_PASSWORD: ${DB_PASSWORD:-fashion_dev_2026}
|
||||
DB_NAME: ${DB_NAME:-fashion}
|
||||
ports:
|
||||
- "8090:8090" # 对外公开 API(运行期由 nginx 反代);生产可去掉此发布,改由前端 nginx 直接反代 backend:8090
|
||||
- "127.0.0.1:8091:8091" # ⚠️ SSG 内部端口:只绑宿主回环,外部网络不可达;nginx 也绝不反代它
|
||||
@ -46,7 +52,7 @@ services:
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
# ---- 前端 (Astro 静态 + nginx) ----
|
||||
# ---- 前端 (Astro node server + nginx 反代) ----
|
||||
frontend:
|
||||
build:
|
||||
context: .
|
||||
|
||||
Reference in New Issue
Block a user