Deploying Coroot
Introduction
Coroot is an open-source monitoring and observability platform designed to help you monitor and troubleshoot your applications with zero instrumentation. It provides comprehensive insights into your infrastructure by analyzing metrics, logs, and traces to automatically identify issues and their root causes. Built to work seamlessly with Prometheus and other cloud-native technologies, Coroot transforms raw telemetry data into actionable insights.
Coroot stands out for its:
- Zero Instrumentation: Monitor applications without code changes or agent installation
- Root Cause Analysis: Automatically identify and diagnose issues in your infrastructure
- Service Map: Visual representation of your microservices and their dependencies
- Cost Optimization: Track and optimize your infrastructure costs
- ClickHouse Backend: High-performance data storage for metrics and traces
- Prometheus Integration: Native support for Prometheus metrics
- Alert Management: Intelligent alerting with context-rich notifications
- Beautiful Dashboards: Pre-built dashboards for common services and applications
This comprehensive guide walks you through deploying Coroot on Klutch.sh using Docker, including detailed installation steps, sample configurations, persistent storage setup, and production-ready best practices.
Prerequisites
Before you begin, ensure you have the following:
- A Klutch.sh account
- A GitHub account with a repository for your Coroot project
- Docker installed locally for testing (optional but recommended)
- Basic understanding of Docker, Prometheus, and observability concepts
- (Optional) A Prometheus instance or metrics source to monitor
Installation and Setup
Step 1: Create Your Project Directory
First, create a new directory for your Coroot deployment project:
mkdir coroot-klutchcd coroot-klutchgit initStep 2: Create the Dockerfile
Create a Dockerfile in your project root directory. This will define your Coroot container configuration:
FROM ghcr.io/coroot/coroot:latest
# Expose the default Coroot portEXPOSE 8080
# Set environment variablesENV BOOTSTRAP_CLICKHOUSE_ADDRESS=localhost:9000ENV BOOTSTRAP_PROMETHEUS_URL=http://localhost:9090
# Start CorootCMD ["coroot"]Note: This basic Dockerfile uses the official Coroot image. For production deployments with ClickHouse and Prometheus integration, see the advanced configuration sections below.
Step 3: Advanced Dockerfile with ClickHouse
For a production-ready setup with ClickHouse for data storage:
FROM ghcr.io/coroot/coroot:latest
# Set working directoryWORKDIR /app
# Create data directoriesRUN mkdir -p /data/clickhouse /data/coroot
# Expose Coroot web interface portEXPOSE 8080
# Set environment variablesENV BOOTSTRAP_CLICKHOUSE_ADDRESS=clickhouse:9000ENV BOOTSTRAP_PROMETHEUS_URL=http://prometheus:9090ENV DATA_DIR=/data/coroot
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ CMD wget --quiet --tries=1 --spider http://localhost:8080/health || exit 1
# Start CorootCMD ["coroot", "--data-dir=/data/coroot"]Step 4: Create Docker Compose Configuration for Local Testing
Create a docker-compose.yml file for local testing with ClickHouse:
version: '3.8'
services: clickhouse: image: clickhouse/clickhouse-server:latest ports: - "9000:9000" - "8123:8123" volumes: - clickhouse-data:/var/lib/clickhouse environment: CLICKHOUSE_DB: coroot CLICKHOUSE_USER: coroot CLICKHOUSE_PASSWORD: coroot_password healthcheck: test: ["CMD", "wget", "--spider", "-q", "localhost:8123/ping"] interval: 30s timeout: 5s retries: 3
coroot: build: . ports: - "8080:8080" depends_on: - clickhouse environment: BOOTSTRAP_CLICKHOUSE_ADDRESS: clickhouse:9000 BOOTSTRAP_CLICKHOUSE_USER: coroot BOOTSTRAP_CLICKHOUSE_PASSWORD: coroot_password BOOTSTRAP_CLICKHOUSE_DATABASE: coroot BOOTSTRAP_PROMETHEUS_URL: http://prometheus:9090 volumes: - coroot-data:/data/coroot
volumes: clickhouse-data: coroot-data:Important Note: Klutch.sh does not support Docker Compose for deployment. This configuration is only for local development and testing. For production deployment on Klutch.sh, you’ll need to deploy ClickHouse and Coroot as separate applications.
Step 5: Create Environment Configuration
Create a .env.example file to document the required environment variables:
# Coroot ConfigurationDATA_DIR=/data/coroot
# ClickHouse ConfigurationBOOTSTRAP_CLICKHOUSE_ADDRESS=clickhouse-app.klutch.sh:8000BOOTSTRAP_CLICKHOUSE_USER=corootBOOTSTRAP_CLICKHOUSE_PASSWORD=your-secure-password-hereBOOTSTRAP_CLICKHOUSE_DATABASE=coroot
# Prometheus ConfigurationBOOTSTRAP_PROMETHEUS_URL=http://prometheus-app.klutch.sh:8000
# Optional: Additional Prometheus sourcesBOOTSTRAP_PROMETHEUS_EXTRA_SELECTOR=cluster="production"
# Optional: Refresh intervalsBOOTSTRAP_REFRESH_INTERVAL=15s
# Optional: Disable ClickHouse for testing (uses in-memory storage)DISABLE_CLICKHOUSE=falseSecurity Note: Never commit actual passwords or sensitive data to your repository. Use environment variables in Klutch.sh dashboard.
Step 6: Test Locally (Optional)
Before deploying to Klutch.sh, you can test your Coroot setup locally using Docker Compose:
# Start all servicesdocker-compose up -d
# View logsdocker-compose logs -f coroot
# Access Coroot at http://localhost:8080
# Stop all servicesdocker-compose downFor testing without ClickHouse, you can run Coroot standalone:
# Build the Docker imagedocker build -t my-coroot .
# Run the containerdocker run -d \ --name coroot-test \ -p 8080:8080 \ -e DISABLE_CLICKHOUSE=true \ -e BOOTSTRAP_PROMETHEUS_URL=http://your-prometheus:9090 \ my-coroot
# View logsdocker logs -f coroot-test
# Access Coroot at http://localhost:8080
# Stop and remove the test container when donedocker stop coroot-testdocker rm coroot-testStep 7: Create Documentation
Create a README.md file with setup instructions:
# Coroot Observability Platform
## Overview
This repository contains the Docker configuration for deploying Coroot on Klutch.sh.
## Features
- Zero instrumentation monitoring- Automatic root cause analysis- Service dependency mapping- Cost optimization insights- Integration with Prometheus and ClickHouse
## Deployment
See the full deployment guide in the Klutch.sh documentation.
## Configuration
Key environment variables:- `BOOTSTRAP_CLICKHOUSE_ADDRESS`: ClickHouse server address- `BOOTSTRAP_PROMETHEUS_URL`: Prometheus server URL- `DATA_DIR`: Data directory for persistent storage
## Accessing Coroot
Once deployed, access your Coroot dashboard at:https://example-app.klutch.shStep 8: Push to GitHub
Commit your Dockerfile and configuration files to your GitHub repository:
git add Dockerfile docker-compose.yml .env.example README.mdgit commit -m "Add Coroot Dockerfile and configuration"git remote add origin https://github.com/yourusername/coroot-klutch.gitgit push -u origin mainDeploying to Klutch.sh
Now that your Coroot project is ready and pushed to GitHub, follow these steps to deploy it on Klutch.sh with persistent storage.
Deployment Steps
-
Deploy ClickHouse First (Recommended)
For production deployments, deploy ClickHouse as a separate application before deploying Coroot:
- Create a new app in Klutch.sh for ClickHouse using the official ClickHouse Docker image
- Configure it with TCP traffic type on the ClickHouse native protocol port
- Set the internal port to
9000(ClickHouse native protocol port) - Attach a persistent volume at
/var/lib/clickhousefor data storage - Note the assigned URL (e.g.,
clickhouse-app.klutch.sh) for use in Coroot configuration
Note: For TCP traffic on Klutch.sh, connections are made on port 8000, which routes to the internal port you specify.
-
Log in to Klutch.sh
Navigate to klutch.sh/app and sign in to your account.
-
Create a New Project
Go to Create Project and give your project a meaningful name (e.g., “Coroot Monitoring”).
-
Create a New App
Navigate to Create App and configure the following settings:
-
Select Your Repository
- Choose GitHub as your Git source
- Select the repository containing your Dockerfile
- Choose the branch you want to deploy (usually
mainormaster)
-
Configure Traffic Type
- Traffic Type: Select HTTP (Coroot serves a web interface via HTTP)
- Internal Port: Set to
8080(the default port that Coroot listens on)
-
Set Environment Variables
Add the following environment variables for your Coroot configuration:
Required Variables:
BOOTSTRAP_CLICKHOUSE_ADDRESS: Your ClickHouse server address (e.g.,clickhouse-app.klutch.sh:8000)BOOTSTRAP_CLICKHOUSE_USER: ClickHouse username (e.g.,coroot)BOOTSTRAP_CLICKHOUSE_PASSWORD: ClickHouse password (use a strong password)BOOTSTRAP_CLICKHOUSE_DATABASE: Database name (e.g.,coroot)BOOTSTRAP_PROMETHEUS_URL: Your Prometheus server URL (e.g.,http://prometheus-app.klutch.sh:8000)DATA_DIR: Set to/data/corootfor persistent storage
Optional Variables:
BOOTSTRAP_REFRESH_INTERVAL: Metrics refresh interval (default:15s)BOOTSTRAP_PROMETHEUS_EXTRA_SELECTOR: Additional Prometheus label selector
For Testing Without ClickHouse:
DISABLE_CLICKHOUSE: Set totrueto use in-memory storage (not recommended for production)
Security Note: Always use strong, unique passwords for production deployments.
-
Attach a Persistent Volume
This is critical for ensuring your Coroot data persists across deployments and restarts:
- In the Volumes section, click “Add Volume”
- Mount Path: Enter
/data/coroot(this is where Coroot stores its configuration and cache data) - Size: Choose an appropriate size based on your monitoring needs (e.g., 10GB for small deployments, 50GB+ for large infrastructures)
Important: Coroot requires persistent storage to maintain configuration and cached data between container restarts.
-
Configure Additional Settings
- Region: Select the region closest to your infrastructure for optimal latency
- Compute Resources: Choose CPU and memory based on your monitoring scale (minimum 1GB RAM recommended)
- Instances: Start with 1 instance (Coroot is designed for single-instance operation)
-
Deploy Your Application
Click “Create” to start the deployment. Klutch.sh will:
- Automatically detect your Dockerfile in the repository root
- Build the Docker image
- Attach the persistent volume
- Start your Coroot container
- Assign a URL for external access
-
Access Your Coroot Dashboard
Once deployment is complete, you’ll receive a URL like
example-app.klutch.sh. Navigate to this URL in your browser to access your Coroot dashboard:https://example-app.klutch.shOn first access, Coroot will guide you through the initial setup process.
Configuring Data Sources
After your Coroot instance is deployed, you need to configure your data sources for monitoring:
Connecting Prometheus
- Log in to your Coroot dashboard at
https://example-app.klutch.sh - Navigate to Settings → Integrations
- Click “Add Prometheus”
- Enter your Prometheus URL (e.g.,
http://prometheus-app.klutch.sh:8000) - (Optional) Add custom labels or filters
- Click “Save” to start collecting metrics
Configuring ClickHouse Storage
If you haven’t set ClickHouse configuration via environment variables:
- Go to Settings → Storage
- Enter your ClickHouse connection details:
- Host:
clickhouse-app.klutch.sh - Port:
8000(external port on Klutch.sh) - Database:
coroot - Username: Your ClickHouse username
- Password: Your ClickHouse password
- Host:
- Click “Test Connection” to verify
- Click “Save” to enable persistent storage
Adding Application Instrumentation
For enhanced monitoring with traces and detailed metrics:
# Add Coroot node agent to your Kubernetes cluster (if applicable)apiVersion: v1kind: DaemonSetmetadata: name: coroot-node-agentspec: template: spec: containers: - name: coroot-node-agent image: ghcr.io/coroot/coroot-node-agent:latest env: - name: COROOT_URL value: "https://example-app.klutch.sh"Note: The above configuration is for reference when monitoring external Kubernetes clusters. Adapt based on your infrastructure.
Environment Variables Reference
Complete list of Coroot environment variables you can configure in Klutch.sh:
| Variable | Description | Required | Default |
|---|---|---|---|
DATA_DIR | Directory for Coroot data storage | No | /data |
BOOTSTRAP_CLICKHOUSE_ADDRESS | ClickHouse server address | Yes* | None |
BOOTSTRAP_CLICKHOUSE_USER | ClickHouse username | Yes* | default |
BOOTSTRAP_CLICKHOUSE_PASSWORD | ClickHouse password | Yes* | None |
BOOTSTRAP_CLICKHOUSE_DATABASE | ClickHouse database name | Yes* | coroot |
BOOTSTRAP_PROMETHEUS_URL | Prometheus server URL | Yes | None |
BOOTSTRAP_PROMETHEUS_EXTRA_SELECTOR | Additional Prometheus label filters | No | None |
BOOTSTRAP_REFRESH_INTERVAL | Metrics refresh interval | No | 15s |
DISABLE_CLICKHOUSE | Disable ClickHouse (use in-memory storage) | No | false |
LOG_LEVEL | Logging level (debug, info, warn, error) | No | info |
*Required unless DISABLE_CLICKHOUSE=true
Deploying ClickHouse on Klutch.sh
For production deployments, deploy ClickHouse as a separate application:
ClickHouse Dockerfile
Create a separate repository for ClickHouse with this Dockerfile:
FROM clickhouse/clickhouse-server:latest
# Create data directoryRUN mkdir -p /var/lib/clickhouse
# Expose native protocol portEXPOSE 9000
# Expose HTTP interface port (optional)EXPOSE 8123
# Set default user and databaseENV CLICKHOUSE_DB=corootENV CLICKHOUSE_USER=corootENV CLICKHOUSE_PASSWORD=changeme
# Start ClickHouseCMD ["/entrypoint.sh"]Deploy ClickHouse on Klutch.sh
-
Push your ClickHouse Dockerfile to a GitHub repository
-
Create a new app in Klutch.sh for ClickHouse
-
Configure traffic settings:
- Traffic Type: Select TCP (ClickHouse uses TCP for native protocol)
- Internal Port: Set to
9000(ClickHouse native protocol port)
-
Set environment variables:
CLICKHOUSE_DB:corootCLICKHOUSE_USER:corootCLICKHOUSE_PASSWORD: A strong password
-
Attach a persistent volume:
- Mount Path:
/var/lib/clickhouse - Size: 20GB or more depending on your monitoring scale
- Mount Path:
-
Deploy and note the assigned URL (e.g.,
clickhouse-app.klutch.sh) -
Use
clickhouse-app.klutch.sh:8000as yourBOOTSTRAP_CLICKHOUSE_ADDRESSin Coroot
Important: When using TCP traffic on Klutch.sh, connect to port 8000, which routes to your configured internal port.
Monitoring Your Infrastructure
Setting Up Monitors
Coroot automatically creates monitors for your services. To customize:
- Navigate to Applications in the Coroot dashboard
- Select an application to monitor
- Click “Configure Monitors”
- Enable or disable specific checks (CPU, memory, latency, errors, etc.)
- Set custom thresholds for alerts
- Configure notification channels
Creating Custom Dashboards
- Go to Dashboards → New Dashboard
- Add widgets for metrics you want to track
- Customize visualizations (graphs, tables, heatmaps)
- Save and share with your team
Service Map
View your service dependencies:
- Click on Service Map in the main navigation
- Explore connections between your services
- Click on any service to see detailed metrics
- Identify bottlenecks and performance issues
Production Best Practices
Security Recommendations
- Strong Passwords: Use a password manager to generate strong, random passwords for ClickHouse and any authentication
- Environment Variables: Store all sensitive credentials as environment variables in Klutch.sh, never in your Dockerfile
- HTTPS Only: Klutch.sh provides HTTPS by default; ensure you access Coroot only via HTTPS
- Regular Backups: Implement a backup strategy for your ClickHouse data using volume snapshots
- Update Regularly: Keep Coroot and ClickHouse updated to the latest versions for security patches
- Network Security: Use private networking between Coroot and ClickHouse when possible
- Access Control: Implement authentication and role-based access control for the Coroot dashboard
Performance Optimization
- ClickHouse Tuning: Configure ClickHouse memory and CPU limits based on your data volume
- Data Retention: Configure retention policies in ClickHouse to manage storage costs
- Query Optimization: Use Coroot’s built-in query optimization features
- Resource Allocation: Monitor Coroot’s resource usage and scale accordingly
- Caching: Coroot includes intelligent caching; ensure it’s properly configured
Monitoring and Maintenance
Monitor your Coroot deployment for:
- Response Times: Ensure the dashboard loads quickly
- ClickHouse Performance: Watch query execution times and storage usage
- Memory Usage: Monitor memory consumption for both Coroot and ClickHouse
- Data Ingestion: Track metrics ingestion rate and any gaps
- Alert Delivery: Verify alerts are being delivered promptly
Data Management
- Regular Backups: Create regular backups of your ClickHouse volume
- Data Retention: Configure automatic data cleanup in ClickHouse
- Monitoring Coverage: Regularly audit which services are being monitored
- Dashboard Maintenance: Keep dashboards up-to-date as your infrastructure evolves
Integrating with External Services
Prometheus Configuration
To send metrics from Prometheus to Coroot:
# Add to your prometheus.ymlremote_write: - url: https://example-app.klutch.sh/api/v1/write basic_auth: username: your-username password: your-passwordAlerting Integration
Configure alert destinations in Coroot:
- Go to Settings → Notifications
- Add notification channels:
- Slack: Webhook URL for Slack notifications
- Email: SMTP configuration for email alerts
- PagerDuty: Integration key for incident management
- Webhook: Custom webhook for other services
Grafana Integration
Export Coroot data to Grafana:
- In Coroot, go to Settings → Integrations
- Enable Grafana data source
- Copy the data source URL
- In Grafana, add a new Prometheus data source
- Use the Coroot URL as the data source endpoint
Troubleshooting
Cannot Access Coroot Dashboard
- Verify your app is running in the Klutch.sh dashboard
- Check that the internal port is set to 8080
- Ensure HTTP traffic type is selected
- Review application logs for startup errors
- Verify network connectivity to ClickHouse and Prometheus
ClickHouse Connection Errors
- Verify ClickHouse is deployed and running
- Check the
BOOTSTRAP_CLICKHOUSE_ADDRESSformat (should include port 8000) - Ensure credentials are correct
- Test connectivity using ClickHouse client tools
- Verify the persistent volume is attached at
/var/lib/clickhouse
No Metrics Showing
- Verify Prometheus URL is correct and accessible
- Check that Prometheus is exposing metrics
- Review Coroot logs for metric ingestion errors
- Ensure there’s no firewall blocking connections
- Verify Prometheus remote_write configuration if applicable
Data Not Persisting
- Confirm the persistent volume is attached at
/data/coroot - Check the volume has sufficient space
- Verify ClickHouse volume is properly mounted
- Review file permissions on mounted volumes
Performance Issues
- Monitor CPU and memory usage in Klutch.sh dashboard
- Consider increasing compute resources
- Check ClickHouse query performance
- Review data retention policies
- Optimize metric cardinality in Prometheus
High Memory Usage
- Check the number of time series being monitored
- Review ClickHouse memory configuration
- Implement data retention policies
- Consider scaling ClickHouse resources
- Optimize Prometheus metric labels
Upgrading Coroot
To upgrade Coroot to a new version:
-
Update the image version in your Dockerfile:
FROM ghcr.io/coroot/coroot:v1.5.0 -
Commit and push the changes to GitHub:
Terminal window git add Dockerfilegit commit -m "Upgrade Coroot to version 1.5.0"git push -
Klutch.sh will automatically rebuild and redeploy your application
-
Your data and configuration will be preserved because they’re stored in persistent volumes
-
Review the Coroot changelog for any breaking changes or new features
Advanced Configuration
High Availability Setup
For production environments requiring high availability:
- Deploy multiple ClickHouse replicas with replication
- Use a load balancer for ClickHouse connections
- Configure Coroot with multiple Prometheus sources
- Implement automated backups and disaster recovery procedures
Multi-Tenant Configuration
To monitor multiple environments:
- Deploy separate Coroot instances for each environment
- Use Prometheus federation to aggregate metrics
- Configure different retention policies per environment
- Implement role-based access control
Custom Metrics and Checks
Add custom application metrics:
# Example Prometheus metricmy_app_requests_total{status="200"} 1000my_app_latency_seconds{quantile="0.99"} 0.5Coroot will automatically detect and visualize these metrics.
Cost Optimization
Reducing Storage Costs
- Configure aggressive data retention policies in ClickHouse
- Use ClickHouse compression settings
- Archive old data to object storage
- Monitor and optimize metric cardinality
Compute Optimization
- Right-size your Coroot and ClickHouse instances
- Use auto-scaling where appropriate
- Schedule intensive queries during off-peak hours
- Implement query result caching
Additional Resources
- Klutch.sh Documentation
- Coroot GitHub Repository
- Official Coroot Documentation
- Klutch.sh Volumes Guide
- Klutch.sh Networking Guide
- ClickHouse Documentation
- Prometheus Documentation
Conclusion
Deploying Coroot to Klutch.sh with Docker provides a powerful, self-hosted observability solution with persistent storage and seamless integration with your existing monitoring infrastructure. By following this guide, you’ve set up a production-ready Coroot instance with proper data persistence, ClickHouse backend, and comprehensive monitoring capabilities. Your observability platform is now ready to provide deep insights into your applications and infrastructure, enabling you to quickly identify and resolve issues while optimizing performance and costs.