Files
Finlytic/compose.yaml

272 lines
12 KiB
YAML

services:
# ──────────────────────────────────────────────────────────────────────────
# External infrastructure this stack depends on (NOT part of this repo):
#
# 1. PostgreSQL ("OmniDB" by default) — reachable on the external Docker
# network `postgres-network` (see bottom of this file, external: true).
# Configure via:
# DB_HOST (default: OmniDB)
# DB_PORT (default: 5432)
# DB_PASSWORD (required, no default — set in .env)
#
# 2. MQTT broker — runs directly on the Windows host, unauthenticated,
# reachable from containers via the Docker Desktop DNS alias
# `host.docker.internal`. Configure via:
# MQTT_HOST (default: host.docker.internal)
# MQTT_PORT (default: 4545)
#
# On a fresh clone, on a different machine, or to point at different
# infrastructure, override the variables above in a local `.env` file —
# no edits to the service blocks below are needed.
#
# We deliberately do NOT ship a `local-infra` profile with throwaway
# Postgres/Mosquitto containers here. Reasoning: a working local Postgres
# would need to provision 9 distinct databases (finlytic_assets,
# finlytic_news, ... one per service) on first start, which the stock
# `postgres` image cannot do via environment variables alone — it needs
# an `docker-entrypoint-initdb.d` init script. That's an additional file
# outside the scope of this change (compose.yaml / Dockerfiles /
# .dockerignore only), and a second, empty, unauthenticated Postgres
# sitting next to the real one is a plausible source of "why is my data
# missing" confusion for a single-developer repo where the real OmniDB
# already holds live data. The DB_HOST/DB_PORT/MQTT_HOST/MQTT_PORT
# variables above are the actually load-bearing fix: they remove the
# 9x-duplicated hardcoding and make the stack point-elsewhere-capable
# without any code edits. If real multi-developer/CI use ever
# materializes, revisit with a proper init-script-backed local-infra
# profile at that point.
# ──────────────────────────────────────────────────────────────────────────
# ──────────────────────────────────────────────────────────────────────────
# Build-only prerequisite: Chromium + Node + Playwright CLI base layer.
# Consumed as `FROM finlytic-playwright-base:1.49.0` by BOTH finlyticnews
# and finlyticfundamentals. Compose does not resolve FROM-references across
# services, so this MUST be built before the services that depend on it:
#
# docker compose --profile build-base build finlytic-playwright-base
# docker compose build
#
# Keep PLAYWRIGHT_VERSION in sync with the Microsoft.Playwright NuGet
# package version in FinlyticCore/FinlyticCore.csproj.
# ──────────────────────────────────────────────────────────────────────────
finlytic-playwright-base:
profiles: ["build-base"]
image: finlytic-playwright-base:1.49.0
build:
context: FinlyticNews
dockerfile: Dockerfile.playwright-base
args:
PLAYWRIGHT_VERSION: "1.49.0"
finlyticassets:
image: finlyticassets
build:
context: .
dockerfile: FinlyticAssets/Dockerfile
# unless-stopped: this worker has no required secrets that could be
# permanently misconfigured — any crash is expected to be a transient
# DB/MQTT hiccup, so it should keep retrying indefinitely (Docker backs
# off automatically between attempts).
restart: unless-stopped
networks:
- postgres-network
environment:
- ConnectionStrings__DefaultConnection=Host=${DB_HOST:-OmniDB};Port=${DB_PORT:-5432};Database=finlytic_assets;Username=admin;Password=${DB_PASSWORD}
- MQTT__Host=${MQTT_HOST:-host.docker.internal}
- MQTT__Port=${MQTT_PORT:-4545}
# Client-side MQTT Username/Password support exists (applied only when set),
# but the broker at MQTT_HOST:MQTT_PORT has no users/ACLs configured yet
# (verified — unauthenticated). Do NOT uncomment until broker-side users
# exist; doing so now would break the current anonymous connection.
# Once the broker has matching users, activate via:
#- MQTT__Username=${MQTT_USERNAME:-admin}
#- MQTT__Password=${MQTT_PASSWORD}
- MQTT__ClientId=finlytic_assets
volumes:
- ${FINLYTIC_DATA_ROOT:-C:/Users/larsh/Documents/docker/finlytic}/assets/index:/app/assets/index
- ${FINLYTIC_DATA_ROOT:-C:/Users/larsh/Documents/docker/finlytic}/assets/logos:/app/assets/logos
finlyticnews:
image: finlyticnews
build:
context: .
dockerfile: FinlyticNews/Dockerfile
restart: unless-stopped
networks:
- postgres-network
environment:
- ConnectionStrings__DefaultConnection=Host=${DB_HOST:-OmniDB};Port=${DB_PORT:-5432};Database=finlytic_news;Username=admin;Password=${DB_PASSWORD}
- MQTT__Host=${MQTT_HOST:-host.docker.internal}
- MQTT__Port=${MQTT_PORT:-4545}
# See finlyticassets above: broker has no auth configured yet, do not enable.
#- MQTT__Username=${MQTT_USERNAME:-admin}
#- MQTT__Password=${MQTT_PASSWORD}
- MQTT__ClientId=finlytic_news
# No data/summaries mount: the legacy filesystem read of Sentiment's
# summary cache was removed and replaced by an MQTT-RPC call to
# FinlyticSentiment (verified — no code path reads that directory
# anymore). Only the asset index mount remains.
volumes:
- ${FINLYTIC_DATA_ROOT:-C:/Users/larsh/Documents/docker/finlytic}/assets/index:/app/assets/index:ro
finlyticfundamentals:
image: finlyticfundamentals
build:
context: .
dockerfile: FinlyticFundamentals/Dockerfile
restart: unless-stopped
networks:
- postgres-network
environment:
- ConnectionStrings__DefaultConnection=Host=${DB_HOST:-OmniDB};Port=${DB_PORT:-5432};Database=finlytic_fundamentals;Username=admin;Password=${DB_PASSWORD}
- MQTT__Host=${MQTT_HOST:-host.docker.internal}
- MQTT__Port=${MQTT_PORT:-4545}
# See finlyticassets above: broker has no auth configured yet, do not enable.
#- MQTT__Username=${MQTT_USERNAME:-admin}
#- MQTT__Password=${MQTT_PASSWORD}
- MQTT__ClientId=finlytic_fundamentals
finlyticsentiment:
image: finlyticsentiment
build:
context: .
dockerfile: FinlyticSentiment/Dockerfile
restart: unless-stopped
networks:
- postgres-network
environment:
- ConnectionStrings__DefaultConnection=Host=${DB_HOST:-OmniDB};Port=${DB_PORT:-5432};Database=finlytic_sentimental;Username=admin;Password=${DB_PASSWORD}
- MQTT__Host=${MQTT_HOST:-host.docker.internal}
- MQTT__Port=${MQTT_PORT:-4545}
# See finlyticassets above: broker has no auth configured yet, do not enable.
#- MQTT__Username=${MQTT_USERNAME:-admin}
#- MQTT__Password=${MQTT_PASSWORD}
- MQTT__ClientId=finlytic_sentiment
- Webhooks__German=https://n8n.kleidukos.me/webhook/sentiment/de
- Webhooks__English=https://n8n.kleidukos.me/webhook/sentiment/en
# No volumes: FinlyticSentiment persists to PostgreSQL only. The
# data/summaries mount here was never written to by this service
# (Storage:SummariesPath in FinlyticSentiment/appsettings.json is dead
# config) and other services now consume Sentiment's data via MQTT-RPC
# instead of shared files, so the mount has been dropped.
finlytictechnicals:
image: finlytictechnicals
build:
context: .
dockerfile: FinlyticTechnicals/Dockerfile
restart: unless-stopped
networks:
- postgres-network
environment:
- ConnectionStrings__DefaultConnection=Host=${DB_HOST:-OmniDB};Port=${DB_PORT:-5432};Database=finlytic_ta;Username=admin;Password=${DB_PASSWORD}
- MQTT__Host=${MQTT_HOST:-host.docker.internal}
- MQTT__Port=${MQTT_PORT:-4545}
# See finlyticassets above: broker has no auth configured yet, do not enable.
#- MQTT__Username=${MQTT_USERNAME:-admin}
#- MQTT__Password=${MQTT_PASSWORD}
- MQTT__ClientId=finlytic_technicals
finlyticengine:
image: finlyticengine
build:
context: .
dockerfile: FinlyticEngine/Dockerfile
restart: unless-stopped
networks:
- postgres-network
environment:
- ConnectionStrings__DefaultConnection=Host=${DB_HOST:-OmniDB};Port=${DB_PORT:-5432};Database=finlytic_engine;Username=admin;Password=${DB_PASSWORD}
- MQTT__Host=${MQTT_HOST:-host.docker.internal}
- MQTT__Port=${MQTT_PORT:-4545}
# See finlyticassets above: broker has no auth configured yet, do not enable.
#- MQTT__Username=${MQTT_USERNAME:-admin}
#- MQTT__Password=${MQTT_PASSWORD}
- MQTT__ClientId=finlytic_engine
- Ai__N8nValidationWebhookUrl=https://n8n.kleidukos.me/webhook/trade-validation
finlyticsimulation:
image: finlyticsimulation
build:
context: .
dockerfile: FinlyticSimulation/Dockerfile
restart: unless-stopped
networks:
- postgres-network
environment:
- ConnectionStrings__DefaultConnection=Host=${DB_HOST:-OmniDB};Port=${DB_PORT:-5432};Database=finlytic_simulation;Username=admin;Password=${DB_PASSWORD}
- MQTT__Host=${MQTT_HOST:-host.docker.internal}
- MQTT__Port=${MQTT_PORT:-4545}
# See finlyticassets above: broker has no auth configured yet, do not enable.
#- MQTT__Username=${MQTT_USERNAME:-admin}
#- MQTT__Password=${MQTT_PASSWORD}
- MQTT__ClientId=finlytic_simulation
finlyticbot:
image: finlyticbot
build:
context: .
dockerfile: FinlyticBot/Dockerfile
restart: unless-stopped
networks:
- postgres-network
environment:
- ConnectionStrings__DefaultConnection=Host=${DB_HOST:-OmniDB};Port=${DB_PORT:-5432};Database=finlytic_bot;Username=admin;Password=${DB_PASSWORD}
- MQTT__Host=${MQTT_HOST:-host.docker.internal}
- MQTT__Port=${MQTT_PORT:-4545}
# See finlyticassets above: broker has no auth configured yet, do not enable.
#- MQTT__Username=${MQTT_USERNAME:-admin}
#- MQTT__Password=${MQTT_PASSWORD}
- Alpaca__IsPaper=true
finlyticnotify:
image: finlyticnotify
build:
context: .
dockerfile: FinlyticNotify/Dockerfile
restart: unless-stopped
networks:
- postgres-network
environment:
- ConnectionStrings__DefaultConnection=Host=${DB_HOST:-OmniDB};Port=${DB_PORT:-5432};Database=finlytic_notify;Username=admin;Password=${DB_PASSWORD}
- MQTT__Host=${MQTT_HOST:-host.docker.internal}
- MQTT__Port=${MQTT_PORT:-4545}
- MQTT__ClientId=finlytic_notify
- Ntfy__BaseUrl=${NTFY_BASE_URL:-http://host.docker.internal:8080}
- Ntfy__TopicPrefix=finlytic
- Ntfy__BroadcastChannel=broadcast
- Ntfy__NewsChannel=news
- Ntfy__DefaultUsername=admin
- Ntfy__MinProposalScore=70.0
- Ntfy__NotifyOnProposals=true
- Ntfy__NotifyOnTradeUpdates=true
- Ntfy__NotifyOnBotTrades=true
- Ntfy__NotifyOnNews=true
finlyticbackend:
image: finlyticbackend
build:
context: .
dockerfile: FinlyticBackend/Dockerfile
restart: on-failure:5
ports:
- "5000:8080"
networks:
- postgres-network
environment:
- ConnectionStrings__DefaultConnection=Host=${DB_HOST:-OmniDB};Port=${DB_PORT:-5432};Database=finlytic_backend;Username=admin;Password=${DB_PASSWORD}
- MQTT__Host=${MQTT_HOST:-host.docker.internal}
- MQTT__Port=${MQTT_PORT:-4545}
# See finlyticassets above: broker has no auth configured yet, do not enable.
#- MQTT__Username=${MQTT_USERNAME:-admin}
#- MQTT__Password=${MQTT_PASSWORD}
- MQTT__ClientId=finlytic_backend
- JWT__SecretKey=${JWT_SECRET_KEY}
- ADMIN__DefaultPassword=${ADMIN_DEFAULT_PASSWORD}
volumes:
- ${FINLYTIC_DATA_ROOT:-C:/Users/larsh/Documents/docker/finlytic}/assets/index:/app/assets/index
- ${FINLYTIC_DATA_ROOT:-C:/Users/larsh/Documents/docker/finlytic}/assets/logos:/app/assets/logos
networks:
postgres-network:
external: true