Skip to content

Automated MikroTik Router Backup Tool with Web Interface - Streamline your network management with automated backups, scheduling, and a beautiful web-based dashboard for MikroTik routers

License

Notifications You must be signed in to change notification settings

rezaworks/MikroTik-Auto-Backup-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ MikroTik Auto Backup Tool

Version Python Flask License: MIT PRs Welcome Platform

๐Ÿš€ Professional MikroTik Router Backup Management System

A powerful, web-based backup management application designed for ISP and office environments. Built with modern web technologies to provide comprehensive router backup automation, scheduling, and monitoring capabilities.


๐Ÿ“‹ Table of Contents


โœจ Features

๐Ÿ”ง Core Functionality

  • ๐Ÿ“ Multiple Router Management: Add, configure, and manage multiple MikroTik routers
  • โšก One-Click Backup: Trigger backups instantly and download files automatically
  • ๐Ÿ”„ Connection Testing: Test router connectivity before adding to system
  • ๐Ÿ“Š Real-time Monitoring: Live status indicators for all managed routers
  • ๐Ÿ“ฑ Responsive Interface: Optimized for desktop, tablet, and mobile devices

๐Ÿ”„ Backup Management

  • ๐Ÿ’พ Automated Backups: Schedule automatic backups with flexible timing
  • ๐Ÿ“‹ Backup Types: Support for full system and configuration-only backups
  • ๐Ÿ—‚๏ธ File Organization: Automatic file naming and organized storage
  • ๐Ÿ“ฅ Download Management: Easy access to all backup files
  • ๐Ÿงน Cleanup Automation: Automatic removal of old backup files

๐ŸŽจ User Experience

  • ๐Ÿ’ซ Modern UI/UX: Clean, professional design with intuitive navigation
  • ๐ŸŒ“ Dark/Light Theme: Adaptive theming for comfortable viewing
  • ๐Ÿ“Š Interactive Dashboard: Real-time statistics and system overview
  • ๐ŸŽฏ Drag & Drop: Seamless router configuration experience
  • โณ Progress Indicators: Real-time feedback during backup operations

๐Ÿ›ก๏ธ Security & Performance

  • ๐Ÿ”’ Secure Connections: SSL/TLS support for router communications
  • ๐Ÿ› ๏ธ Error Handling: Comprehensive error reporting and recovery
  • โšก Performance Optimized: Efficient processing for multiple routers
  • ๐Ÿ” Credential Management: Secure storage of router credentials
  • ๐ŸŒ Cross-Platform: Compatible with Windows, macOS, and Linux

๐Ÿš€ Quick Start

๐Ÿ“‹ Prerequisites

  • Python 3.8+ ๐Ÿ
  • Modern web browser ๐ŸŒ
  • MikroTik RouterOS 6.0+ ๐Ÿ“ก
  • 100MB+ free disk space ๐Ÿ’พ

โšก Installation & Setup

๐Ÿš€ Option 1: Quick Start (Recommended)

# Clone the repository
git clone https://github.com/rezaworks/mikrotik-backup-tool.git
cd mikrotik-backup-tool

# Create virtual environment
python -m venv mikrotik_backup_venv
source mikrotik_backup_venv/bin/activate  # Windows: mikrotik_backup_venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Launch application
python backend/app.py

# Open browser and navigate to:
# http://localhost:5000

๐Ÿณ Option 2: Docker (Alternative)

# Build Docker image
docker build -t mikrotik-backup-tool .

# Run container
docker run -p 5000:5000 mikrotik-backup-tool

# Access at: http://localhost:5000

๐Ÿ“ฆ Option 3: Production Deployment

# Using Gunicorn (Recommended for production)
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 backend.app:app

# Access at: http://your-server:5000

๐Ÿ“– Usage Guide

โž• Adding Routers

  1. ๐Ÿ”ง Access Router Management: Click "Add Router" from the main dashboard
  2. ๐Ÿ“ Enter Router Details: Provide name, IP address, credentials
  3. ๐Ÿ”Œ Test Connection: Verify router connectivity and API access
  4. ๐Ÿ’พ Save Configuration: Store router for future backup operations

๐Ÿ“ฆ Creating Backups

  1. ๐ŸŽฏ Select Target Router: Choose from configured routers list
  2. โš™๏ธ Choose Backup Type: Select full system or configuration backup
  3. โ–ถ๏ธ Initiate Backup: Click "Backup Now" to start the process
  4. ๐Ÿ“ฅ Download File: Automatically download the backup file

๐Ÿ“Š Monitoring & Management

  1. ๐Ÿ“ˆ View Dashboard: Monitor all routers status in real-time
  2. ๐Ÿ” Check Logs: Review backup history and system events
  3. โš™๏ธ Manage Schedules: Configure automated backup schedules
  4. ๐Ÿงน Cleanup: Remove old backup files automatically

๐Ÿ“ค File Management

  • ๐Ÿ“‚ Automatic Organization: Backups organized by router and date
  • ๐Ÿ“ฅ Easy Downloads: Direct download links for all backup files
  • ๐Ÿ—‚๏ธ Format Support: Both full (.backup) and config (.rsc) formats
  • ๐Ÿ“‹ Metadata Tracking: File size, creation date, and router information

๐ŸŽฏ Supported Router Types

Router Type Description Features
๐Ÿ“ก MikroTik RouterOS All RouterBOARD devices Full API integration
๐ŸŒ CCR Series Cloud Core Routers High-performance backups
๐Ÿ  hAP Series Home Access Point Wireless configuration backup
๐Ÿข RB Series General purpose routers Complete system backup
๐Ÿ”’ RB1100AHx4 Enterprise routers Advanced configuration management

๐Ÿ”Œ Connection Methods

  • ๐ŸŒ API Connection: Direct RouterOS API communication
  • ๐Ÿ”’ SSL/TLS Support: Secure encrypted connections
  • ๐Ÿ” Authentication: Username/password and key-based auth
  • ๐Ÿ“Š Status Monitoring: Real-time connection health checks

๐Ÿ’ป Technology Stack

Core Technologies

Python Flask HTML5 CSS3 JavaScript

Key Dependencies

  • ๐Ÿ”— Flask: Web framework for Python backend
  • ๐Ÿ—„๏ธ Flask-SQLAlchemy: Database ORM for router management
  • ๐Ÿ”Œ librouteros: MikroTik RouterOS API communication
  • ๐Ÿ”’ paramiko: SSH/SFTP for secure file transfers
  • โฐ schedule: Background job scheduling
  • ๐ŸŒ flask-cors: Cross-origin resource sharing

Development Tools

VS Code Git Virtual Env


๐Ÿ“ Project Structure

mikrotik-backup-tool/
โ”œโ”€โ”€ ๐Ÿ“„ backend/                  # ๐Ÿ”ง Backend Python application
โ”‚   โ”œโ”€โ”€ app.py                   # ๐Ÿš€ Main Flask application
โ”‚   โ”œโ”€โ”€ models.py                # ๐Ÿ’พ Database models and schemas
โ”‚   โ”œโ”€โ”€ utils/                   # ๐Ÿ”ง Utility modules
โ”‚   โ”‚   โ”œโ”€โ”€ mikrotik.py          # ๐Ÿ“ก MikroTik communication utilities
โ”‚   โ”‚   โ””โ”€โ”€ scheduler.py         # โฐ Backup scheduling logic
โ”‚   โ””โ”€โ”€ config.db               # ๐Ÿ’พ SQLite database (auto-created)
โ”œโ”€โ”€ ๐Ÿ“„ public/                   # ๐ŸŒ Frontend assets
โ”‚   โ”œโ”€โ”€ index.html               # ๐Ÿ  Main web interface
โ”‚   โ”œโ”€โ”€ style.css                # ๐ŸŽจ Application styling
โ”‚   โ”œโ”€โ”€ script.js                # โšก Frontend functionality
โ”‚   โ””โ”€โ”€ assets/                  # ๐Ÿ–ผ๏ธ Static assets
โ”‚       โ”œโ”€โ”€ logo.svg             # ๐Ÿท๏ธ Application logo
โ”‚       โ””โ”€โ”€ icons/               # ๐Ÿ”ฒ UI icons
โ”œโ”€โ”€ ๐Ÿ“„ backups/                  # ๐Ÿ’พ Backup storage directory
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt          # ๐Ÿ“ฆ Python dependencies
โ”œโ”€โ”€ ๐Ÿ“„ README.md                 # ๐Ÿ“š Project documentation
โ”œโ”€โ”€ ๐Ÿ“„ LICENSE                   # ๐Ÿ“œ MIT license file
โ”œโ”€โ”€ ๐Ÿ“„ .gitignore               # ๐Ÿšซ Git ignore patterns
โ”œโ”€โ”€ ๐Ÿ“„ setup.py                  # ๐Ÿ“ฆ Package configuration
โ””โ”€โ”€ ๐Ÿ“„ venv/                     # ๐Ÿ Python virtual environment

๐Ÿ”ง Configuration

Application Settings

# Default Configuration (backend/app.py)
PORT = 5000
BACKUP_DIR = 'backups/'
DATABASE_URL = 'sqlite:///backend/config.db'
SECRET_KEY = 'your-secret-key-here'  # Change in production

Router Configuration

Each router requires the following information:

  • Name: Friendly identifier (e.g., "Office-Firewall")
  • Host: IP address or hostname (e.g., "192.168.1.1")
  • Username: RouterOS login username (default: "admin")
  • Password: RouterOS login password
  • Port: API port (default: 8728)
  • SSL: Enable/disable SSL encryption

Environment Variables

export FLASK_ENV=production
export SECRET_KEY=your-production-secret
export BACKUP_DIR=/path/to/backups
export DATABASE_URL=sqlite:///path/to/database.db

๐Ÿšข Deployment

๐Ÿ–ฅ๏ธ Development Deployment

# Using Flask development server
python backend/app.py

# Access at: http://localhost:5000

๐Ÿญ Production Deployment

Option A: Gunicorn (Recommended)

# Install Gunicorn
pip install gunicorn

# Run with multiple workers
gunicorn -w 4 -b 0.0.0.0:5000 backend.app:app

# Access at: http://your-server:5000

Option B: Docker Deployment

FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 5000
CMD ["python", "backend/app.py"]
# Build and run
docker build -t mikrotik-backup-tool .
docker run -p 5000:5000 mikrotik-backup-tool

Option C: Nginx + Gunicorn

server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

๐Ÿค Contributing

We welcome contributions from the community! ๐ŸŒŸ

๐Ÿš€ Getting Started

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create a feature branch: git checkout -b feature/amazing-feature
  3. ๐Ÿ’ป Make your changes
  4. โœ… Test thoroughly
  5. ๐Ÿ“ค Submit a pull request

๐Ÿ“‹ Contribution Guidelines

  • ๐Ÿ“ Follow PEP 8 style guidelines for Python code
  • ๐Ÿงช Write comprehensive tests for new features
  • ๐Ÿ“š Update documentation for API changes
  • ๐Ÿ“ฑ Ensure responsive design for UI modifications
  • ๐Ÿ”„ Maintain backward compatibility when possible

๐ŸŽฏ Areas for Contribution

  • ๐Ÿ”ง New Router Support: Additional RouterOS versions or device types
  • ๐Ÿ“Š Enhanced Analytics: New monitoring and reporting features
  • โšก Performance Improvements: Backup speed and efficiency
  • ๐Ÿ’ซ UI/UX Enhancements: Accessibility, mobile optimization
  • ๐Ÿงช Testing: Unit tests, integration tests, performance benchmarks

๐Ÿ“‹ Changelog

๐Ÿ†• Version 1.0.0 (Current)

  • โœจ Initial release with core backup functionality
  • ๐ŸŒ Complete MikroTik RouterOS API integration
  • ๐Ÿ“ฑ Modern responsive web interface
  • ๐Ÿ“ฆ Support for full system and configuration backups
  • ๐Ÿ”„ Real-time status monitoring and alerts

๐Ÿ”ฎ Planned Features

  • โฐ Advanced scheduling with cron expressions
  • ๐Ÿ“ง Email notifications for backup completion/failure
  • ๐Ÿ“Š Advanced reporting and analytics dashboard
  • ๐Ÿ”Œ REST API for third-party integrations
  • โ˜๏ธ Cloud storage integration (AWS S3, Google Cloud)

๐Ÿ› Troubleshooting

โŒ Common Issues

Problem Solution
Router connection failed Verify IP address, credentials, and API access
Backup process hangs Check router resources and network connectivity
File download fails Verify disk space and file permissions
Web interface not loading Confirm Flask is running on correct port

๐Ÿ”ง Getting Help

  1. ๐Ÿ“– Check this README thoroughly
  2. ๐Ÿ” Search existing GitHub issues
  3. ๐Ÿ’ฌ Create a new issue with detailed information
  4. ๐Ÿ“ง Contact: work.rezaul@outlook.com

๐Ÿ“ž Support & Contact

๐Ÿ’ฌ Get Help

๐ŸŒŸ Show Your Support

  • โญ Star this project if you find it helpful
  • ๐Ÿ› Report bugs to help improve the tool
  • ๐Ÿ’ก Suggest features for future releases
  • ๐Ÿ“– Share with others who might benefit

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2023 REZ LAB

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

๐Ÿ‘จโ€๐Ÿ’ป Author & Contact

Rezaul Karim

Email LinkedIn GitHub

๐Ÿข REZ LAB


๐ŸŽฏ About This Project

Built with โค๏ธ for MikroTik administrators and ISP professionals

Production Ready Actively Maintained

โญ If you find this project helpful, please give it a star!

โœจ Features โ€ข ๐Ÿš€ Quick Start โ€ข ๐Ÿ“– Usage โ€ข ๐Ÿค Contribute