kairos-cli-0.2.10 is not a library.
Kairos CLI
Command-line interface for managing and interacting with Kairos API Gateway.
Overview
kairos-cli provides a powerful command-line tool for managing Kairos Gateway instances, testing configurations, and monitoring gateway health.
Installation
From crates.io
The binary is named kairos:
From Source
The binary will be located at target/release/kairos.
Features
- 🔧 Configuration Management: Validate and test gateway configurations
- 🏥 Health Checks: Monitor gateway and backend health
- 📊 Metrics: Query gateway metrics and statistics
- 🔍 Route Testing: Test route configurations before deployment
- 📝 Config Generation: Generate sample configurations
- 🚀 Quick Setup: Bootstrap new gateway configurations
Usage
Basic Commands
# Show help
# Show version
# Validate configuration
# Test a route
# Check gateway health
# Generate sample config
Command Reference
kairos validate
Validate a configuration file:
Examples:
# Basic validation
# Verbose validation with details
# Strict mode (error on warnings)
kairos test-route
Test a specific route configuration:
)
Examples:
# Test a GET route
# Test a POST route
# Test specific backend
kairos health
Check gateway health status:
)
)
Examples:
# Check gateway health
# Check with custom URL
# Check gateway and all backends
kairos init
Initialize a new gateway configuration:
)
)
Templates:
basic- Simple HTTP proxy configurationadvanced- Full-featured configuration with all optionsmulti-protocol- Example with multiple protocol typeskubernetes- Configuration for Kubernetes deployment
Examples:
# Generate basic configuration
# Use advanced template
# Generate WebSocket configuration
kairos metrics
Query gateway metrics:
)
)
Examples:
# Get all metrics
# Get metrics in JSON format
# Filter specific metrics
kairos config
Configuration management commands:
Examples:
# Show configuration
# Compare configurations
# Merge configurations
# Format configuration
Configuration File Example
Use Cases
1. Pre-deployment Validation
# Validate before deploying
# Test critical routes
# Check backend connectivity
2. Configuration Development
# Generate starting point
# Edit configuration...
# Validate changes
# Test locally
3. Production Monitoring
# Monitor gateway health
# Check metrics
# Verify configuration
4. CI/CD Integration
#!/bin/bash
# validate.sh
# Validate configuration
if ! ; then
fi
# Test routes
for; do
if ! ; then
fi
done
Environment Variables
KAIROS_GATEWAY_URL: Default gateway URL for commandsKAIROS_CONFIG_PATH: Default configuration file pathKAIROS_TIMEOUT: Default request timeout in seconds
Example:
# Now you can omit these options
Exit Codes
0- Success1- Validation/test failure2- Connection error3- Configuration error4- Authentication error
Integration Examples
Shell Script
#!/bin/bash
# Check if gateway is healthy
if ! ; then
fi
# Validate config before reload
if ; then
else
fi
GitHub Actions
name: Validate Configuration
on:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Kairos CLI
run: cargo install kairos-cli
- name: Validate Configuration
run: kairos validate config.json --strict
- name: Test Routes
run: |
kairos test-route --config config.json --path /api/users
kairos test-route --config config.json --path /api/products
Kubernetes Deployment
# Validate config before creating ConfigMap
# Create ConfigMap
# Deploy gateway
# Wait for gateway to be ready
# Verify health
Troubleshooting
Connection Issues
# Test with increased timeout
# Check network connectivity
Validation Errors
# Use verbose mode for details
# Check specific format issues
Dependencies
This crate works with the kairos-gateway binary.
Documentation
Contributing
Contributions are welcome! Please see the main repository for contribution guidelines.
License
Licensed under MIT License. See LICENSE for details.