Skip to content

anldrms/observability-demo

Repository files navigation

Observability Demo Platform

🌐 Live Demo: https://anldrms.github.io/observability-demo/

A production-ready observability stack with Prometheus, Grafana, and Graylog.

✨ New: GitHub Pages Deployment

The frontend is now available as a static site on GitHub Pages! No backend required to try the UI.

Quick Start

  1. Visit the live site: https://anldrms.github.io/observability-demo/
  2. Deploy your backend to any cloud platform (see below)
  3. Configure by entering your backend URL
  4. Start monitoring!

πŸš€ Two-Part Architecture

Frontend (GitHub Pages - Free!)

Backend (Your Cloud Platform)

  • Node.js Express API
  • Prometheus metrics
  • Graylog logging
  • Deploy to: Fly.io, Railway, Render, etc.

πŸ“¦ Quick Deploy

Option 1: Frontend Only (Try the UI)

Just visit: https://anldrms.github.io/observability-demo/

The UI works standalone and can be configured to connect to any backend.

Option 2: Full Stack (Frontend + Backend)

Deploy Backend:

# Clone the repo
git clone git@github.com:anldrms/observability-demo.git
cd observability-demo

# Deploy to Fly.io (easiest)
./deploy-cloud.sh flyio

# Or Railway
./deploy-cloud.sh railway

# Or run locally
./deploy-cloud.sh local

Configure Frontend:

  1. Go to https://anldrms.github.io/observability-demo/
  2. Enter your backend URL (e.g., https://your-app.fly.dev)
  3. Click "Save Configuration"
  4. Start generating traffic!

Option 3: Full Local Development

git clone git@github.com:anldrms/observability-demo.git
cd observability-demo
docker compose up -d --build

Access at:

🎯 Features

βœ… Frontend (GitHub Pages)

  • Beautiful, responsive UI
  • Traffic simulation controls
  • Real-time status monitoring
  • Dynamic configuration
  • LocalStorage for settings

βœ… Backend (Cloud/Local)

  • Express.js API server
  • Prometheus metrics endpoint
  • GELF logging to Graylog
  • Health checks
  • CORS enabled for GitHub Pages

βœ… Monitoring Stack

  • Prometheus (metrics collection)
  • Grafana (dashboards)
  • Graylog (log aggregation)
  • OpenSearch (log storage)
  • MongoDB (Graylog metadata)

πŸ“š Documentation

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   GitHub Pages       β”‚  ← Free static hosting
β”‚   (Frontend UI)      β”‚     https://anldrms.github.io/...
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚ CORS-enabled API calls
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Cloud Platform     β”‚  ← Deploy to Fly.io, Railway, etc.
β”‚   (Express API)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β–Ό             β–Ό          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Prometheuβ”‚  β”‚ Grafana β”‚  β”‚ Graylog β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ API Endpoints

Endpoint Method Description
/ GET Web UI (served from backend)
/config GET Get monitoring URLs configuration
/health GET Health check with uptime
/metrics GET Prometheus metrics
/work GET Single simulated work operation
/simulate GET Generate N operations (?count=100)

🌐 Environment Variables

Backend Configuration

# Application
NODE_ENV=production
PORT=3000

# Logging
GELF_HOST=graylog
GELF_PORT=12201

# Public URLs (for frontend)
PUBLIC_GRAFANA_URL=https://grafana.yourapp.com
PUBLIC_PROMETHEUS_URL=https://prometheus.yourapp.com
PUBLIC_GRAYLOG_URL=https://graylog.yourapp.com

See .env.example for complete list.

πŸ”’ Security

CORS Configuration

By default, CORS is enabled for all origins to work with GitHub Pages. For production:

// Restrict to your domain only
res.header('Access-Control-Allow-Origin', 'https://anldrms.github.io');

API Authentication

Add API key authentication for production:

# Set environment variable
API_KEY=your-secret-key

# In frontend, add header
fetch(url, {
  headers: { 'X-API-Key': 'your-secret-key' }
});

πŸ“Š Metrics

The demo app exposes these Prometheus metrics:

  • demo_http_requests_total - HTTP request counter (by route, method, status)
  • demo_work_duration_seconds - Work duration histogram
  • demo_errors_total - Error counter (by type)
  • process_* - Standard Node.js process metrics
  • nodejs_* - Node.js runtime metrics

πŸ“ Logs

Logs are sent via GELF UDP to Graylog:

  • Application startup/shutdown
  • Request logs with duration
  • Error logs with details
  • Simulated work operations

πŸ› οΈ Development

Frontend Development

cd docs
python3 -m http.server 8000
# Open http://localhost:8000

Backend Development

cd app
npm install
npm start
# API at http://localhost:3000

Full Stack Development

docker compose up -d
# All services available

πŸ› Troubleshooting

Frontend Can't Connect to Backend

  1. Check CORS is enabled on backend
  2. Verify backend URL is correct
  3. Ensure backend is running: curl https://your-backend/health
  4. Check browser console for errors

GitHub Pages Not Updating

  1. Check Settings β†’ Pages is enabled
  2. Verify source is set to main branch, /docs folder
  3. Check Actions tab for build status
  4. Clear browser cache

Backend Deployment Issues

See DEPLOYMENT.md for platform-specific troubleshooting.

πŸ“„ License

MIT

🀝 Contributing

Pull requests welcome! Please:

  • Follow existing code style
  • Test your changes locally
  • Update documentation

πŸ”— Links

⭐ Star This Repo

If you find this useful, please star the repo!


Built with ❀️ using Node.js, Express, Prometheus, Grafana, and Graylog

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors