前端: 新增 RealTimeQuoteResponse 类型;新增 useRealtimeQuote Hook 并在报告页图表旁展示价格与时间戳(严格 TTL,无兜底)
FastAPI: 新增 GET /financials/{market}/{symbol}/realtime?max_age_seconds=.. 只读端点;通过 DataPersistenceClient 读取 Rust 缓存
Rust: 新增 realtime_quotes hypertable 迁移;新增 POST /api/v1/market-data/quotes 与 GET /api/v1/market-data/quotes/{symbol}?market=..;新增 DTO/Model/DB 函数;修正 #[api] 宏与路径参数;生成 SQLx 离线缓存 (.sqlx) 以支持离线构建
Python: DataPersistenceClient 新增 upsert/get 实时报价,并调整 GET 路径与参数
说明: TradingView 图表是第三方 websocket,不受我们缓存控制;页面数值展示走自有缓存通路,统一且可控。
27 lines
802 B
Docker
27 lines
802 B
Docker
FROM rust:1.90-bookworm AS chef
|
|
WORKDIR /app
|
|
RUN cargo install cargo-chef
|
|
|
|
FROM chef AS planner
|
|
COPY . .
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
FROM chef AS builder
|
|
ENV SQLX_OFFLINE=true
|
|
COPY --from=planner /app/recipe.json /app/recipe.json
|
|
RUN cargo chef cook --release --recipe-path /app/recipe.json
|
|
COPY . .
|
|
RUN cargo build --release --bin data-persistence-service-server
|
|
|
|
FROM debian:bookworm-slim AS runtime
|
|
WORKDIR /app
|
|
RUN groupadd --system --gid 1001 appuser && \
|
|
useradd --system --uid 1001 --gid 1001 appuser
|
|
USER appuser
|
|
COPY --from=builder /app/target/release/data-persistence-service-server /usr/local/bin/data-persistence-service-server
|
|
COPY ./migrations ./migrations
|
|
ENV HOST=0.0.0.0
|
|
ENV PORT=3000
|
|
EXPOSE 3000
|
|
ENTRYPOINT ["/usr/local/bin/data-persistence-service-server"]
|