Skip to content

Latest commit

 

History

History
115 lines (77 loc) · 3.83 KB

File metadata and controls

115 lines (77 loc) · 3.83 KB

Containerized Deployment

The framework can be containerized and orchestrated for development and testing.

Instead of running locally, tests can be executed inside Docker containers with full service orchestration.

Docker Compose – Local Full Stack

Run the entire framework locally using Docker Compose.

All required services (Redis, InfluxDB, Reporting Service, k6) are automatically configured and started.

Quick start

# Copy environment template
# (optional: to customize values; docker compose already has env variables)
cp .env.example .env

# OR: Start all services
docker compose up -d --wait

# OR: Start all services with visualization (Chronograf dashboard available at http://localhost:8888)
docker compose --profile visualization up -d --wait

# Verify services are healthy
docker compose ps

# The container's ENTRYPOINT is set to `k6`, so you pass k6 commands directly
# OR: Run k6 tests
docker compose --profile load-test run --rm k6 run scripts/main.js

# OR: Run k6 tests with environment variable override
docker compose --profile load-test run --rm k6 run -e CONCURRENT_AGENTS=50 scripts/main.js

# View logs
docker compose logs -f reporting

# Stop and clean up
docker compose down -v

What starts

Service Port Purpose
k6 N/A Load generator (runs on-demand via docker compose run)
Redis 6379 VU synchronization
InfluxDB 8086 Metrics storage
Reporting 3000 CSV report generation
Chronograf 8888 Metrics visualization (optional)
Nginx 8080 Reverse proxy (for distributed tests)

Accessing Results

The Reporting Service container has a volume mount: ./results:/app/results (container path : host path).

When k6 calls the Reporting Service during teardown, the Reporting Service writes results to /app/results/BUILD_TAG/ inside its container, which automatically appears on your host at ./results/BUILD_TAG/.

Verify results exist:

ls -la ./results/
cat ./results/<BUILD_TAG>/GeneralInfo.csv

Container Images

The framework provides two specialized Docker images:

k6 Load Generatorgrafana/k6:latest base with scripts mounted

  • Compute-intensive workload generation
  • Separate from reporting service for independent scaling
  • Can run multiple instances pointing to the same Redis/InfluxDB

Reporting Servicenode:20-alpine base

  • Lightweight API server
  • Prometheus and Kubernetes API integration
  • Health checks integrated

Docker Compose Files

The framework includes two compose files for different use cases:

docker-compose.yml – Full Development Stack

  • Includes all services: Redis, InfluxDB, Reporting Service, Nginx, k6
  • Nginx (reverse proxy) is required only for distributed tests
  • Optional Chronograf for metrics visualization (--profile visualization)
  • Best for: local experimentation, debugging, exploring the full system
docker compose up -d --wait

docker-compose.ci.yml – CI Validation Stack

  • Includes only essential services: Redis, InfluxDB, Reporting Service, k6
  • Purpose: Used by GitHub Actions .github/workflows/ci.yml for automated validation—not intended for local development
docker compose -f docker-compose.ci.yml up -d --wait

Cloud & Kubernetes Deployment

For production deployments beyond Docker Compose:

  • k6 Cloud – Managed distributed load testing at scale (docs)
  • Kubernetes – Deploy reporting service and k6 jobs on any K8s cluster
  • Docker Swarm – Multi-node orchestration using the same compose file

The current architecture is already designed for cloud-native deployments with external metrics storage (InfluxDB, Prometheus) and infrastructure monitoring (Kubernetes API).