86 lines
2.3 KiB
YAML
86 lines
2.3 KiB
YAML
name: genarrative-container-loadtest
|
|
|
|
services:
|
|
api-server:
|
|
build:
|
|
context: ../..
|
|
dockerfile: deploy/container/api-server.Dockerfile
|
|
target: api-runtime
|
|
env_file:
|
|
- ./api-server.env
|
|
environment:
|
|
GENARRATIVE_API_HOST: 0.0.0.0
|
|
GENARRATIVE_API_PORT: 8082
|
|
OTEL_EXPORTER_OTLP_ENDPOINT: http://otelcol:4318
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
volumes:
|
|
- api-auth-store:/var/lib/genarrative/auth
|
|
depends_on:
|
|
otelcol:
|
|
condition: service_started
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8082/healthz"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 12
|
|
start_period: 20s
|
|
|
|
nginx:
|
|
build:
|
|
context: ../..
|
|
dockerfile: deploy/container/api-server.Dockerfile
|
|
target: nginx-runtime
|
|
depends_on:
|
|
api-server:
|
|
condition: service_healthy
|
|
ports:
|
|
- "${GENARRATIVE_CONTAINER_HTTP_PORT:-18080}:80"
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
volumes:
|
|
- nginx-logs:/var/log/nginx
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://127.0.0.1/api/runtime/puzzle/gallery"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 12
|
|
start_period: 20s
|
|
|
|
otelcol:
|
|
image: otel/opentelemetry-collector-contrib:0.125.0
|
|
command: ["--config=/etc/otelcol/config.yaml"]
|
|
volumes:
|
|
- ./otelcol.yaml:/etc/otelcol/config.yaml:ro
|
|
ports:
|
|
- "${GENARRATIVE_CONTAINER_OTLP_GRPC_PORT:-4317}:4317"
|
|
- "${GENARRATIVE_CONTAINER_OTLP_HTTP_PORT:-4318}:4318"
|
|
|
|
k6:
|
|
image: grafana/k6:0.52.0
|
|
profiles: ["loadtest"]
|
|
depends_on:
|
|
nginx:
|
|
condition: service_healthy
|
|
environment:
|
|
BASE_URL: http://nginx
|
|
WORKS_DATA: data/works-list.sample.json
|
|
SCENARIO: ${SCENARIO:-spike}
|
|
START_RPS: ${START_RPS:-5}
|
|
PEAK_RPS: ${PEAK_RPS:-250}
|
|
HOLD: ${HOLD:-60s}
|
|
END_RPS: ${END_RPS:-5}
|
|
PREALLOCATED_VUS: ${PREALLOCATED_VUS:-100}
|
|
MAX_VUS: ${MAX_VUS:-500}
|
|
DETAIL_RATIO: ${DETAIL_RATIO:-0}
|
|
SLEEP_MIN_SECONDS: ${SLEEP_MIN_SECONDS:-0}
|
|
SLEEP_MAX_SECONDS: ${SLEEP_MAX_SECONDS:-0}
|
|
volumes:
|
|
- ../../scripts/loadtest:/scripts/loadtest:ro
|
|
working_dir: /scripts/loadtest
|
|
command: ["run", "k6-works-list.js"]
|
|
|
|
volumes:
|
|
api-auth-store:
|
|
nginx-logs:
|