tony5188/db-backup-agent

By tony5188

Updated 6 months ago

Image
Security
Integration & delivery
Databases & storage
2

1.2K

tony5188/db-backup-agent repository overview

数据库备份代理 (DB Backup Agent)

v2.4.0 版本发布啦!新增多用户数据隔离 + 两步验证(2FA) + 忘记密码功能,让备份管理更安全、更智能!

中文 | English


中文说明

这是一个轻量级的、通过 Web 界面管理的数据库备份工具,专为 PostgreSQL 和 MySQL 设计。它将复杂的备份策略和繁琐的命令行操作,简化为在浏览器中的几次点击。

📸 界面预览

v2.4 版本全新界面设计

登录界面 主界面

现代化的界面设计,提供更人性化的操作体验:

  • 🔐 两步验证(2FA):支持 TOTP 一次性密码认证,使用 Google Authenticator 等应用增强账户安全
  • 👥 多用户隔离:完整的用户数据隔离,每个用户的备份任务、配置和历史完全独立
  • 🔑 忘记密码:通过 OTP 验证安全地重置密码
  • 🔔 消息通知:支持邮件和企业微信通知,备份成功/失败自动推送
  • 📋 备份历史:详细的备份历史记录,包括执行时间、状态和结果信息
  • 📜 系统日志:实时查看系统运行日志,方便故障排查

注意:此镜像支持多架构。Docker 会根据您的设备(x86_64 或 ARM64)自动拉取优化后的版本。

✨ v2.4 版本主要功能

🔒 安全增强

  • 两步验证(2FA):新增 TOTP 一次性密码认证功能,增强账户安全
  • OTP 设置向导:友好的二维码扫描和验证码输入界面
  • 安全管理页面:统一的安全设置入口,支持启用/禁用两步验证
  • 验证器应用支持:兼容 Google Authenticator、Microsoft Authenticator、Authy 等主流应用
  • 忘记密码功能:支持通过 OTP 验证重置密码,强制两步验证保障安全
  • 智能登录流程:登录页面 OTP 输入框始终显示,支持可选填写

👥 多用户支持

  • 用户注册功能:支持用户自主注册,注册成功后自动引导设置两步验证
  • 数据隔离:完整的用户数据隔离,每个用户的备份任务、配置和历史完全独立
  • 数据库级隔离:所有业务表增加 user_id 外键,确保数据安全隔离
  • 文件系统隔离:备份文件按用户分目录存储(/backups/user_{user_id}/)

🔔 通知系统

  • 邮件通知:支持自定义 SMTP 服务器,支持 TLS/SSL 加密连接
  • 企业微信通知:通过企业微信应用推送消息,支持 @all 或指定用户
  • 通知时机配置:可选择备份成功时通知、失败时通知

📊 监控与管理

  • 备份历史:详细记录每次备份的执行时间、触发方式、状态和结果信息
  • 系统日志:实时查看系统运行日志,方便故障排查和性能监控
  • 并发控制:智能备份锁机制,防止并发备份冲突
  • 更新日志:Web 界面直接查看版本更新说明和新功能介绍

💾 数据管理

  • 数据持久化:用户数据、数据库配置、备份文件统一存储在 /backups 目录
  • 自动迁移:应用启动时自动检查并修复数据库表和索引
  • 智能保留策略:可自定义备份文件的保留天数,自动删除旧备份

🎨 Web 界面

  • 直观管理:简洁直观的 UI,无需记忆和输入复杂的命令行
  • 响应式设计:支持移动端和平板设备访问
  • 智能编辑:点击编辑按钮即可快速修改数据库配置,备份频率自动回显

🗄️ 数据库支持

  • PostgreSQL:完整支持 PostgreSQL 数据库备份
  • MySQL/MariaDB:支持 MySQL 和 MariaDB 数据库备份
  • 多架构支持:完美支持 x86_64 (amd64) 和 ARM64 (Apple Silicon, Raspberry Pi)
🚀 快速开始
使用 Docker Compose (推荐)

创建一个 docker-compose.yml 文件:

version: '3.8'

services:
  db-backup-agent:
    image: tony5188/db-backup-agent:v2.4
    container_name: db-backup-agent
    restart: unless-stopped
    ports:
      - "5001:5001"
    volumes:
      # 必须: 持久化存储备份文件和配置
      - ./backups:/backups
    environment:
      # 设置时区,确保定时任务准时执行
      - TZ=Asia/Shanghai

volumes:
  backups:

在同一目录下创建一个名为 backups 的文件夹,然后运行:

docker-compose up -d

启动成功后,访问 Web 界面:http://localhost:5001

🏷️ 镜像标签说明
  • v2.4最新版本,包含多用户数据隔离、两步验证、忘记密码等所有新功能
  • v2.3:包含通知系统、备份历史、并发控制等功能
  • v2.2:包含数据库自动迁移功能
  • latest:指向最新稳定版本
⚙️ 配置说明
  • 端口:默认为 5001
  • 数据卷:必须挂载 /backups 目录,所有的数据库备份文件、配置文件、用户数据库和日志文件都将存储在这里
  • 时区 (TZ):强烈建议设置 TZ 环境变量(如 Asia/Shanghai),否则定时任务可能会有时差
  • 首次使用:启动后访问 http://localhost:5001,注册一个新账号并设置两步验证即可开始使用
🔐 两步验证设置
  1. 注册账号:首次访问需要注册账号
  2. 设置 OTP:注册成功后,系统会引导您设置两步验证
  3. 下载验证器应用
    • Google Authenticator (iOS/Android)
    • Microsoft Authenticator (iOS/Android)
    • Authy (iOS/Android/Desktop)
    • 1Password, LastPass 等密码管理器的内置功能
  4. 扫描二维码:使用验证器应用扫描系统生成的二维码
  5. 输入验证码:输入应用显示的 6 位数字验证码完成设置
  6. 完成设置:以后登录时需要输入验证码
🔑 忘记密码

系统提供安全的密码重置功能:

  • OTP 验证:必须通过两步验证才能重置密码
  • 安全保障:未启用 OTP 的账户无法自助重置,需联系管理员
  • 密码强度:提供实时的密码强度指示器
📖 使用说明
  1. 🔓 注册登录:首次访问需要注册账号,注册成功后需设置两步验证
  2. 🔐 两步验证:登录时输入验证器应用中的 6 位数字验证码
  3. ➕ 添加数据库:点击"添加数据库"按钮,填写连接信息(支持 PostgreSQL 和 MySQL)
  4. ⏰ 设置备份计划:为每个数据库配置独立的备份频率
  5. ▶️ 立即备份:点击播放图标按钮可立即触发备份
  6. ✏️ 编辑配置:点击编辑按钮修改数据库配置或备份计划
  7. 📋 查看历史:在备份历史面板查看每次备份的详细日志
  8. 🔔 配置通知:在通知设置中配置邮件或企业微信通知
🎯 v2.4.0 更新亮点

✨ 新增功能

  • 👥 多用户数据隔离:完整的多用户支持,每个用户的备份任务、配置和历史完全独立
  • 🔐 两步验证(2FA):新增 TOTP 一次性密码认证功能,增强账户安全
  • 🔑 忘记密码:支持通过 OTP 验证重置密码,强制两步验证保障安全
  • 🎯 智能登录流程:登录页面 OTP 输入框始终显示,支持可选填写

⚡ 优化改进

  • 📝 注册流程优化:注册成功后自动登录并引导到 OTP 设置页面
  • 🎨 登录页面优化:OTP 输入框始终显示,"如未设置可留空"提示
  • 🔒 密码重置流程:提供实时的密码强度指示器
  • 🎨 统一配色方案:采用统一的蓝色主题,界面更加专业美观

🔒 安全增强

  • 🛡️ 数据库级隔离:所有业务表增加 user_id 外键
  • 📂 文件系统隔离:备份文件按用户分目录存储
  • 🔐 TOTP 算法:使用标准 TOTP 算法(RFC 6238)
  • 🔑 密钥安全存储:密钥使用 Base32 编码存储
🔗 相关链接

English Description

A lightweight, web-managed database backup agent for PostgreSQL and MySQL. It simplifies complex backup strategies into a few clicks in your browser.

v2.4.0 is now live! New multi-user data isolation + Two-Factor Authentication (2FA) + Password Reset for smarter and safer backup management!

📸 Interface Preview

All-New v2.4 Interface

Login Page Main Dashboard

Modern interface design with enhanced user experience:

  • 🔐 Two-Factor Authentication (2FA): TOTP one-time password authentication using Google Authenticator and other apps
  • 👥 Multi-User Isolation: Complete user data isolation with independent backup tasks, configs, and history
  • 🔑 Password Reset: Securely reset passwords through OTP verification
  • 🔔 Notification System: Email and WeChat Work notifications for backup status
  • 📋 Backup History: Detailed logs with timestamps and results
  • 📜 System Logs: Real-time system operation logs for easy troubleshooting

Note: This image supports multi-architecture. It will automatically pull the correct version for your device (x86_64 or ARM64).

✨ v2.4 Features

🔒 Security Enhancements

  • Two-Factor Authentication (2FA): TOTP one-time password authentication for enhanced account security
  • OTP Setup Wizard: Friendly QR code scanning and verification code input interface
  • Security Management Page: Unified security settings for enabling/disabling 2FA
  • Authenticator App Support: Compatible with Google Authenticator, Microsoft Authenticator, Authy, etc.
  • Password Reset: Secure password reset through OTP verification with mandatory 2FA
  • Smart Login Flow: OTP input field always displayed on login page, optional for users without 2FA

👥 Multi-User Support

  • User Registration: Self-registration with automatic guidance to set up 2FA
  • Data Isolation: Complete user data isolation with independent backup tasks, configs, and history
  • Database-Level Isolation: All business tables include user_id foreign key
  • Filesystem Isolation: Backup files stored in separate directories (/backups/user_{user_id}/)

🔔 Notification System

  • Email Notifications: Custom SMTP server support with TLS/SSL encryption
  • WeChat Work Notifications: Push messages via WeChat Work applications
  • Flexible Timing: Configure notifications on backup success/failure

📊 Monitoring & Management

  • Backup History: Detailed records of all backup task execution history
  • System Logs: Real-time system operation logs for easy troubleshooting
  • Concurrency Control: Smart backup locking mechanism to prevent conflicts
  • Changelog: View version updates directly in the web interface

💾 Data Management

  • Data Persistence: User data, database configs, and backup files stored in /backups directory
  • Auto Migration: Automatic database table and index verification and repair on startup
  • Smart Retention: Customizable backup file retention policy

🎨 Web Interface

  • Intuitive Management: Clean UI, no need to remember complex CLI commands
  • Responsive Design: Mobile and tablet device support
  • Smart Editing: Quick edit with automatic value display

🗄️ Database Support

  • PostgreSQL: Full support for PostgreSQL database backups
  • MySQL/MariaDB: Support for MySQL and MariaDB database backups
  • Multi-Arch: Perfect support for amd64 and arm64 (Apple Silicon, Raspberry Pi)
🚀 Quick Start
Docker Compose

Create a docker-compose.yml file:

version: '3.8'

services:
  db-backup-agent:
    image: tony5188/db-backup-agent:v2.4
    container_name: db-backup-agent
    restart: unless-stopped
    ports:
      - "5001:5001"
    volumes:
      # Required: Persist backups and config
      - ./backups:/backups
    environment:
      # Set your timezone for accurate scheduling
      - TZ=Asia/Shanghai

volumes:
  backups:

Create a backups directory in the same folder, then run:

docker-compose up -d

Access the dashboard at http://localhost:5001.

🏷️ Tags
  • v2.4: Latest version with multi-user isolation, 2FA, password reset, and all new features
  • v2.3: Includes notification system, backup history, concurrency control
  • v2.2: Includes database auto-migration
  • latest: Points to the latest stable version
⚙️ Configuration
  • Port: Defaults to 5001
  • Volumes: Mount /backups to persist your data (backups, configs, user database)
  • Timezone: Set TZ env var (e.g., Asia/Shanghai, America/New_York) for accurate cron scheduling
  • First Time Use: Visit http://localhost:5001, register a new account, and set up 2FA
🔐 Two-Factor Authentication Setup
  1. Register Account: First-time visitors need to register
  2. Set Up OTP: After registration, the system will guide you to set up 2FA
  3. Download Authenticator App:
    • Google Authenticator (iOS/Android)
    • Microsoft Authenticator (iOS/Android)
    • Authy (iOS/Android/Desktop)
    • 1Password, LastPass built-in features
  4. Scan QR Code: Use the authenticator app to scan the QR code
  5. Enter Verification Code: Input the 6-digit code from the app
  6. Complete Setup: You'll need the verification code for future logins
🔑 Password Reset

The system provides secure password reset functionality:

  • OTP Verification: Must pass 2FA verification to reset password
  • Security: Accounts without 2FA enabled cannot self-reset, must contact admin
  • Password Strength: Real-time password strength indicator
📖 Usage Guide
  1. 🔓 Register/Login: First-time visitors need to register and set up 2FA
  2. 🔐 Two-Factor Auth: Enter the 6-digit code from your authenticator app when logging in
  3. ➕ Add Database: Click "Add Database" and enter connection details (PostgreSQL or MySQL)
  4. ⏰ Set Backup Schedule: Configure backup frequency for each database
  5. ▶️ Instant Backup: Click the play icon to trigger an immediate backup
  6. ✏️ Edit Configuration: Click edit button to modify database config or backup schedule
  7. 📋 View History: Check detailed logs for each backup in the history panel
  8. 🔔 Configure Notifications: Set up email or WeChat Work notifications
🎯 v2.4.0 Highlights

✨ New Features

  • 👥 Multi-User Data Isolation: Complete multi-user support with independent data
  • 🔐 Two-Factor Authentication (2FA): TOTP one-time password authentication
  • 🔑 Password Reset: Secure password reset through OTP verification
  • 🎯 Smart Login Flow: OTP input always displayed, optional for users without 2FA

⚡ Improvements

  • 📝 Registration Flow: Auto-login and guidance to OTP setup after registration
  • 🎨 Login Page: OTP field always shown with "optional if not set" hint
  • 🔒 Password Reset: Real-time password strength indicator
  • 🎨 Unified Color Scheme: Professional blue theme

🔒 Security Enhancements

  • 🛡️ Database-Level Isolation: All tables include user_id foreign key
  • 📂 Filesystem Isolation: Separate directories for each user's backups
  • 🔐 TOTP Algorithm: Standard TOTP (RFC 6238)
  • 🔑 Secure Key Storage: Base32 encoded secret keys

Tag summary

Content type

Image

Digest

sha256:f7f40e028

Size

229.4 MB

Last updated

6 months ago

docker pull tony5188/db-backup-agent