Backup and Restore

Backup and Restore

Why Backups Matter

Importance of Backups

Backups protect against:

  • Data Loss - Accidental deletion or corruption
  • Hardware Failure - Server or disk failures
  • Security Breaches - Malicious attacks
  • Human Error - Mistakes during updates
  • Disasters - Natural disasters or outages

Backup Frequency

Recommended backup schedule:

  • Daily - Full backups for active forums
  • Weekly - Full backups for smaller forums
  • Before Updates - Always backup before updates
  • Before Major Changes - Backup before configuration changes

What to Backup

Essential Files

Backup these directories and files:

Flatboard5/
├── stockage/          # Configuration and data (CRITICAL)
│   ├── json/         # JSON storage files
│   └── sqlite/       # SQLite database (Pro)
├── uploads/          # User uploads (IMPORTANT)
│   ├── avatars/
│   ├── attachments/
│   └── markdown/
├── plugins/          # Installed plugins (OPTIONAL)
├── themes/           # Custom themes (OPTIONAL)
└── languages/        # Custom translations (OPTIONAL)

Critical Data

Must Backup:

  • stockage/json/ - All JSON files (users, discussions, posts, config)
  • stockage/sqlite/ - SQLite database file (Pro)
  • uploads/ - User-uploaded files

Should Backup:

  • stockage/logs/ - Log files
  • Custom plugins and themes
  • Configuration files

Optional:

  • Core application files (can re-download)
  • Default themes and plugins

Backup Methods

The easiest way to create backups is using the built-in backup feature in the admin panel:

Creating a Backup

  1. Navigate to Admin Panel

    • Go to Admin Panel > Tools > Backups
  2. Create Backup

    • Click the "Create Backup" button
    • Select what to include:
      • ✅ Configuration - System configuration files
      • ✅ Data - All user data (JSON or SQLite)
      • ⬜ Uploads - User-uploaded files (avatars, attachments, images)
      • ⬜ Logs - System logs
      • ⬜ Cache - Cache files
      • ⬜ Plugins - Installed plugins (select specific plugins or all)
      • ⬜ Themes - Installed themes (select specific themes or all)
    • Click "Create" and wait for the backup to complete
  3. Download Backup

    • Once created, click the download icon (âŹ‡ïž) next to the backup in the list
    • The backup file will be downloaded to your computer
    • Backup files are named: backup_YYYY-MM-DD_HH-MM-SS.zip

Uploading a Backup

You can also upload a backup file to the server:

  1. Navigate to Admin Panel

    • Go to Admin Panel > Tools > Backups
  2. Upload Backup

    • Click the "Upload Backup" button
    • Select a ZIP file from your computer
    • The file must:
      • Be a valid ZIP archive
      • Contain a manifest.json file
      • Have a .zip extension
      • Be within your PHP upload_max_filesize / post_max_size limit (displayed on the upload page)
    • Click "Upload" and wait for the upload to complete

Restoring a Backup

  1. Navigate to Admin Panel

    • Go to Admin Panel > Tools > Backups
  2. Restore Backup

    • Find the backup you want to restore in the list
    • Click the "Restore" button
    • Confirm the restoration (this action is irreversible)
    • Wait for the restore to complete
    • Important: You will be logged out after restoring data - you must log in again with the restored admin account

Method 2: Manual Backup

JSON Storage Backup

# Create backup directory
mkdir -p /backups/flatboard-$(date +%Y%m%d)

# Backup JSON storage
tar -czf /backups/flatboard-$(date +%Y%m%d)/json-backup.tar.gz stockage/json/

# Backup uploads
tar -czf /backups/flatboard-$(date +%Y%m%d)/uploads-backup.tar.gz uploads/

# Backup plugins (if custom)
tar -czf /backups/flatboard-$(date +%Y%m%d)/plugins-backup.tar.gz plugins/

# Backup themes (if custom)
tar -czf /backups/flatboard-$(date +%Y%m%d)/themes-backup.tar.gz themes/

SQLite Backup (Pro)

# Backup SQLite database
sqlite3 stockage/sqlite/flatboard.db ".backup /backups/flatboard-$(date +%Y%m%d)/flatboard.db"

# Or copy the file
cp stockage/sqlite/flatboard.db /backups/flatboard-$(date +%Y%m%d)/flatboard.db

Full Backup

# Backup entire installation (excluding core files)
tar -czf /backups/flatboard-full-$(date +%Y%m%d).tar.gz \
    stockage/ \
    uploads/ \
    plugins/ \
    themes/ \
    languages/

Method 3: Automated Backup Script

Create automated backup script:

#!/bin/bash
# backup-flatboard.sh

BACKUP_DIR="/backups/flatboard"
DATE=$(date +%Y%m%d-%H%M%S)
BACKUP_PATH="$BACKUP_DIR/$DATE"

# Create backup directory
mkdir -p "$BACKUP_PATH"

# Backup JSON storage
tar -czf "$BACKUP_PATH/json.tar.gz" stockage/json/

# Backup SQLite (if exists)
if [ -f "stockage/sqlite/flatboard.db" ]; then
    sqlite3 stockage/sqlite/flatboard.db ".backup $BACKUP_PATH/flatboard.db"
fi

# Backup uploads
tar -czf "$BACKUP_PATH/uploads.tar.gz" uploads/

# Backup custom plugins
tar -czf "$BACKUP_PATH/plugins.tar.gz" plugins/

# Backup custom themes
tar -czf "$BACKUP_PATH/themes.tar.gz" themes/

# Create manifest
echo "Backup created: $DATE" > "$BACKUP_PATH/manifest.txt"
echo "Files:" >> "$BACKUP_PATH/manifest.txt"
ls -lh "$BACKUP_PATH" >> "$BACKUP_PATH/manifest.txt"

# Compress everything
tar -czf "$BACKUP_DIR/flatboard-$DATE.tar.gz" -C "$BACKUP_DIR" "$DATE"

# Remove uncompressed directory
rm -rf "$BACKUP_PATH"

# Keep only last 7 days of backups
find "$BACKUP_DIR" -name "flatboard-*.tar.gz" -mtime +7 -delete

echo "Backup completed: $BACKUP_DIR/flatboard-$DATE.tar.gz"

Make executable:

chmod +x backup-flatboard.sh

Method 4: Cron Job Automation

Set up automated daily backups:

# Edit crontab
crontab -e

# Add daily backup at 2 AM
0 2 * * * /path/to/backup-flatboard.sh >> /var/log/flatboard-backup.log 2>&1

Backup Storage

Local Storage

Store backups on the same server:

  • Pros: Fast, easy access
  • Cons: Lost if server fails

Remote Storage

Store backups off-site:

FTP/SFTP

# Upload backup via SFTP
scp backup.tar.gz user@backup-server:/backups/

Cloud Storage

AWS S3:

aws s3 cp backup.tar.gz s3://your-bucket/backups/

Google Cloud Storage:

gsutil cp backup.tar.gz gs://your-bucket/backups/

Dropbox/OneDrive:

  • Use rclone or similar tools

Backup Rotation

Keep multiple backup versions:

# Keep daily backups for 7 days
# Keep weekly backups for 4 weeks
# Keep monthly backups for 12 months

Restore Procedures

The easiest way to restore a backup is using the built-in restore feature in the admin panel:

Step 1: Upload Backup (If Needed)

If your backup is on your computer and not on the server:

  1. Go to Admin Panel > Tools > Backups
  2. Click "Upload Backup" button
  3. Select the backup ZIP file from your computer
  4. Click "Upload" and wait for the upload to complete

The backup file must:

  • Be a valid ZIP archive
  • Contain a manifest.json file
  • Have a .zip extension
  • Be smaller than 500MB (or your PHP upload_max_filesize limit)

Step 2: Restore Backup

  1. Go to Admin Panel > Tools > Backups
  2. Find the backup you want to restore in the list
  3. Click the "Restore" button
  4. Confirm the restoration (this action is irreversible)
  5. Wait for the restore to complete
  6. You will be automatically logged out after restoring data
  7. Log in again with the restored admin account credentials

What Gets Restored

The restore process will restore only what was included in the backup:

  • Configuration - System settings (if included)
  • Data - All user data (users, discussions, posts, categories, etc.) (if included)
  • Uploads - User-uploaded files (avatars, attachments, images) (if included)
  • Logs - System logs (if included)
  • Cache - Cache files (if included)
  • Plugins - Selected plugins (if included)
  • Themes - Selected themes (if included)

Restore from Command Line

Restore JSON Storage

# Stop forum (put in maintenance mode)
# Extract backup
tar -xzf json-backup.tar.gz

# Restore files
cp -r json/* stockage/json/

# Set permissions
chmod 600 stockage/json/config.json
chmod 644 stockage/json/*.json

# Clear cache
php app/Cli/console.php cache:clear

Restore SQLite Database (Pro)

# Stop forum
# Restore database
sqlite3 stockage/sqlite/flatboard.db < backup.sql

# Or restore from backup file
cp backup.db stockage/sqlite/flatboard.db

# Set permissions
chmod 600 stockage/sqlite/flatboard.db

# Verify integrity
sqlite3 stockage/sqlite/flatboard.db "PRAGMA integrity_check;"

Restore Uploads

# Extract backup
tar -xzf uploads-backup.tar.gz

# Restore files
cp -r uploads/* uploads/

# Set permissions
chmod -R 750 uploads/

Full Restore

# Extract full backup
tar -xzf flatboard-full-20251225.tar.gz

# Restore directories
cp -r stockage/ stockage/
cp -r uploads/ uploads/
cp -r plugins/ plugins/
cp -r themes/ themes/

# Set permissions
chmod -R 750 stockage/
chmod -R 750 uploads/
chmod 755 plugins/
chmod 755 themes/

# Clear cache
php app/Cli/console.php cache:clear

Verify Restore

After restoring:

  1. Check Files - Verify all files restored
  2. Test Forum - Access forum and test functionality
  3. Check Data - Verify discussions, posts, users
  4. Test Features - Test key features
  5. Check Logs - Review error logs

Updating Flatboard (Local Update System)

Flatboard supports a local update workflow for offline or self-hosted deployments where the automatic update check URL is not configured or not reachable. This lets you apply official update archives manually without internet access during the update itself.

How It Works

  1. Download a Flatboard update archive (.zip) from the official site or your distribution channel
  2. Upload it via the Backups page — the system detects it as an update and routes it automatically
  3. Apply it from Admin → Tools → Updates using a guided 5-step process

Update archives are standard ZIP files with an embedded manifest.json that identifies them as Flatboard updates:

{
  "type": "update",
  "software": "flatboard",
  "edition": "pro",
  "version": "5.2.1",
  "build_date": "2026-03-10",
  "checksum": "sha256:...",
  "compatible_from": "5.0.0"
}

Step 1: Upload the Update Archive

  1. Go to Admin Panel → Tools → Backups

  2. Click "Upload Backup"

  3. Select the Flatboard update .zip file from your computer

    :::info The upload page displays the effective PHP upload size limit (upload_max_filesize / post_max_size). The client validates the file size before submitting to avoid a failed round-trip. :::

  4. Click "Upload" and wait for the upload to complete

The server detects the archive as a Flatboard update (manifest.type == "update" and manifest.software == "flatboard") and routes it to storage/updates/ instead of storage/backups/. A success notice with a link to Admin → Tools → Updates is displayed.

Step 2: Apply the Update

  1. Go to Admin Panel → Tools → Updates

    The page scans storage/updates/ and displays one card per valid archive:

    Card styleMeaning
    Green ("Update")Archive version is newer than the installed version
    Yellow ("Reinstall")Archive version matches the installed version
    Listed for deletion onlyArchive version is older than the installed version
  2. Click "Update" or "Reinstall" on the desired archive

  3. The 5-step progress UI runs automatically:

    StepWhat it does
    1 — VerifyValidates manifest (edition, semver ≄ current version, checksum)
    2 — BackupCreates a full automatic backup of your forum before touching any files
    3 — ExtractExtracts the archive to a temporary directory
    4 — DeployCopies new files into the installation, skipping protected paths
    5 — CleanupRemoves the temporary extraction directory

    Each step is executed over a separate CSRF-protected AJAX call with retry logic. The UI shows real-time progress and stops with an error message if any step fails.

Protected Paths

The deploy step never overwrites these paths regardless of what the archive contains:

  • stockage/ — all forum data (JSON / SQLite)
  • uploads/ — user-uploaded files
  • .env — environment configuration
  • .htaccess — web server configuration
  • install.php — installer

Managing Old Archives

Archives older than the currently installed version are listed separately on the Updates page with a Delete button. They cannot be applied. Clean them up once you no longer need them.

Disaster Recovery

Complete Server Failure

If server is completely lost:

  1. Provision New Server - Set up new server
  2. Install Flatboard 5 - Fresh installation
  3. Restore Backup - Restore from latest backup
  4. Verify - Test everything
  5. Update DNS - Point domain to new server

Partial Data Loss

If only some data is lost:

  1. Identify Lost Data - Determine what's missing
  2. Restore from Backup - Restore specific files
  3. Merge Data - Merge with existing data if needed
  4. Verify - Check data integrity

Corrupted Data

If data is corrupted:

  1. Stop Forum - Put in maintenance mode
  2. Restore from Backup - Restore last known good backup
  3. Verify Integrity - Check data integrity
  4. Test - Test functionality

Backup Best Practices

Regular Schedule

  • Automate - Use cron jobs for automation
  • Test Restores - Regularly test backup restoration
  • Monitor - Check backup logs regularly
  • Verify - Verify backup integrity

Security

  • Encrypt Backups - Encrypt sensitive backups
  • Secure Storage - Store backups securely
  • Access Control - Limit backup access
  • Off-Site - Keep backups off-site

Documentation

  • Document Process - Document backup procedures
  • Label Backups - Clearly label backup files
  • Keep Logs - Maintain backup logs
  • Update Procedures - Keep procedures current

Troubleshooting

Backup Fails

Check:

  1. Disk space available
  2. File permissions
  3. Backup script permissions
  4. Error logs

Restore Fails

Check:

  1. Backup file integrity
  2. File permissions
  3. Disk space
  4. Compatibility with current version

Backup Too Large

Solutions:

  1. Exclude unnecessary files
  2. Compress more aggressively
  3. Split into multiple backups
  4. Use incremental backups

Resources

Last updated: March 10, 2026