Backup Monitor is a Django-based web application designed to help administrators monitor backup files for databases and website content. The application scans specified directories for backup files and displays their presence on a calendar view. Authorized users can log in to view the calendar, which updates every 5 minutes to reflect the latest backup status.
The primary goals of the Backup Monitor project are:
- Automate Backup Monitoring: Provide a visual representation of backup files' presence for databases and website content.
- User Authentication: Ensure that only authorized users can access the backup status.
- Real-Time Updates: Automatically update the backup status every 5 minutes to reflect any changes.
- Ease of Use: Offer a straightforward interface for users to quickly assess backup completeness.
- Extensibility: Design the application to be easily extendable for future enhancements.
- Calendar View: Displays a monthly calendar highlighting days with available backups.
- Database Backups: Indicated by a blue 'd' on the date cell.
- Website Backups: Indicated by a green 'w' on the date cell.
- Automatic Refresh: The calendar view refreshes every 5 minutes to show the latest backup status.
- User Authentication: Only authorized users can log in and view the backup calendar.
- Responsive Design: The interface adjusts to different screen sizes for better usability.
- Navigation: Users can navigate between months to view past and upcoming backup statuses.
- Python: 3.6 or higher
- Django: 3.2 or higher
- Operating System: Cross-platform (Tested on Unix/Linux and Windows)
- Dependencies:
pathlib
(Standard in Python 3.4+)- Other dependencies as listed in
requirements.txt
git clone https://github.com/yourusername/backup-monitor.git
cd backup-monitor
It's recommended to use a virtual environment to manage dependencies.
python3 -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
pip install -r requirements.txt
-
Database Configuration: By default, the project uses SQLite. Adjust
DATABASES
inbackup_monitor/settings.py
if necessary. -
Backup Directories:
In
backup_monitor/settings.py
, set the paths to your backup directories:from pathlib import Path BASE_DIR = Path(__file__).resolve().parent.parent # Define backup directories DB_BACKUP_DIR = Path('/absolute/path/to/db_backups') # Replace with your actual path WWW_BACKUP_DIR = Path('/absolute/path/to/www_backups') # Replace with your actual path
Ensure that the authentication URLs are included in backup_monitor/urls.py
:
from django.contrib import admin
from django.urls import path, include
from monitor import views as monitor_views
urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls')), # For login/logout
path('', monitor_views.calendar_view, name='calendar'),
path('<int:year>/<int:month>/', monitor_views.calendar_view, name='calendar'),
]
python manage.py migrate
python manage.py createsuperuser
Follow the prompts to create an admin user.
python manage.py runserver
- Open your web browser and navigate to
http://localhost:8000/
. - Log in using the superuser credentials you created.
- Upon logging in, you'll be presented with a calendar view of the current month.
- Dates with backups are marked:
- 'd': Database backup available (colored blue).
- 'w': Website files backup available (colored green).
- Dates from previous or next months are displayed in a lighter color.
- The current date is highlighted.
- Use the Prev and Next links at the top of the calendar to navigate between months.
- The calendar automatically refreshes every 5 minutes to display the latest backup status.
Planned features and enhancements for future releases include:
- Email Notifications: Send alerts to administrators if backups are missing for a certain period.
- Backup Integrity Check: Verify the integrity of backup files and display warnings for corrupted files.
- Multiple Site Support: Extend the application to monitor backups for multiple websites and databases.
- Role-Based Access Control: Implement different user roles (e.g., admin, viewer) with varying permissions.
- Enhanced UI/UX: Improve the visual design and user experience of the calendar view.
- Customizable Backup Patterns: Allow configuration of backup filename patterns to accommodate different naming conventions.
- Dashboard View: Provide a summary dashboard with statistics and trends on backup statuses.
- API Integration: Offer RESTful APIs for integrating with other systems or automation tools.
- Dockerization: Provide a Docker image for easy deployment.
Contributions are welcome! To contribute to Backup Monitor, please follow these steps:
-
Fork the Repository: Click the 'Fork' button at the top right of the repository page.
-
Clone Your Fork:
git clone https://github.com/yourusername/backup-monitor.git
-
Create a Feature Branch:
git checkout -b feature/your-feature-name
-
Make Your Changes: Implement your feature or bug fix.
-
Commit Your Changes:
git commit -am 'Add new feature'
-
Push to Your Fork:
git push origin feature/your-feature-name
-
Submit a Pull Request: Open a pull request to the main repository's
develop
branch.
This project is licensed under the MIT License. You are free to use, modify, and distribute this software in accordance with the terms of the license.
For questions or support, please open an issue on the repository or contact the maintainer (check my GitHub or Linkedin: https://www.linkedin.com/in/konstantin-parashchevin/).