Lithosphere Infrastructure Configuration
This directory contains all infrastructure-related configuration files for the Lithosphere Makalu deployment.
Directory Structure
infra/
├── alertmanager/ # Alertmanager configuration
│ └── alertmanager-config.yaml
│
├── grafana/ # Grafana provisioning & dashboards
│ ├── provisioning/
│ │ ├── datasources/
│ │ │ └── datasources.yaml
│ │ └── dashboards/
│ │ └── dashboards.yaml
│ └── dashboards/
│ ├── system-overview.json
│ ├── api-monitoring.json
│ └── container-metrics.json
│
├── k8s/ # Kubernetes manifests (future)
│ └── base/
│ └── kustomization.yaml
│
├── loki/ # Loki log aggregation
│ └── loki-config.yaml
│
├── postgres/ # PostgreSQL initialization
│ └── init.sql
│
├── prometheus/ # Prometheus metrics & alerts
│ ├── prometheus.yml
│ └── alerts/
│ └── lithosphere-alerts.yml
│
└── promtail/ # Promtail log collection
└── promtail-config.yamlConfiguration Files
Alertmanager
File: alertmanager/alertmanager-config.yaml
Handles alert routing and notifications. Currently configured with console output.
To enable Slack notifications:
Create a Slack webhook URL
Uncomment the
slack_configssectionAdd your webhook URL
Restart Alertmanager
To enable email notifications:
Configure SMTP settings in the
globalsectionUncomment email receivers
Restart Alertmanager
Grafana
Provisioning: grafana/provisioning/
Automatically configures datasources (Prometheus, Loki)
Loads dashboards from
grafana/dashboards/
Pre-configured Dashboards:
System Overview - VPS health (CPU, RAM, Disk, Network)
API Monitoring - Request rates, latencies, errors, logs
Container Metrics - Docker container resource usage
Custom Dashboards:
Create JSON files in
grafana/dashboards/They will be auto-loaded on Grafana restart
Loki
File: loki/loki-config.yaml
Log aggregation and storage configuration.
Key Settings:
Retention: 30 days (720 hours)
Max ingestion rate: 4 MB/s
Storage: Filesystem (
/loki)
To adjust retention:
Prometheus
File: prometheus/prometheus.yml
Metrics collection and scrape configuration.
Monitored Targets:
Lithosphere API (port 9090)
Lithosphere Indexer (port 9090)
Node Exporter (port 9100) - VPS metrics
cAdvisor (port 8080) - Container metrics
Docker containers with
prometheus.scrape=truelabel
Alert Rules: prometheus/alerts/lithosphere-alerts.yml
Defines alert conditions for:
Service health (API down, Indexer down, DB down)
Performance issues (high latency, error rates)
Resource usage (CPU, memory, disk)
Container issues (restarts, high resource usage)
To add custom alerts:
Edit
lithosphere-alerts.ymlFollow Prometheus alert syntax
Reload Prometheus:
curl -X POST http://localhost:9091/-/reload
Promtail
File: promtail/promtail-config.yaml
Log collection agent that ships logs to Loki.
Log Sources:
Docker container logs (
/var/lib/docker/containers)System logs (
/var/log/syslog)Auto-discovered containers with monitoring labels
Pipeline:
Collects logs from sources
Parses JSON logs
Extracts labels (service, environment, level)
Ships to Loki
PostgreSQL
File: postgres/init.sql
Database initialization script.
Creates:
Required extensions (uuid-ossp, pg_trgm)
transferstable for LEP-100 eventsblockstable for block metadataIndexes for query optimization
Kubernetes (Future)
Directory: k8s/
Placeholder for Kubernetes manifests when deploying to K8s clusters.
Environment Variables
Many configurations can be overridden with environment variables:
Set these in .env file or export them before running Docker Compose.
Maintenance
Updating Configurations
After modifying any config file:
Backup Configurations
Volume Management
Monitoring data is stored in Docker volumes:
Security Considerations
1. Network Exposure
By default, monitoring services are exposed on all interfaces. In production:
Option A: Use firewall rules
Option B: Bind to localhost only
2. Grafana Authentication
Change default password immediately:
3. Alertmanager Secrets
Never commit credentials to version control:
Troubleshooting
Issue: Configuration not loading
Issue: Dashboards not appearing in Grafana
Check provisioning path is correct
Verify JSON syntax:
jq . dashboard.jsonCheck Grafana logs:
docker compose logs grafanaRestart Grafana:
docker compose restart grafana
Issue: Alerts not firing
Check alert rule syntax in Prometheus UI
Verify Alertmanager is configured in
prometheus.ymlTest alert:
curl http://localhost:9091/api/v1/rulesCheck Alertmanager:
curl http://localhost:9093/api/v2/alerts
Performance Tuning
Reduce Disk Usage
Reduce Memory Usage
Optimize Scrape Intervals
Additional Resources
Last updated