This project provides a simple uptime monitoring service that checks the availability of websites and sends notifications through Discord webhooks when a site goes down or recovers. The system allows adding/removing websites to monitor, configuring a check interval, and tracks uptime/downtime history. A Discord notification is sent whenever a site's status changes.
Warning: The live server may go down occasionally for experimental purposes and some APIs may not be fully implemented. For a reliable service, please consider self-hosting using the instructions below.
GET /monitor/sites/ - List all monitored sites
POST /monitor/sites/ - Add a new site to monitor
GET /monitor/sites/{id}/ - Get site details
PUT /monitor/sites/{id}/ - Update site details
DELETE /monitor/sites/{id}/ - Remove site from monitoring
GET /monitor/sites/{id}/history/ - Get status history for a site
GET /monitor/webhooks/ - List all Discord webhooks
POST /monitor/webhooks/ - Add a new webhook
GET /monitor/webhooks/{id}/ - Get webhook details
PUT /monitor/webhooks/{id}/ - Update webhook
DELETE /monitor/webhooks/{id}/ - Delete webhook
POST /auth/token/ - Obtain JWT token
POST /auth/token/refresh/ - Refresh JWT token
POST /auth/users/ - Register new user
GET /auth/users/me/ - Get current user details
GET /user/me/ - Get user profile
PUT /user/me/ - Update user profile
- Django: Web framework for backend development.
- Celery: Asynchronous task queue for background monitoring of websites.
- Redis: Used as a message broker for Celery tasks.
- PostgreSQL: Database for storing monitored sites and status history.
- Docker & Docker Compose: Containerization for easy deployment and environment setup.
- requests: For making HTTP requests to monitor site statuses and interact with Discord webhooks.
- pytest: For unit testing and mock testing the core logic and Discord notifications.
- Add/remove websites to monitor via API.
- Track uptime and downtime status of websites.
- Send notifications via Discord webhook when a site goes down or recovers.
- Track and store status history (up/down) and response times.
- Configurable website check intervals (default: 5 minutes).
- Sends a welcome message to Discord when a new webhook is configured.
- Simple API for managing monitored sites and webhooks.
Ensure the following are installed on your local machine:
- Docker
- Docker Compose
- Python 3.10+
- PostgreSQL (can be handled by Docker)
To quickly set up and run the application with Docker, follow these steps:
-
Clone this repository:
git clone https://github.com/amal-babu-git/uptime-monitor.git cd uptime-monitor
-
Copy the
.env.sample
file to.env
and adjust the environment variables as needed:cp .env.sample .env
-
Build and run the application:
docker-compose build docker-compose up
- You can now access the application at http://localhost:8000.
- admin: http://localhost:8000/admin
- API endpoints: http://localhost:8000/monitor
To deploy this application on a VPS (e.g., DigitalOcean Droplets or AWS EC2), follow these steps:
-
Create a VPS:
- Set up a virtual machine on DigitalOcean, AWS EC2, or any other cloud provider.
-
Install Dependencies:
- SSH into your VPS and install Docker, Docker Compose, and Git:
sudo apt update sudo apt install docker.io docker-compose git -y
- SSH into your VPS and install Docker, Docker Compose, and Git:
-
Clone the Repository:
- Clone the repository to your VPS:
git clone https://github.com/amal-babu-git/uptime-monitor.git cd uptime-monitor setup .env cp .env.sample .env
- Clone the repository to your VPS:
-
Setup SSL with Certbot:
- Run the following command to set up SSL using Certbot:
docker-compose -f docker-compose-deploy.yml run --rm certbot /opt/certify-init.sh
- Run the following command to set up SSL using Certbot:
-
Start the Application:
- Build and start the application using Docker Compose:
docker-compose -f docker-compose-deploy.yml up -d
- Build and start the application using Docker Compose:
-
Verify the Deployment:
- Ensure the application is running correctly by accessing it via the configured domain or IP address.
-
Stop the Application:
- If needed, you can stop the application with:
docker-compose -f docker-compose-deploy.yml down
- If needed, you can stop the application with:
-
Create Superuser:
- To create a superuser, run the following command:
docker-compose -f docker-compose-deploy.yml run --rm app sh -c "python manage.py createsuperuser"
- To create a superuser, run the following command:
By following these steps, you can deploy the uptime monitor with SSL on a VPS using Docker Compose.