islandflow/deployment/docker/docker-compose.yml
2026-04-03 22:10:35 -04:00

133 lines
2.8 KiB
YAML

name: islandflow-vps
x-service-common: &service-common
build:
context: ../..
dockerfile: deployment/docker/Dockerfile.service
env_file:
- ./.env
restart: unless-stopped
init: true
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
- nats
- clickhouse
- redis
services:
proxy:
image: nginx:1.27-alpine
restart: unless-stopped
depends_on:
- web
- api
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
web:
build:
context: ../..
dockerfile: deployment/docker/Dockerfile.web
args:
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-}
NEXT_PUBLIC_NBBO_MAX_AGE_MS: ${NEXT_PUBLIC_NBBO_MAX_AGE_MS:-1000}
env_file:
- ./.env
restart: unless-stopped
init: true
depends_on:
api:
condition: service_healthy
healthcheck:
test:
[
"CMD",
"bun",
"-e",
"const r=await fetch('http://127.0.0.1:3000/'); if(!r.ok) throw new Error('web healthcheck failed: '+r.status);"
]
interval: 30s
timeout: 10s
retries: 5
start_period: 45s
api:
<<: *service-common
command: ["services/api/src/index.ts"]
healthcheck:
test:
[
"CMD",
"bun",
"-e",
"const r=await fetch('http://127.0.0.1:4000/health'); if(!r.ok) throw new Error('api healthcheck failed: '+r.status);"
]
interval: 30s
timeout: 10s
retries: 5
start_period: 20s
compute:
<<: *service-common
command: ["services/compute/src/index.ts"]
candles:
<<: *service-common
command: ["services/candles/src/index.ts"]
ingest-options:
build:
context: ../..
dockerfile: deployment/docker/Dockerfile.ingest-options
env_file:
- ./.env
restart: unless-stopped
init: true
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
- nats
- clickhouse
- redis
command: ["services/ingest-options/src/index.ts"]
ingest-equities:
<<: *service-common
command: ["services/ingest-equities/src/index.ts"]
replay:
<<: *service-common
profiles: ["replay"]
command: ["services/replay/src/index.ts"]
clickhouse:
image: clickhouse/clickhouse-server:23.8
restart: unless-stopped
ulimits:
nofile:
soft: 262144
hard: 262144
volumes:
- clickhouse-data:/var/lib/clickhouse
redis:
image: redis:7.2
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis-data:/data
nats:
image: nats:2.10
restart: unless-stopped
command: ["-js", "-sd", "/data"]
volumes:
- nats-data:/data
volumes:
clickhouse-data:
redis-data:
nats-data: