Monitoring
Monitoring your self-hosted LearnHouse instance lets you catch issues before they affect your users.
Service Health Checks
The CLI offers three complementary commands:
npx learnhouse status # URL and container status for each service
npx learnhouse health # containers, PostgreSQL, Redis, HTTP health endpoint, disk, resources
npx learnhouse doctor # deeper diagnostics (Docker, restarts, ports, DNS, disk, log errors, .env)health and doctor exit with code 1 when a check fails, so you can run them from a scheduled job and alert on the exit code.
Health Endpoint
The API exposes a health endpoint you can point an uptime monitor at:
curl http://localhost/api/v1/health| Response | Meaning |
|---|---|
200 with body true | The API is up and can query the database |
503 with {"detail": "Database is not healthy"} | The API is up but the database check failed |
No response or 502 | The API or the reverse proxy is down |
The endpoint needs no authentication. It rejects API tokens, so call it without one. The generated docker-compose.yml uses the same endpoint for the app container's Docker health check (every 30 seconds after a 60-second start period).
The endpoint GET /api/v1/instance/info is also public and returns the instance's configuration (edition mode, tenancy, default organization slug, frontend and top domains), which is useful to check that the API answers with the settings you expect.
Error Tracking
Set LEARNHOUSE_SENTRY_DSN (API) and NEXT_PUBLIC_LEARNHOUSE_SENTRY_DSN (web app) to send errors to your own Sentry project. LEARNHOUSE_ENV and NEXT_PUBLIC_LEARNHOUSE_ENV set the environment label.
When Sentry is configured, the in-app feedback form sends user feedback to Sentry through POST /api/v1/monitoring/feedback. Without Sentry, the endpoint accepts the feedback and discards it.
Viewing Logs
Stream logs from all containers:
npx learnhouse logsThe app container runs the web app, the API and the collaboration server under one process manager, so their logs are interleaved in the learnhouse-app output. Set LEARNHOUSE_LOG_LEVEL (for example DEBUG or WARNING) to change how much the API logs. The default is INFO.
What to Monitor
Application Health
- Run
npx learnhouse doctorregularly to verify all services are running and healthy - Watch for container restarts, which may indicate memory issues or application errors.
doctorwarns when a container has restarted more than 3 times.
Disk Usage
- Monitor disk space, especially if you use filesystem storage for uploaded content
- Database size grows over time as more content is created
- Backups in
<installDir>/backups/, Docker images and logs also consume disk space doctorwarns when less than 1 GB is free
Memory Usage
- LearnHouse needs at least 2 GB of RAM
- Make sure the server is not swapping, which degrades performance
- Use
npx learnhouse scaleto cap the memory of each container
Database Performance
- Watch for slow queries in the application logs
- Monitor PostgreSQL connection counts
Monitoring Recommendations
For production deployments, consider setting up:
- Uptime monitoring: an external service that checks
https://your-domain/api/v1/health - Disk space alerts: get notified before disk space runs out
- Log aggregation: ship logs to a centralized logging system for easier analysis
- Container monitoring: tools like
docker stats, cAdvisor, or Prometheus with node-exporter can track resource usage over time