### Run Example Project Source: https://github.com/microscaler/brrtrouter/blob/main/docs/PUBLISHING.md Start the Petstore example project to verify its functionality. Test the endpoints after starting. ```bash just start-petstore ``` -------------------------------- ### Install Dependencies and Start Tilt Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SAMPLE_UI_READY.md Installs project dependencies for the sample UI and then starts the Tilt development environment. ```bash cd sample-ui yarn install cd .. tilt up ``` -------------------------------- ### One-time Setup and Development Commands Source: https://github.com/microscaler/brrtrouter/blob/main/docs/TILT_IMPLEMENTATION.md Execute these commands for initial setup, starting, and stopping the development environment using Tilt. ```bash # One-time setup ./scripts/dev-setup.sh # Start development tilt up # Stop development tilt down # Complete teardown ./scripts/dev-teardown.sh ``` -------------------------------- ### Before Migration: Setup Script Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SCRIPTS_TO_JUSTFILE_MIGRATION.md Example of using a shell script for development setup before migrating to Justfile. ```bash # Setup ./scripts/dev-setup.sh ``` -------------------------------- ### Run Development Setup with Registry Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/LOCAL_REGISTRY_FIX.md The `just dev-up` command is the primary way to start the development environment. It ensures the registry is running, sets up the development environment, and starts Tilt. ```bash just dev-up # 1. Starts/restarts registry (transparent) # 2. Runs dev-setup.sh (creates cluster if needed) # 3. Starts Tilt ``` -------------------------------- ### Setup Velero and MinIO Source: https://github.com/microscaler/brrtrouter/blob/main/docs/VELERO_BACKUPS.md Installs Velero CLI, deploys Velero into the KIND cluster, configures MinIO as the S3 backup location, and creates a daily backup schedule. This is a one-time setup process. ```bash chmod +x scripts/setup-velero.sh ./scripts/setup-velero.sh ``` -------------------------------- ### Python Test Setup and Teardown Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/TEST_SETUP_TEARDOWN.md Demonstrates basic test setup and teardown in Python using the unittest framework and a hypothetical start_server function. The setUp method starts a server before each test, and tearDown stops it afterward. ```python class TestAPI(unittest.TestCase): def setUp(self): self.server = start_server() def tearDown(self): self.server.stop() def test_success(self): resp = requests.get(self.server.url + "/pets") self.assertEqual(resp.status_code, 200) ``` -------------------------------- ### After Migration: Setup Command Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SCRIPTS_TO_JUSTFILE_MIGRATION.md Equivalent Justfile command for development setup. ```bash # Setup just dev-up ``` -------------------------------- ### Farm CLI Usage Examples Source: https://github.com/microscaler/brrtrouter/blob/main/docs/tasks/development-workflow.md Commands for starting Farm CLI sessions, running tests, checking coverage, and linting Python code. Ensure the Farm CLI is installed and configured. ```bash # Always start sessions farm agent startup ``` ```bash # Use for testing farm test python test_file.py ``` ```bash # Use for coverage farm coverage python ``` ```bash # Use for linting farm lint python --fix ``` -------------------------------- ### Good Documentation Example: Usage Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/DOCUMENTATION_ULTIMATE_SUMMARY.md Show real-world usage with a code example. This example demonstrates how to instantiate and configure a remote API key provider. ```rust /// # Example /// /// ```rust /// let provider = RemoteApiKeyProvider::new("https://api.example.com/verify") /// .timeout_ms(1000) /// .cache_ttl(300); /// ``` ``` -------------------------------- ### Composable Justfile Recipe Example Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SCRIPTS_REMOVAL_COMPLETE.md Demonstrates how Justfile recipes can be composed, allowing one recipe to call others. This example shows `dev-up` calling `dev-registry` and other setup tasks. ```makefile dev-up: just dev-registry # ... other setup ``` -------------------------------- ### Successful Startup Log Example Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/TOOMANYHEADERS_FIX_SUMMARY.md This log output indicates the pet_store server has started successfully. It's a positive sign that the TooManyHeaders error is resolved. ```text [startup] 🚀 Starting pet_store server [route] GET /health -> health_check Server started successfully on 0.0.0.0:8080 ``` -------------------------------- ### API Key Authentication Example Source: https://github.com/microscaler/brrtrouter/blob/main/docs/tasks/generatorImprovementsPRD.md Example of accepting requests authenticated via an 'X-API-Key' header. This is a basic setup for API key authentication. ```bash BRRTR_API_KEY=test123 requests with -H "X-API-Key: test123" succeed for secured routes ``` -------------------------------- ### Download Velero CRDs and Start MinIO Source: https://github.com/microscaler/brrtrouter/blob/main/docs/VELERO_DECLARATIVE_SETUP.md One-time setup commands to download Velero Custom Resource Definitions and start the MinIO backup server. ```bash just download-velero-crds # One-time just start-minio # Start backup server ``` -------------------------------- ### Run BRRTRouter with Tilt and Kind Source: https://github.com/microscaler/brrtrouter/blob/main/CONTRIBUTING.md This snippet outlines the steps to clone the repository, create a kind Kubernetes cluster, and start the Tilt development environment. It's recommended for a comprehensive local setup. ```bash # Prerequisites: Docker, kind, kubectl, tilt # See docs/LOCAL_DEVELOPMENT.md for installation # 1. Clone and setup (30 seconds) git clone https://github.com/microscaler/BRRTRouter.git cd BRRTRouter # 2. Kind cluster once (context kind-kind); monorepo: use ../shared-kind-cluster `just dev-up` instead kind create cluster --config k8s/cluster/kind-config.yaml --wait 120s # 3. Start Tilt (registry + wire + tilt up) just dev-up # 4. Access your services open http://localhost:8081 # 🎨 Interactive Dashboard open http://localhost:8081/docs # 📖 Swagger UI open http://localhost:3000 # 📊 Grafana (admin/admin) ``` -------------------------------- ### Server Running Status Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/UI_DEPLOYMENT_SUCCESS.md Confirms that the example server has started successfully and is listening on the specified port. ```text 🚀 pet_store example server listening on 0.0.0.0:8080 Server started successfully on 0.0.0.0:8080 ``` -------------------------------- ### Automatic Docker Volume Setup Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/PERSISTENT_DOCKER_VOLUMES.md Use 'just dev-up' for automatic setup or './scripts/dev-setup.sh' for manual setup of Docker volumes. ```bash just dev-up ``` ```bash ./scripts/dev-setup.sh ``` -------------------------------- ### Install Dependencies with Yarn Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SAMPLE_UI_SETUP.md Navigate to the sample-ui directory and install project dependencies using Yarn. ```bash cd sample-ui yarn install ``` -------------------------------- ### Start Tilt Development Environment Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/CONTRIBUTOR_ONBOARDING.md Initiates the Tilt development environment, which compiles the BRRTRouter library, generates and builds the pet_store example, cross-compiles it, builds a Docker image, and deploys everything to the kind cluster. It also starts supporting services like PostgreSQL, Redis, Prometheus, Grafana, and Jaeger. ```bash tilt up ``` -------------------------------- ### Start BRRTRouter Tilt Development Environment Source: https://github.com/microscaler/brrtrouter/blob/main/docs/LOCAL_DEVELOPMENT.md Starts the BRRTRouter Tilt development environment from the repository root. This command also starts the registry and wires nodes. ```bash # From BRRTRouter repo root (starts registry, wires nodes, tilt up) just dev-up ``` -------------------------------- ### Declarative Setup with Tilt Source: https://github.com/microscaler/brrtrouter/blob/main/docs/VELERO_DECLARATIVE_SETUP.md Commands for a declarative Velero setup using Tilt. This approach is reproducible and version-controlled. ```bash just download-velero-crds # One-time just dev-up # Tilt manages everything # Benefits: # - Declarative, reproducible # - Version controlled # - Tilt auto-applies changes # - Git-friendly ``` -------------------------------- ### Set Up Development Environment Source: https://github.com/microscaler/brrtrouter/blob/main/CONTRIBUTING.md Clone the repository, create a local Kubernetes cluster using kind, and start the development environment with Tilt. ```bash git clone https://github.com/microscaler/BRRTRouter.git cd BRRTRouter kind create cluster --config k8s/cluster/kind-config.yaml --wait 120s # once; context kind-kind just dev-up # registry + Tilt (does not create the cluster) ``` -------------------------------- ### Remote API Key Verification Request Example Source: https://github.com/microscaler/brrtrouter/blob/main/docs/SecurityAuthentication.md An example HTTP GET request to the verification endpoint for an API key. ```http GET /verify HTTP/1.1 Host: auth.example.com X-API-Key: user_provided_key_here ``` -------------------------------- ### Build Pet Store Example Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/JEMALLOC_SETUP.md Builds the pet_store example project locally. It automatically utilizes jemalloc due to its dependencies. ```bash cd examples/pet_store cargo build --release ``` -------------------------------- ### Get Application Roles API Example Source: https://github.com/microscaler/brrtrouter/blob/main/docs/SPIFFY_mTLS/Generic_Access_Management_Service_Design.md Example of retrieving all defined roles for a given application using the Registration API. ```http GET /api/am/applications/{app_id}/roles ``` -------------------------------- ### View Documentation Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/DOCUMENTATION_FINAL_SUMMARY.md Use these commands to build and open the project's documentation locally. ```bash just docs # or cargo doc --open ``` -------------------------------- ### Build and Run BRRTRouter UI Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SOLIDJS_SHOWCASE_SUMMARY.md Commands to build the sample UI for BRRTRouter. Assumes you are in the project root. Builds are output to ../examples/pet_store/static_site/. Recommended to use Tilt for development. ```bash cd sample-ui npm install npm run build:petstore # Builds to: ../examples/pet_store/static_site/ # Run with Tilt (recommended) just dev-up # Access at: http://localhost:8080/ ``` -------------------------------- ### Test Module Documentation Example Source: https://github.com/microscaler/brrtrouter/blob/main/CONTRIBUTING.md Example of module-level documentation for a test module. It should explain what is being tested, the coverage scope, and any special setup or teardown procedures. ```rust //! # Router Tests //! //! Tests for path matching, parameter extraction, and route resolution. //! //! Coverage: //! - Path parameter extraction //! - Query parameter parsing //! - HTTP method matching //! - 404 handling ``` -------------------------------- ### Automatic Setup Call in Test Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/DOCKER_IMAGE_SETUP.md This example shows how the Docker image setup is automatically triggered by calling `base_url()`. No manual changes are needed in existing tests. ```rust #[test] fn test_something() { let url = curl_harness::base_url(); // Setup happens here automatically // ... test code ... } ``` -------------------------------- ### Start Pet Store with Jemalloc Enabled Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/JEMALLOC_SETUP.md Launch the pet_store application to enable jemalloc and observe its runtime metrics. ```bash # Start pet_store ./target/release/pet_store --spec examples/pet_store/doc/openapi.yaml # Check metrics curl http://localhost:8080/metrics | grep memory # Look for: process_memory_rss_bytes process_memory_vss_bytes process_memory_peak_rss_bytes ``` -------------------------------- ### Troubleshoot Sample UI Build Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/TILT_DEPENDENCY_FIX.md If the 'build-sample-ui' step is failing, navigate to the 'sample-ui' directory and run these commands to install dependencies and build the project locally. ```bash cd sample-ui yarn install yarn build:copy ``` -------------------------------- ### Documenting Fixture Behavior Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/TEST_SETUP_TEARDOWN.md Clearly document the setup, teardown, and behavior of your test fixtures using doc comments. Include examples of how to use the fixture and what actions are performed during setup and teardown. ```rust /// Test fixture for Pet Store API server /// /// # Setup /// - Configures 32KB coroutine stack size /// - Initializes tracing subscriber /// - Loads OpenAPI spec from `examples/openapi.yaml` /// - Starts HTTP server on random port /// - Waits for server to be ready /// /// # Teardown /// - Stops HTTP server gracefully /// - Drops tracing subscriber /// /// # Example /// ``` /// #[test] /// fn test_api() { /// let server = PetStoreTestServer::new(); /// // Test code here /// // Automatic cleanup when server goes out of scope /// } /// ``` struct PetStoreTestServer { // ... ``` -------------------------------- ### Testing UI with Tilt Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SOLIDJS_UI_INTEGRATION.md Instructions for starting Tilt and accessing the running UI. Includes commands to start the development environment and open the Tilt UI and the application URL. ```bash # Start Tilt just dev-up # Check build-sample-ui resource in Tilt UI open http://localhost:10353 # Access the UI open http://localhost:8080/ ``` -------------------------------- ### First Time Setup: Build Docker Image Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/CURL_TESTS_COMPLETE_FIX.md Command to build the Docker image for the brrtrouter-petstore application. This is a one-time setup step. ```bash # Build the Docker image (one time, 5-10 minutes) docker build -t brrtrouter-petstore:e2e . ``` -------------------------------- ### Build and Run Local Pet Store Example Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/REQUEST_LOGGING_IMPLEMENTED.md Build the project and run the pet store example locally on port 8080. This is a prerequisite for generating traffic and testing logs. ```bash cargo build cd examples/pet_store ``` ```bash cargo run -- --spec doc/openapi.yaml --port 8080 ``` -------------------------------- ### Server Start Sleep in Tests Source: https://github.com/microscaler/brrtrouter/blob/main/docs/ROADMAP.md This example shows a `std::thread::sleep` used after starting the HTTP server in tests to wait for readiness. This is a known limitation as deterministic handshakes and graceful shutdowns are missing. ```Rust std::thread::sleep(Duration::from_millis(50)); HttpServer::start(server).await.unwrap(); ``` -------------------------------- ### Start UI Development Server Source: https://github.com/microscaler/brrtrouter/blob/main/AGENTS.md Launches the SolidJS development server for the sample UI. This provides hot-reloading and other development features. ```bash yarn dev ``` -------------------------------- ### OpenAPI Specification Example for User Retrieval Source: https://github.com/microscaler/brrtrouter/blob/main/BRRTRouter_BEGINNER_GUIDE.md This OpenAPI YAML snippet defines a GET endpoint for retrieving a user by ID, including parameter definitions, response schemas, and an example payload. It demonstrates how the spec serves as self-documenting API information. ```yaml paths: /users/{id}: get: summary: Get user by ID description: Retrieves a user by their unique identifier parameters: - name: id in: path required: true schema: type: string format: uuid description: The user's unique identifier responses: '200': description: User found content: application/json: schema: $ref: '#/components/schemas/User' examples: default: value: id: "123e4567-e89b-12d3-a456-426614174000" email: "user@example.com" name: "John Doe" '404': description: User not found ``` -------------------------------- ### Sample UI Build Steps Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SAMPLE_UI_BUILD_FLOW.md Details the commands and processes involved in building the sample UI using Yarn and Vite, including dependency installation, SolidJS compilation, and Tailwind CSS processing. ```bash cd sample-ui && yarn install && yarn build:copy ``` -------------------------------- ### Example of Removed Script: verify-everything.sh Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SCRIPTS_REMOVAL_COMPLETE.md The `scripts/verify-everything.sh` script was removed. Use `just dev-status` combined with `kubectl get all -n brrtrouter-dev` for verification. ```bash just dev-status kubectl get all -n brrtrouter-dev ``` -------------------------------- ### CI Verification Output Example Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/CI_ZIGBUILD_FIX.md Illustrates the expected output in the CI pipeline after the cargo-zigbuild installation, showing successful build and test steps. ```text ✓ Install musl tools ✓ Install cargo-zigbuild (for curl_harness cross-compilation) ✓ Build pet_store (musl, release) ... ✓ Run tests (nextest - primary) running 6 tests === Docker Image Setup (Thread ThreadId(2)) === [1/5] Checking Docker availability... ✓ Docker is available [2/5] Building pet_store binary for Linux x86_64... ✓ Build complete (15.3s) ← SUCCESS! [3/5] Verifying binary... ✓ Binary exists ... ``` -------------------------------- ### Start Tilt and Open UI Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SAMPLE_UI_TILT_INTEGRATION.md Initiates the Tilt development environment and provides instructions to access the Tilt UI for monitoring build status. ```bash # View Tilt UI tilt up # Press 'space' to open web UI ``` -------------------------------- ### Sample UI Directory Structure Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SAMPLE_UI_BUILD_FLOW.md Illustrates the directory structure for the sample UI project, including source files, build output, and deployment target. ```text sample-ui/ ├── src/ │ ├── App.jsx ← Your edits │ ├── components/*.jsx ← Your edits │ └── index.css ← Tailwind directives tailwind.config.js ← Theme config postcss.config.js ← PostCSS pipeline └── vite.config.js ← Build config ``` ```text sample-ui/dist/ ← Generated by Vite ├── index.html └── assets/ ├── index-abc123.js ← Hashed for cache busting └── index-abc123.css ``` ```text examples/pet_store/static_site/ ← Copy destination ├── index.html └── assets/ ├── index-abc123.js └── index-abc123.css ``` ```text /app/static_site/ ← Inside container ├── index.html └── assets/ ├── index-abc123.js └── index-abc123.css ``` -------------------------------- ### Performance Testing Workflow Example Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/PERFORMANCE_MCP_SERVER_PRD.md Outlines a workflow for AI Agent performance testing, including starting the service, running tests, detecting regressions, and cleanup. ```python # AI Agent Performance Testing Workflow 1. start_petstore() → Wait for health check 2. run_performance_test(label="feature-x", baseline="main") → Get test_id 3. detect_regressions(test_id, baseline="main") → Check for regressions 4. if regressions: - get_test_result(test_id) → Analyze details - compare_with_baseline(test_id, baseline="main") → Get full comparison - Alert developer or rollback 5. stop_petstore() → Cleanup ``` -------------------------------- ### Reproduce CI Environment Locally with Tilt Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/TILT_CI_INTEGRATION.md Steps to set up a local Kind cluster, build binaries, run Tilt CI, and perform basic testing. Includes cleanup commands. ```bash # 1. Create kind cluster kind create cluster --name brrtrouter-ci # 2. Build binaries cargo zigbuild --release --target x86_64-unknown-linux-musl cargo run --bin brrtrouter-gen -- generate --spec examples/openapi.yaml --force cargo zigbuild --release --target x86_64-unknown-linux-musl -p pet_store mkdir -p build_artifacts cp target/x86_64-unknown-linux-musl/release/pet_store build_artifacts/ # 3. Run Tilt CI tilt ci --timeout 10m # 4. Test kubectl port-forward -n brrtrouter-dev service/petstore 8080:8080 & curl http://localhost:8080/health curl http://localhost:8080/metrics | grep brrtrouter_path # 5. Cleanup tilt down kind delete cluster --name brrtrouter-ci ``` -------------------------------- ### Test Item Endpoints Source: https://github.com/microscaler/brrtrouter/blob/main/docs/tasks/development-workflow.md Perform tests for retrieving a specific item and creating a new item. Includes examples for GET and POST requests with JSON payloads. ```bash echo "=== TESTING ITEM ENDPOINTS ===" # GET /items/{item_id} - Get specific item curl -s -w "Status: %{http_code}\n" -H "X-API-Key: test123" http://localhost:8081/items/789 # POST /items - Create new item curl -s -w "Status: %{http_code}\n" -X POST -H "X-API-Key: test123" -H "Content-Type: application/json" \ -d '{"name":"Test Item","category":"electronics"}' http://localhost:8081/items ``` -------------------------------- ### Production Build and Deployment Testing Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SAMPLE_UI_TILT_INTEGRATION.md Steps to build the UI for production, copy it to the pet store, and test the deployed version via Tilt. ```bash # Build and deploy cd sample-ui yarn build:copy # Check build output ls -la dist/ # Test in Tilt open http://localhost:8080 ``` -------------------------------- ### Build Pet Store Example Source: https://github.com/microscaler/brrtrouter/blob/main/AGENTS.md Compiles only the generated pet store example crate. Useful for testing changes specific to the pet store. ```bash cargo build -p pet_store ``` -------------------------------- ### Test Pet Endpoints Source: https://github.com/microscaler/brrtrouter/blob/main/docs/tasks/development-workflow.md Perform tests for listing all pets, retrieving a specific pet, and adding a new pet. Includes examples for GET and POST requests with JSON payloads. ```bash echo "=== TESTING PET ENDPOINTS ===" # GET /pets - List all pets curl -s -w "Status: %{http_code}\n" -H "X-API-Key: test123" http://localhost:8081/pets # GET /pets/{petId} - Get specific pet curl -s -w "Status: %{http_code}\n" -H "X-API-Key: test123" http://localhost:8081/pets/1 # POST /pets - Add new pet curl -s -w "Status: %{http_code}\n" -X POST -H "X-API-Key: test123" -H "Content-Type: application/json" \ -d '{"name":"Fluffy","status":"available"}' http://localhost:8081/pets ``` -------------------------------- ### Run Basic Performance Test for BRRTRouter Source: https://github.com/microscaler/brrtrouter/blob/main/examples/PERFORMANCE_METRICS_README.md Starts the BRRTRouter server and then runs a basic performance test using the `performance_metrics_load_test` example. This is useful for a quick check of the server's performance under load. ```bash # Start your BRRTRouter server first cargo run --release --example pet_store -- \ --spec examples/pet_store/doc/openapi.yaml \ --addr 0.0.0.0:8081 # In another terminal, run the performance test cargo run --release --example performance_metrics_load_test -- \ --host http://localhost:8081 \ --users 100 \ --run-time 5m ``` -------------------------------- ### Justfile Recipe for Docker Registry Setup Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SCRIPTS_TO_JUSTFILE_MIGRATION.md Defines the 'dev-registry' recipe in the Justfile to start a Docker registry container if it's not already running. It maps port 5001 on the host to port 5000 in the container. ```makefile dev-registry: #!/usr/bin/env bash if [ "$(docker inspect -f '{{.State.Running}}' kind-registry 2>/dev/null || true)" != 'true' ]; then docker run -d --restart=always \ -p "127.0.0.1:5001:5000" \ --network bridge \ --name kind-registry \ registry:2 fi ``` -------------------------------- ### Rust Documentation for Base URL and Container Cleanup Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/DOCKER_CLEANUP_FIX.md This documentation explains how to get the base URL for a shared test container. It details that the container is lazily started on first access and automatically cleaned up when the test process exits. ```rust /// Get the base URL for the shared test container /// /// Lazily starts the container on first access and returns the URL for all subsequent calls. /// The container is automatically cleaned up when the test process exits. pub fn base_url() -> &'static str { let h = HARNESS.get_or_init(ContainerHarness::start); h.base_url.as_str() } ``` -------------------------------- ### Staging Area Implementation Example Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/STAGING_AREA_PATTERN.md Demonstrates the command-line steps to build a cross-compiled Rust binary, stage it, and then build a Docker image that can access the staged artifact. ```bash # Build cross-compiled binary cargo zigbuild --release --target x86_64-unknown-linux-musl -p pet_store # Stage it where Docker can see it mkdir -p build_artifacts cp target/x86_64-unknown-linux-musl/release/pet_store build_artifacts/ # Docker can now copy it docker build -f dockerfiles/Dockerfile.test -t brrtrouter-petstore:e2e . ``` -------------------------------- ### Run BRRTRouter with Simple Cargo Run Source: https://github.com/microscaler/brrtrouter/blob/main/CONTRIBUTING.md This snippet demonstrates how to clone the repository and start the Pet Store example using `cargo run` for quick testing without Kubernetes. It also includes commands to test the API and access the interactive dashboard. ```bash git clone https://github.com/microscaler/BRRTRouter.git cd BRRTRouter # Start the Pet Store example just start-petstore # Test the API curl -H "X-API-Key: test123" http://localhost:8081/pets curl http://localhost:8081/health # Visit the Interactive Demo Dashboard open http://localhost:8081/ ``` -------------------------------- ### Build UI Command Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/SOLIDJS_UI_COMPLETE.md Use 'just build-ui' or navigate to the sample-ui directory and run 'npm run build:petstore' to build the SolidJS UI. ```bash just build-ui # or cd sample-ui && npm run build:petstore ``` -------------------------------- ### Migration Guide for Developers Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/KIND_REGISTRY_FIX.md Steps to migrate an existing KIND cluster to incorporate registry configuration fixes. This involves stashing work, tearing down the old cluster, pulling the latest changes, creating a new cluster with updated configuration, verifying the setup, and restoring work. ```bash # 1. Save any important work git stash # 2. Tear down old cluster just dev-down # 3. Pull latest changes (includes kind-config.yaml update) git pull # 4. Create new cluster with proper configuration just dev-up # 5. Verify it works just dev-registry-verify # 6. Restore work git stash pop ``` -------------------------------- ### Setup Velero Environment Source: https://github.com/microscaler/brrtrouter/blob/main/docs/VELERO_BACKUPS.md This command initiates the setup process for the Velero environment, likely configuring necessary components and resources. ```bash ./scripts/setup-velero.sh ``` -------------------------------- ### Start Development Environment Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/KIND_REGISTRY_FIX.md This command starts the development environment, including the registry, cluster creation with containerd patch, registry configuration on nodes, and Tilt. ```bash # This now includes everything just dev-up ``` -------------------------------- ### Install and Verify Cross-Compilation Toolchain Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/CONTRIBUTOR_ONBOARDING.md Installs `cargo-zigbuild` for cross-compilation and verifies the Zig compiler installation. Includes macOS Homebrew installation and manual download instructions. ```bash cargo install cargo-zigbuild zig version brew install zig # macOS # or download from https://ziglang.org/download/ ``` -------------------------------- ### Install Rust on Linux Source: https://github.com/microscaler/brrtrouter/blob/main/docs/LOCAL_DEVELOPMENT.md Installs the Rust programming language toolchain on Linux using the official installer script. ```bash # Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -------------------------------- ### Load Test with Startup Metrics Source: https://github.com/microscaler/brrtrouter/blob/main/docs/wip/LOAD_TESTING.md Includes startup metrics for more accurate results. Recommended for comprehensive performance analysis. ```bash # Include startup metrics (recommended for accurate results) cargo run -- --host http://localhost:8080 \ --users 10 \ --run-time 30s \ --no-reset-metrics ```