packmate/stress/network/docker-compose.yml

139 lines
4.3 KiB
YAML

services:
db:
image: postgres:15.2
shm_size: 1gb
command:
- postgres
- -c
- max_connections=200
- -c
- autovacuum_max_workers=4
- -c
- autovacuum_naptime=2s
- -c
- autovacuum_vacuum_threshold=1000
- -c
- autovacuum_vacuum_scale_factor=0.02
- -c
- autovacuum_vacuum_cost_limit=1000
environment:
POSTGRES_DB: packmate
POSTGRES_USER: packmate
POSTGRES_PASSWORD: network-stress
volumes:
- db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U packmate -d packmate"]
interval: 1s
timeout: 3s
retries: 60
networks:
stress:
ipv4_address: ${PACKMATE_NETWORK_STRESS_DB_IP:-172.31.250.20}
target:
build:
context: .
dockerfile: Dockerfile.tools
command: ["python", "/stress/tcp_target.py"]
environment:
STRESS_TARGET_HOST: 0.0.0.0
STRESS_TARGET_PORT: 18080
healthcheck:
test: ["CMD", "python", "-c", "import socket; s=socket.create_connection(('127.0.0.1',18080),2); s.close()"]
interval: 1s
timeout: 3s
retries: 60
networks:
stress:
ipv4_address: ${PACKMATE_NETWORK_STRESS_TARGET_IP:-172.31.250.10}
packmate:
build:
context: ../..
dockerfile: docker/Dockerfile_app
network_mode: service:target
stop_grace_period: 45s
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
db:
condition: service_healthy
target:
condition: service_healthy
command:
- java
- -Xms512m
- -Xmx${PACKMATE_NETWORK_STRESS_JAVA_MAX_HEAP:-4g}
- -Djava.net.preferIPv4Stack=true
- -Djava.net.preferIPv4Addresses=true
- -jar
- /app/app.jar
- --spring.datasource.url=jdbc:postgresql://db:5432/packmate
- --spring.datasource.password=network-stress
- --packmate.capture-mode=LIVE
- --packmate.interface-name=eth0
- --packmate.local-ip=${PACKMATE_NETWORK_STRESS_TARGET_IP:-172.31.250.10}
- --packmate.web.account-login=stress
- --packmate.web.account-password=stress
- --packmate.timeout.tcp-stream-timeout=${PACKMATE_NETWORK_STRESS_TCP_TIMEOUT_SECONDS:-40}
- --packmate.timeout.udp-stream-timeout=${PACKMATE_NETWORK_STRESS_UDP_TIMEOUT_SECONDS:-20}
- --packmate.timeout.check-interval=1
- --packmate.capture.workers=${PACKMATE_NETWORK_STRESS_CAPTURE_WORKERS:-8}
- --packmate.capture.queue-capacity=${PACKMATE_NETWORK_STRESS_CAPTURE_QUEUE_CAPACITY:-250000}
- --packmate.capture.buffer-size-bytes=${PACKMATE_NETWORK_STRESS_CAPTURE_BUFFER_SIZE_BYTES:-67108864}
- --packmate.capture.shutdown-timeout-seconds=30
- --packmate.cleanup.enabled=${PACKMATE_NETWORK_STRESS_CLEANUP_ENABLED:-false}
- --packmate.cleanup.threshold=${PACKMATE_NETWORK_STRESS_CLEANUP_THRESHOLD_MINUTES:-1440}
- --packmate.cleanup.interval-seconds=${PACKMATE_NETWORK_STRESS_CLEANUP_INTERVAL_SECONDS:-10}
- --packmate.cleanup.max-run-seconds=5
- --packmate.cleanup.commit-grace-seconds=120
- --packmate.cleanup.batch-size=500
- --packmate.cleanup.max-batches-per-run=20
- --packmate.cleanup.max-packets-per-batch=20000
- --packmate.cleanup.max-matches-per-batch=20000
- --packmate.cleanup.max-bytes-per-batch=67108864
- --packmate.cleanup.statement-timeout-seconds=5
- --packmate.cleanup.lock-timeout-seconds=1
- --server.port=65000
- --server.address=0.0.0.0
generator:
build:
context: .
dockerfile: Dockerfile.tools
profiles: ["tools"]
working_dir: /stress
environment:
STRESS_TARGET_HOST: ${PACKMATE_NETWORK_STRESS_TARGET_IP:-172.31.250.10}
STRESS_TARGET_PORT: 18080
STRESS_API_URL: http://${PACKMATE_NETWORK_STRESS_TARGET_IP:-172.31.250.10}:65000/api
STRESS_API_USER: stress
STRESS_API_PASSWORD: stress
volumes:
- reports:/reports
networks:
- stress
reports:
build:
context: .
dockerfile: Dockerfile.tools
profiles: ["tools"]
command: ["sleep", "infinity"]
volumes:
- reports:/reports
networks:
- stress
networks:
stress:
ipam:
config:
- subnet: ${PACKMATE_NETWORK_STRESS_SUBNET:-172.31.250.0/24}
volumes:
reports:
db_data: