Build a comprehensive website monitoring application with ReasonML, OCaml, and server-reason-react.
Features:
- Real-time website monitoring with HTTP status checks
- Email and webhook alerting system
- Beautiful admin dashboard with Tailwind CSS
- Complete REST API for CRUD operations
- Background monitoring scheduler
- Multi-container Docker setup with 1-core CPU constraint
- PostgreSQL database with Caqti
- Full documentation and setup guides
Tech Stack:
- OCaml 5.0+ with ReasonML
- Dream web framework
- server-reason-react for UI
- PostgreSQL 16 database
- Docker & Docker Compose
Files:
- 9 OCaml source files (1961 LOC)
- 6 documentation files (1603 LOC)
- Complete Docker configuration
- Comprehensive API documentation
💘 Generated with Crush
3.4 KiB
3.4 KiB
Quick Start Guide
Get Website Monitor up and running in 5 minutes!
Prerequisites
- Docker 20.10+
- Docker Compose 2.0+
That's it!
Installation
1. Clone and Setup
# Clone the repository
git clone <repository-url>
cd test3
# Run setup verification
./scripts/verify-setup.sh
2. Configure Email Alerts (Optional)
Edit .env file:
# Email settings (required for email alerts)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
ADMIN_EMAIL=you@example.com
# Security (change this!)
SECRET_KEY=generate-a-long-random-string-here
For Gmail users: Generate an app password at https://myaccount.google.com/apppasswords
3. Start the Application
docker-compose up -d
This will:
- Start PostgreSQL database
- Start Redis cache
- Build and start the application
- Initialize the database schema
4. Access the Dashboard
Open your browser and go to: http://localhost:8080
First Steps
Add Your First Website
- Click "Add Website" on the dashboard
- Fill in the details:
- Name: My Website
- URL: https://example.com
- Expected Status: 200
- Timeout: 30 (seconds)
- Check Interval: 300 (5 minutes)
- Click Save
Create an Alert
- Go to Alerts page
- Click "Add Alert"
- Configure:
- Website ID: (select your website)
- Alert Type: email
- To Email: your-email@example.com
- Click Save
Monitor Status
- Check the Dashboard for real-time status
- View detailed history on the Websites page
- Manage alerts on the Alerts page
Common Commands
# View logs
docker-compose logs -f
# Stop the application
docker-compose down
# Restart the application
docker-compose restart
# Check status
docker-compose ps
# Open shell in app container
docker-compose exec app sh
Troubleshooting
Port Already in Use
If port 8080 is already used:
# Change port in docker-compose.yml
ports:
- "8081:8080" # Use 8081 instead
Database Connection Issues
# Check database logs
docker-compose logs postgres
# Restart database
docker-compose restart postgres
Email Not Working
- Verify SMTP credentials in
.env - Check SMTP settings:
- Gmail: Use app password, not your main password
- Outlook: smtp.office365.com, port 587
- Custom: Check with your email provider
High CPU Usage
The application is limited to 1 CPU core. If you still see high usage:
- Increase
check_intervalfor websites (default: 300s) - Reduce number of active websites
- Check logs:
docker-compose logs app
API Usage
After starting the application, use the REST API:
# List all websites
curl http://localhost:8080/api/websites
# Add a website
curl -X POST http://localhost:8080/api/websites \
-H "Content-Type: application/json" \
-d '{
"name": "Example",
"url": "https://example.com",
"expected_status": 200
}'
# Get stats
curl http://localhost:8080/api/stats/summary
Next Steps
- Read the full README.md for detailed documentation
- Check CONTRIBUTING.md if you want to contribute
- Explore the API documentation for advanced usage
Support
For issues or questions:
- Check the README.md troubleshooting section
- Open an issue on GitHub
- Join our discussions
Congratulations! 🎉 Your Website Monitor is now running!