✨ New Features: - Complete backup lifecycle management (create, list, download, delete, cleanup) - Web-based backup interface with real-time status updates - Individual backup deletion and bulk cleanup for old backups - Docker-aware backup operations with volume persistence - Automated backup scheduling and retention policies 📁 Added Files: - backup.py - Core backup script for creating timestamped archives - docker_backup.sh - Docker-compatible backup wrapper script - app/templates/backup.html - Web interface for backup management - BACKUP_SYSTEM.md - Comprehensive backup system documentation - BACKUP_GUIDE.md - Quick reference guide for backup operations 🔧 Enhanced Files: - Dockerfile - Added backup.py copy for container availability - docker-compose.yml - Added backup volume mount for persistence - app/routes/api.py - Added backup API endpoints (create, list, delete, cleanup) - app/routes/main.py - Added backup management route - app/templates/index.html - Added backup management navigation - README.md - Updated with backup system overview and quick start 🎯 Key Improvements: - Fixed backup creation errors in Docker environment - Added Docker-aware path detection for container operations - Implemented proper error handling and user confirmation dialogs - Added real-time backup status updates via JavaScript - Enhanced data persistence with volume mounting 💡 Use Cases: - Data protection and disaster recovery - Environment migration and cloning - Development data management - Automated maintenance workflows
82 lines
3.0 KiB
YAML
Executable File
82 lines
3.0 KiB
YAML
Executable File
# Docker Compose configuration for QR Code Manager
|
|
# This file defines the containerized deployment of the QR Code Manager application
|
|
version: '3.8'
|
|
|
|
services:
|
|
qr-manager:
|
|
# Build the Docker image from the Dockerfile in the current directory
|
|
build: .
|
|
|
|
# Set a custom container name for easier identification and management
|
|
container_name: qr-code-manager
|
|
|
|
# Automatically restart the container unless explicitly stopped
|
|
# Options: no, always, unless-stopped, on-failure
|
|
restart: unless-stopped
|
|
|
|
# Port mapping: host_port:container_port
|
|
# Maps host port 8066 to container port 5000 (where Flask/Gunicorn runs)
|
|
# Access the app at: http://localhost:8066 or https://your-domain (via reverse proxy)
|
|
ports:
|
|
- "8066:5000"
|
|
|
|
# Load environment variables from .env file
|
|
# Contains production settings like SECRET_KEY, ADMIN_USERNAME, etc.
|
|
env_file:
|
|
- .env
|
|
|
|
# Additional environment variables set directly in compose
|
|
# FLASK_ENV=production enables production mode with Gunicorn server
|
|
environment:
|
|
- FLASK_ENV=production
|
|
|
|
# Volume mounts: host_path:container_path
|
|
# Persist data and files outside the container for backup and updates
|
|
volumes:
|
|
# QR code images - stores generated PNG files
|
|
- /opt/qr/qr_codes:/app/app/static/qr_codes
|
|
|
|
# Logo files - stores uploaded custom logos for QR codes
|
|
- /opt/qr/logos:/app/app/static/logos
|
|
|
|
# Flask session files - stores user session data
|
|
# Uses /app/flask_session to avoid permission issues (mapped from /tmp/flask_session in container)
|
|
- /opt/qr/sessions:/app/flask_session
|
|
|
|
# Application data - stores JSON databases (link_pages.json, qr_codes.json, short_urls.json)
|
|
- /opt/qr/persistent:/app/data
|
|
|
|
# Backup files - stores backup archives created by backup scripts
|
|
- ./backups:/app/backups
|
|
|
|
# Health check configuration - monitors container health
|
|
# Ensures the application is responding correctly
|
|
healthcheck:
|
|
# Command to test application health - checks the /health endpoint
|
|
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:5000/health')"]
|
|
|
|
# How often to run the health check
|
|
interval: 30s
|
|
|
|
# Maximum time to wait for health check response
|
|
timeout: 10s
|
|
|
|
# Number of consecutive failures before marking as unhealthy
|
|
retries: 3
|
|
|
|
# Grace period before starting health checks (allows app startup time)
|
|
start_period: 10s
|
|
|
|
# Docker labels for metadata and container management
|
|
# Useful for monitoring, backup scripts, and documentation
|
|
labels:
|
|
- "com.example.description=QR Code Manager Application"
|
|
- "com.example.service=qr-manager"
|
|
|
|
# Network configuration
|
|
# Creates a custom network for better container isolation and communication
|
|
networks:
|
|
default:
|
|
# Custom network name for the QR Manager application
|
|
name: qr-manager-network
|