diff options
Diffstat (limited to 'docker-compose.yml')
| -rw-r--r-- | docker-compose.yml | 106 |
1 files changed, 102 insertions, 4 deletions
diff --git a/docker-compose.yml b/docker-compose.yml index e981f74..60462ec 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,22 +10,34 @@ services: interval: 5s timeout: 3s retries: 5 + networks: [internal] + deploy: + resources: + limits: + memory: 256M + cpus: '0.5' postgres: image: postgres:16-alpine ports: - "5432:5432" environment: - POSTGRES_USER: trading - POSTGRES_PASSWORD: trading - POSTGRES_DB: trading + POSTGRES_USER: ${POSTGRES_USER:-trading} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-trading} + POSTGRES_DB: ${POSTGRES_DB:-trading} volumes: - postgres_data:/var/lib/postgresql/data healthcheck: - test: ["CMD-LINE", "pg_isready", "-U", "trading"] + test: ["CMD", "pg_isready", "-U", "trading"] interval: 5s timeout: 3s retries: 5 + networks: [internal] + deploy: + resources: + limits: + memory: 256M + cpus: '0.5' data-collector: build: @@ -45,6 +57,12 @@ services: timeout: 5s retries: 3 restart: unless-stopped + networks: [internal] + deploy: + resources: + limits: + memory: 512M + cpus: '1.0' strategy-engine: build: @@ -64,6 +82,12 @@ services: timeout: 5s retries: 3 restart: unless-stopped + networks: [internal] + deploy: + resources: + limits: + memory: 1G + cpus: '1.0' order-executor: build: @@ -83,6 +107,12 @@ services: timeout: 5s retries: 3 restart: unless-stopped + networks: [internal] + deploy: + resources: + limits: + memory: 512M + cpus: '1.0' portfolio-manager: build: @@ -102,6 +132,12 @@ services: timeout: 5s retries: 3 restart: unless-stopped + networks: [internal] + deploy: + resources: + limits: + memory: 512M + cpus: '1.0' api: build: @@ -121,6 +157,37 @@ services: timeout: 5s retries: 3 restart: unless-stopped + networks: [internal] + deploy: + resources: + limits: + memory: 512M + cpus: '1.0' + + news-collector: + build: + context: . + dockerfile: services/news-collector/Dockerfile + env_file: .env + ports: + - "8084:8084" + depends_on: + redis: + condition: service_healthy + postgres: + condition: service_healthy + healthcheck: + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8084/health')"] + interval: 10s + timeout: 5s + retries: 3 + restart: unless-stopped + networks: [internal] + deploy: + resources: + limits: + memory: 512M + cpus: '1.0' loki: image: grafana/loki:latest @@ -131,6 +198,12 @@ services: - ./monitoring/loki/loki-config.yaml:/etc/loki/local-config.yaml - loki_data:/loki command: -config.file=/etc/loki/local-config.yaml + networks: [monitoring] + deploy: + resources: + limits: + memory: 512M + cpus: '1.0' promtail: image: grafana/promtail:latest @@ -141,6 +214,12 @@ services: command: -config.file=/etc/promtail/config.yaml depends_on: - loki + networks: [monitoring] + deploy: + resources: + limits: + memory: 512M + cpus: '1.0' prometheus: image: prom/prometheus:latest @@ -149,11 +228,18 @@ services: - "9090:9090" volumes: - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml + - ./monitoring/prometheus/alert_rules.yml:/etc/prometheus/alert_rules.yml depends_on: - data-collector - strategy-engine - order-executor - portfolio-manager + networks: [internal, monitoring] + deploy: + resources: + limits: + memory: 512M + cpus: '1.0' grafana: image: grafana/grafana:latest @@ -168,8 +254,20 @@ services: - ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards depends_on: - prometheus + networks: [internal, monitoring] + deploy: + resources: + limits: + memory: 512M + cpus: '1.0' volumes: redis_data: postgres_data: loki_data: + +networks: + internal: + driver: bridge + monitoring: + driver: bridge |
