# PanelAlpha Snapshot Tool
PanelAlpha Snapshot Tool is a professional command-line utility for creating secure, encrypted backups (snapshots) of complete PanelAlpha installations. The tool enables comprehensive backup management, automated scheduling, and reliable system restoration.
# Overview
The Snapshot Tool allows you to:
- Create complete backups of PanelAlpha (databases, files, configuration)
- Automatically create backups at scheduled times
- Restore the system on the same or new server
- Securely store backups in the cloud or locally
# What Gets Backed Up
# Databases
- PanelAlpha API Database: Complete MySQL dump with routines and triggers
# Docker Volumes
api-storage
: PanelAlpha application datadatabase-api-data
: MySQL data filesredis-data
: Redis cache and session data
# Configuration Files
docker-compose.yml
: Container orchestration configuration.env
files: Environment variables and secretspackages/
: Custom packages and extensions- SSL certificates: Let's Encrypt certificates
- Nginx configurations: Web server settings
# Installation
Download and install the snapshot tool on your PanelAlpha server:
# Download the tool
wget https://raw.githubusercontent.com/panelalpha/PanelAlpha-Snapshot-Tool/refs/heads/main/panelalpha-snapshot.sh
# Make it executable
chmod +x panelalpha-snapshot.sh
# Install required dependencies
sudo ./panelalpha-snapshot.sh --install
# Initial Configuration
Configure the backup storage location by running the setup wizard:
sudo ./panelalpha-snapshot.sh --setup
The setup wizard will guide you through configuring:
- Storage backend type (local, S3, SFTP)
- Connection credentials
- Encryption password
- Backup retention settings
# Storage Options
# Local Storage
- Best for: Development, testing, quick local backups
- Repository format:
local:/backup/panelalpha-snapshots
- Pros: Fast, simple setup
- Cons: Single point of failure
# SFTP Storage
- Best for: Remote server backups, existing SSH infrastructure
- Repository format:
sftp:backup-user@backup.example.com:/backups/panelalpha
- Pros: Secure, widely supported
- Requires: SSH access to remote server
# S3-Compatible Storage
- Best for: Production environments, scalable storage
- Repository format:
s3:s3.eu-west-1.amazonaws.com/my-bucket/panelalpha-snapshots
- Supports: AWS S3, Hetzner Storage, MinIO, DigitalOcean Spaces
- Pros: Highly available, scalable, cost-effective
# Basic Operations
# Creating Snapshots
Create a manual backup:
sudo ./panelalpha-snapshot.sh --snapshot
# Listing Snapshots
View all available backups:
sudo ./panelalpha-snapshot.sh --list-snapshots
# Testing Connection
Verify repository connectivity:
sudo ./panelalpha-snapshot.sh --test-connection
# Backup Restoration
# Same Server Restoration
If you need to restore PanelAlpha to a previous state on the same server:
List available backups:
sudo ./panelalpha-snapshot.sh --list-snapshots
Restore from specific backup:
sudo ./panelalpha-snapshot.sh --restore a1b2c3d4
Restore from latest backup:
sudo ./panelalpha-snapshot.sh --restore latest
Note: Restoration will replace all current data! Ensure you have recent backups before proceeding.
# Migration to New Server
To migrate PanelAlpha to a new server:
On the source server:
- Create a final backup:
sudo ./panelalpha-snapshot.sh --snapshot
- Note the backup ID from the command output
On the target server:
- Install PanelAlpha (basic installation only)
- Copy and install the snapshot tool:
sudo ./panelalpha-snapshot.sh --install
- Configure repository (use same settings as source server):
sudo ./panelalpha-snapshot.sh --setup
- Test connection:
sudo ./panelalpha-snapshot.sh --test-connection
- Restore from backup:
sudo ./panelalpha-snapshot.sh --restore a1b2c3d4
The restore process automatically:
- Updates database connection settings
- Adjusts server IP addresses in system settings
- Configures trusted hosts
- Recreates Docker volumes
- Restores SSL certificates
# Automated Backups
# Enable Automation
Install automatic daily backups:
sudo ./panelalpha-snapshot.sh --cron install
# Check Status
Monitor automation status:
sudo ./panelalpha-snapshot.sh --cron status
# Disable Automation
Remove automatic backups:
sudo ./panelalpha-snapshot.sh --cron remove
# Configuration File
Advanced configuration is stored in /opt/panelalpha/app/.env-backup
:
# Repository settings
RESTIC_REPOSITORY="s3:s3.eu-west-1.amazonaws.com/my-bucket/panelalpha-snapshots"
RESTIC_PASSWORD="your-encryption-password"
# S3 credentials (if applicable)
AWS_ACCESS_KEY_ID="your-access-key"
AWS_SECRET_ACCESS_KEY="your-secret-key"
# Snapshot settings
BACKUP_RETENTION_DAYS=30
BACKUP_HOUR=2
BACKUP_TAG_PREFIX="panelalpha"
# System paths
LOG_FILE="/var/log/panelalpha-snapshot.log"
BACKUP_TEMP_DIR="/var/tmp"
RESTIC_CACHE_DIR="/var/cache/restic"
# Backup Management
# Delete Old Backups
Remove specific snapshots to free up storage space:
sudo ./panelalpha-snapshot.sh --delete-snapshots a1b2c3d4
# Check Disk Usage
Monitor storage consumption:
# Check available disk space
df -h
# Check backup repository size
sudo ./panelalpha-snapshot.sh --repository-stats
# Security Features
The Snapshot Tool implements enterprise-grade security:
- ✅ Encryption: All snapshots are encrypted using AES-256
- ✅ Access Control: Configuration files have restricted permissions (600)
- ✅ Credential Management: Cloud credentials are only exported during operations
- ✅ Network Security: HTTPS/TLS for all remote communications
# Monitoring and Logs
# Log Files
Monitor backup operations in /var/log/panelalpha-snapshot.log
:
# View recent activity
sudo tail -f /var/log/panelalpha-snapshot.log
# Search for errors
sudo grep ERROR /var/log/panelalpha-snapshot.log
# Automatic Backup Monitoring
Check the status of scheduled backups:
sudo ./panelalpha-snapshot.sh --cron status
# Troubleshooting
# Common Issues
Permission Denied
# Ensure running with sudo
sudo ./panelalpha-snapshot.sh --snapshot
Docker Not Running
sudo systemctl start docker
sudo systemctl enable docker
Repository Connection Failed
# Test connection
sudo ./panelalpha-snapshot.sh --test-connection
# Verify credentials
sudo nano /opt/panelalpha/app/.env-backup
Insufficient Disk Space
# Check available space
df -h /var/tmp
# Clean up old snapshots
sudo ./panelalpha-snapshot.sh --delete-snapshots old-snapshot-id
Database Connection Errors
- Verify PanelAlpha is running:
docker compose ps
- Check database passwords in
.env
file - Review logs:
sudo tail -f /var/log/panelalpha-snapshot.log
# Getting Help
If you encounter issues:
- Check logs for specific error messages
- Run connection test to validate repository access
- Contact PanelAlpha support