Fundamental_Analysis/docker-compose.yml
Lv, Qi ceffa0d95c chore(build): unify Dockerfiles and root .dockerignore; fix services after deps upgrade
- secrecy: migrate Secret<String> -> SecretString across services; adjust usages
- warnings: clean unused imports/structs (no behavior change)
- docker-compose: remove unnecessary host port mappings; rely on app-network; keep frontend only
- build: set build.context to repo root; reference per-service Dockerfiles
- add: root .dockerignore to exclude target/node_modules/ref/archive/docs and logs
- data-persistence-service: refine cargo-chef with path deps; slim context; copy correct targets
- Dockerfiles: normalize multi-stage builds; fix WORKDIR and release binary paths
- nats: resolve 4222 conflict by not binding to host
- verified: all rust services build successfully with new flow
2025-11-16 23:34:28 +08:00

207 lines
5.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: "3.9"
services:
postgres-db:
image: timescale/timescaledb:2.15.2-pg16
container_name: fundamental-postgres
command: -c shared_preload_libraries=timescaledb
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: fundamental
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d fundamental"]
interval: 5s
timeout: 5s
retries: 10
networks:
- app-network
nats:
image: nats:2.9
volumes:
- nats_data:/data
networks:
- app-network
data-persistence-service:
build:
context: .
dockerfile: services/data-persistence-service/Dockerfile
container_name: data-persistence-service
environment:
HOST: 0.0.0.0
PORT: 3000
# Rust service connects to the internal DB service name
DATABASE_URL: postgresql://postgres:postgres@postgres-db:5432/fundamental
depends_on:
postgres-db:
condition: service_healthy
# If you prefer live-reload or local code mount, consider switching to a dev Dockerfile.
# volumes:
# - ./:/workspace
networks:
- app-network
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
container_name: fundamental-frontend
working_dir: /workspace/frontend
command: npm run dev
environment:
# 让 Next 的 API 路由代理到新的 api-gateway
NEXT_PUBLIC_BACKEND_URL: http://api-gateway:4000/v1
# Prisma 直连数据库(与后端共用同一库)
DATABASE_URL: postgresql://postgres:postgres@postgres-db:5432/fundamental?schema=public
NODE_ENV: development
NEXT_TELEMETRY_DISABLED: "1"
volumes:
- ./:/workspace
# 隔离 node_modules避免与宿主机冲突
- frontend_node_modules:/workspace/frontend/node_modules
ports:
- "13001:3001"
depends_on:
- postgres-db
- api-gateway
networks:
- app-network
api-gateway:
build:
context: .
dockerfile: services/api-gateway/Dockerfile
container_name: api-gateway
environment:
SERVER_PORT: 4000
NATS_ADDR: nats://nats:4222
DATA_PERSISTENCE_SERVICE_URL: http://data-persistence-service:3000/api/v1
# Note: provider_services needs to contain all provider's internal addresses
PROVIDER_SERVICES: '["http://alphavantage-provider-service:8000", "http://tushare-provider-service:8001", "http://finnhub-provider-service:8002", "http://yfinance-provider-service:8003"]'
depends_on:
- nats
- data-persistence-service
- alphavantage-provider-service
- tushare-provider-service
- finnhub-provider-service
- yfinance-provider-service
networks:
- app-network
alphavantage-provider-service:
build:
context: .
dockerfile: services/alphavantage-provider-service/Dockerfile
container_name: alphavantage-provider-service
environment:
SERVER_PORT: 8000
NATS_ADDR: nats://nats:4222
DATA_PERSISTENCE_SERVICE_URL: http://data-persistence-service:3000/api/v1
depends_on:
- nats
- data-persistence-service
networks:
- app-network
tushare-provider-service:
build:
context: .
dockerfile: services/tushare-provider-service/Dockerfile
container_name: tushare-provider-service
environment:
SERVER_PORT: 8001
NATS_ADDR: nats://nats:4222
DATA_PERSISTENCE_SERVICE_URL: http://data-persistence-service:3000/api/v1
TUSHARE_API_URL: http://api.waditu.com
# Please provide your Tushare token here
TUSHARE_API_TOKEN: "YOUR_TUSHARE_API_TOKEN"
depends_on:
- nats
- data-persistence-service
networks:
- app-network
finnhub-provider-service:
build:
context: .
dockerfile: services/finnhub-provider-service/Dockerfile
container_name: finnhub-provider-service
environment:
SERVER_PORT: 8002
NATS_ADDR: nats://nats:4222
DATA_PERSISTENCE_SERVICE_URL: http://data-persistence-service:3000/api/v1
FINNHUB_API_URL: https://finnhub.io/api/v1
# Please provide your Finnhub token in .env file
FINNHUB_API_KEY: ${FINNHUB_API_KEY}
depends_on:
- nats
- data-persistence-service
networks:
- app-network
yfinance-provider-service:
build:
context: .
dockerfile: services/yfinance-provider-service/Dockerfile
container_name: yfinance-provider-service
environment:
SERVER_PORT: 8003
NATS_ADDR: nats://nats:4222
DATA_PERSISTENCE_SERVICE_URL: http://data-persistence-service:3000/api/v1
depends_on:
- nats
- data-persistence-service
networks:
- app-network
report-generator-service:
build:
context: .
dockerfile: services/report-generator-service/Dockerfile
container_name: report-generator-service
environment:
SERVER_PORT: 8004
NATS_ADDR: nats://nats:4222
DATA_PERSISTENCE_SERVICE_URL: http://data-persistence-service:3000/api/v1
# Please provide your LLM provider details in .env file
LLM_API_URL: ${LLM_API_URL}
LLM_API_KEY: ${LLM_API_KEY}
LLM_MODEL: ${LLM_MODEL:-"default-model"}
depends_on:
- nats
- data-persistence-service
networks:
- app-network
config-service-rs:
build:
context: .
dockerfile: services/config-service-rs/Dockerfile
container_name: config-service-rs
environment:
SERVER_PORT: 5001
# PROJECT_ROOT is set to /workspace in the Dockerfile
networks:
- app-network
volumes:
- ./config:/workspace/config:ro
# =================================================================
# Python Services (Legacy - to be replaced)
# =================================================================
volumes:
pgdata:
frontend_node_modules:
nats_data:
networks:
app-network: