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
182 lines
3.4 KiB
Markdown
182 lines
3.4 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
# Clone the repository
|
|
git clone <repository-url>
|
|
cd test3
|
|
|
|
# Run setup verification
|
|
./scripts/verify-setup.sh
|
|
```
|
|
|
|
### 2. Configure Email Alerts (Optional)
|
|
|
|
Edit `.env` file:
|
|
|
|
```bash
|
|
# 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
|
|
|
|
```bash
|
|
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
|
|
|
|
1. Click **"Add Website"** on the dashboard
|
|
2. Fill in the details:
|
|
- Name: My Website
|
|
- URL: https://example.com
|
|
- Expected Status: 200
|
|
- Timeout: 30 (seconds)
|
|
- Check Interval: 300 (5 minutes)
|
|
3. Click **Save**
|
|
|
|
### Create an Alert
|
|
|
|
1. Go to **Alerts** page
|
|
2. Click **"Add Alert"**
|
|
3. Configure:
|
|
- Website ID: (select your website)
|
|
- Alert Type: email
|
|
- To Email: your-email@example.com
|
|
4. 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
|
|
|
|
```bash
|
|
# 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:
|
|
|
|
```bash
|
|
# Change port in docker-compose.yml
|
|
ports:
|
|
- "8081:8080" # Use 8081 instead
|
|
```
|
|
|
|
### Database Connection Issues
|
|
|
|
```bash
|
|
# Check database logs
|
|
docker-compose logs postgres
|
|
|
|
# Restart database
|
|
docker-compose restart postgres
|
|
```
|
|
|
|
### Email Not Working
|
|
|
|
1. Verify SMTP credentials in `.env`
|
|
2. 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:
|
|
|
|
1. Increase `check_interval` for websites (default: 300s)
|
|
2. Reduce number of active websites
|
|
3. Check logs: `docker-compose logs app`
|
|
|
|
## API Usage
|
|
|
|
After starting the application, use the REST API:
|
|
|
|
```bash
|
|
# 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](README.md) for detailed documentation
|
|
- Check [CONTRIBUTING.md](CONTRIBUTING.md) if you want to contribute
|
|
- Explore the API documentation for advanced usage
|
|
|
|
## Support
|
|
|
|
For issues or questions:
|
|
1. Check the [README.md](README.md) troubleshooting section
|
|
2. Open an issue on GitHub
|
|
3. Join our discussions
|
|
|
|
---
|
|
|
|
**Congratulations!** 🎉 Your Website Monitor is now running!
|