Last Updated: 3/10/2026
Backup & Restore
Protect your LinkAce data with automated backups to local storage or cloud services. This guide covers complete backup configuration and restoration procedures.
Overview
LinkAce uses the Spatie Laravel Backup package to provide:
✅ Full application backups - Database + uploaded files
✅ Automated scheduling - Daily backups with configurable timing
✅ Intelligent cleanup - Automatic removal of old backups
✅ Multiple destinations - Local filesystem or S3-compatible storage
✅ Email notifications - Alerts for backup success/failure
Quick Start: Local Backups
Get basic backup protection in 5 minutes.
For Docker Installations
1. Create backup directory:
mkdir ./backups
chmod 0766 ./backups2. Edit docker-compose.yml:
Uncomment the backup volume line:
services:
app:
volumes:
- ./.env:/app/.env
- ./backups:/app/storage/app/backups # Remove the # at start of line3. Enable backups in .env:
BACKUP_ENABLED=true
BACKUP_DISK=local_backups
BACKUP_NOTIFICATION_EMAIL=your@email.com4. Restart:
docker compose restart✅ Done! Backups will run daily at 2:00 AM.
For Non-Docker Installations
1. Ensure storage is writable:
cd /path/to/linkace
chmod -R 0766 storage/app/backups2. Enable in .env:
BACKUP_ENABLED=true
BACKUP_DISK=local_backups
BACKUP_NOTIFICATION_EMAIL=your@email.com3. Clear cache:
php artisan config:clear✅ Done! Backups will run daily at 2:00 AM.
Configuration Options
All backup settings go in your .env file.
Basic Settings
| Setting | Values | Default | Description |
|---|---|---|---|
BACKUP_ENABLED | true, false | false | Enable/disable backups |
BACKUP_DISK | local_backups, s3 | local_backups | Where to store backups |
BACKUP_NOTIFICATION_EMAIL | email address | [email protected] | Where to send alerts |
BACKUP_NOTIFICATIONS_ENABLED | true, false | true | Enable/disable email alerts |
Scheduling
| Setting | Format | Default | Description |
|---|---|---|---|
BACKUP_RUN_HOUR | HH:MM | 02:00 | When to create backups (24-hour format) |
BACKUP_CLEAN_HOUR | HH:MM | 01:00 | When to clean old backups (24-hour format) |
Examples:
BACKUP_RUN_HOUR=03:00 # Run at 3:00 AM
BACKUP_CLEAN_HOUR=02:30 # Clean at 2:30 AMRetention & Size
| Setting | Type | Default | Description |
|---|---|---|---|
BACKUP_MAX_SIZE | number (MB) | 512 | Maximum total backup size in megabytes |
Example:
BACKUP_MAX_SIZE=1024 # Allow up to 1GB of backupsHow cleanup works:
- When total size exceeds
BACKUP_MAX_SIZE, oldest backups are deleted first - The package keeps a smart mix of recent and historical backups
- See Spatie cleanup strategy for details
Security
| Setting | Type | Default | Description |
|---|---|---|---|
BACKUP_ARCHIVE_PASSWORD | string | none | Encrypt backups with a password |
Example:
BACKUP_ARCHIVE_PASSWORD=MySecurePassword123!⚠️ Important: Store this password securely! You’ll need it to restore backups.
Cloud Backups (S3)
Back up to Amazon S3 or any S3-compatible service.
Supported Services
- Amazon AWS S3
- Backblaze B2
- DigitalOcean Spaces
- Wasabi
- Minio (self-hosted)
- Any S3-compatible service
Amazon AWS S3 Setup
1. Create S3 bucket:
- Log into AWS Console
- Create new S3 bucket
- Note the bucket name and region
2. Create IAM user:
- Create IAM user with programmatic access
- Attach policy with S3 permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::your-bucket-name",
"arn:aws:s3:::your-bucket-name/*"
]
}
]
}- Save Access Key ID and Secret Access Key
3. Configure .env:
BACKUP_ENABLED=true
BACKUP_DISK=s3
BACKUP_NOTIFICATION_EMAIL=your@email.com
AWS_ACCESS_KEY_ID=your-access-key-id
AWS_SECRET_ACCESS_KEY=your-secret-access-key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your-bucket-name4. Restart:
# Docker
docker compose restart
# Non-Docker
php artisan config:clearS3-Compatible Services
For non-AWS services (Backblaze, Minio, etc.):
1. Configure .env:
BACKUP_ENABLED=true
BACKUP_DISK=s3
# Service credentials
AWS_ACCESS_KEY_ID=your-key-id
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your-bucket-name
# Service-specific endpoint
AWS_ENDPOINT=https://s3.us-west-001.backblazeb2.com
AWS_USE_PATH_STYLE_ENDPOINT=trueService-specific endpoints:
| Service | Endpoint Format |
|---|---|
| Backblaze B2 | https://s3.REGION.backblazeb2.com |
| DigitalOcean Spaces | https://REGION.digitaloceanspaces.com |
| Wasabi | https://s3.REGION.wasabisys.com |
| Minio | https://your-minio-server.com |
2. Set path-style endpoint (if needed):
Some services require path-style URLs:
AWS_USE_PATH_STYLE_ENDPOINT=trueThis changes URL format from:
- Virtual-hosted:
https://bucket-name.s3.region.amazonaws.com/file - Path-style:
https://s3.region.amazonaws.com/bucket-name/file
Manual Backups
Create backups on-demand instead of waiting for the schedule.
Run Manual Backup
Docker:
docker exec linkace-app-1 php artisan backup:runNon-Docker:
cd /path/to/linkace
php artisan backup:runOutput example:
Starting backup...
Dumping database...
Adding files to backup...
Zipping backup...
Backup completed successfully!
Backup size: 45.2 MB
Backup location: /app/storage/app/backups/2024-01-15-14-30-45.zipList Backups
Docker:
docker exec linkace-app-1 php artisan backup:listNon-Docker:
php artisan backup:listOutput example:
+----------------------------+----------+--------+
| Name | Disk | Size |
+----------------------------+----------+--------+
| 2024-01-15-14-30-45.zip | local | 45 MB |
| 2024-01-14-02-00-12.zip | local | 44 MB |
| 2024-01-13-02-00-08.zip | local | 43 MB |
+----------------------------+----------+--------+Clean Old Backups
Docker:
docker exec linkace-app-1 php artisan backup:cleanNon-Docker:
php artisan backup:cleanRestoring Backups
What’s Included in a Backup
Each backup contains:
- Complete database dump - All links, lists, tags, users, settings
- Uploaded files - User avatars, custom assets
- Application files - (Optional, depending on configuration)
Not included:
.envfile (contains secrets)- Docker volumes (database, Redis)
- Application code (re-download from releases)
Restoration Process
Step 1: Prepare Clean Installation
Option A: Fresh installation
- Follow Installation Guide
- Complete initial setup
- Stop the application
Option B: Existing installation
- Stop LinkAce
- Backup current
.envfile - Clear current database (optional, for clean restore)
Step 2: Extract Backup
1. Download backup file:
Local backups:
# Docker
cp ./backups/2024-01-15-14-30-45.zip /tmp/
# Non-Docker
cp storage/app/backups/2024-01-15-14-30-45.zip /tmp/S3 backups:
- Download from AWS Console, or
- Use AWS CLI:
aws s3 cp s3://your-bucket/backups/2024-01-15-14-30-45.zip /tmp/2. Extract backup:
cd /tmp
unzip 2024-01-15-14-30-45.zipIf password-protected:
unzip -P YourPassword 2024-01-15-14-30-45.zipStep 3: Restore Database
Docker with MySQL:
# Find database dump file
ls -la /tmp/db-dumps/
# Restore to database
docker exec -i linkace-db-1 mysql -u linkace -p linkace < /tmp/db-dumps/mysql-linkace.sqlEnter database password when prompted (from .env).
Docker with PostgreSQL:
docker exec -i linkace-db-1 psql -U linkace linkace < /tmp/db-dumps/pgsql-linkace.sqlNon-Docker with MySQL:
mysql -u linkace -p linkace < /tmp/db-dumps/mysql-linkace.sqlNon-Docker with PostgreSQL:
psql -U linkace linkace < /tmp/db-dumps/pgsql-linkace.sqlStep 4: Restore Files
Docker:
# Copy uploaded files
docker cp /tmp/storage/app/public/. linkace-app-1:/app/storage/app/public/
# Fix permissions
docker exec linkace-app-1 chown -R www-data:www-data /app/storageNon-Docker:
# Copy uploaded files
cp -r /tmp/storage/app/public/* /path/to/linkace/storage/app/public/
# Fix permissions
chmod -R 0766 /path/to/linkace/storageStep 5: Clear Caches
Docker:
docker exec linkace-app-1 php artisan cache:clear
docker exec linkace-app-1 php artisan config:clear
docker exec linkace-app-1 php artisan view:clearNon-Docker:
php artisan cache:clear
php artisan config:clear
php artisan view:clearStep 6: Start and Verify
Docker:
docker compose up -dNon-Docker:
# Restart web server (nginx/apache)
sudo systemctl restart nginxVerify restoration:
- Open LinkAce in browser
- Log in with your credentials
- Check that links, lists, and tags are present
- Verify user accounts exist
- Test creating a new link
Email Notifications
Get notified about backup success and failures.
Configure Email
1. Set up email in .env:
# Backup notifications
BACKUP_NOTIFICATIONS_ENABLED=true
BACKUP_NOTIFICATION_EMAIL=admin@example.com
# SMTP configuration
MAIL_FROM_ADDRESS=linkace@example.com
MAIL_FROM_NAME=LinkAce
MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=your-smtp-username
MAIL_PASSWORD=your-smtp-password
MAIL_ENCRYPTION=tls2. Restart:
# Docker
docker compose restart
# Non-Docker
php artisan config:clearFor complete email setup, see Email Configuration.
Notification Types
You’ll receive emails for:
✅ Backup succeeded - Confirmation with size and location
❌ Backup failed - Error details and troubleshooting
🗑️ Cleanup completed - Old backups removed
⚠️ Backup unhealthy - Backup is too old or corrupted
Disable Notifications
To disable email alerts:
BACKUP_NOTIFICATIONS_ENABLED=false⚠️ Not recommended - You won’t know if backups fail!
Backup Best Practices
Storage Strategy
✅ Use cloud storage - Local backups can be lost with server failure
✅ 3-2-1 rule - 3 copies, 2 different media, 1 offsite
✅ Encrypt backups - Use BACKUP_ARCHIVE_PASSWORD
✅ Test restores - Verify backups work before you need them
Scheduling
✅ Daily backups - Default schedule is good for most users
✅ Off-peak hours - Run at 2-3 AM when traffic is low
✅ Stagger tasks - Clean at 1 AM, backup at 2 AM
Retention
✅ Keep multiple versions - Don’t rely on single backup
✅ Monitor size - Adjust BACKUP_MAX_SIZE as collection grows
✅ Archive important backups - Download and store separately
Monitoring
✅ Enable email notifications - Know when backups fail
✅ Check backup size - Sudden changes indicate problems
✅ Verify backup location - Ensure backups are being created
✅ Test restoration - Do a test restore every few months
Troubleshooting
Backups Not Running
Problem: No backups are being created.
Solutions:
-
Check cron is configured:
- Go to System Settings
- Verify “System Cron” shows recent run
- See Post-Installation Setup
-
Verify backup is enabled:
grep BACKUP_ENABLED .env # Should show: BACKUP_ENABLED=true -
Check permissions:
# Docker docker exec linkace-app-1 ls -la /app/storage/app/backups # Non-Docker ls -la storage/app/backupsDirectory should be writable.
-
Run manual backup to see errors:
docker exec linkace-app-1 php artisan backup:run
Backup Fails with “Disk Full”
Problem: Backup fails due to insufficient space.
Solutions:
- Increase disk space on server
- Reduce backup size:
BACKUP_MAX_SIZE=256 # Reduce from 512 - Clean old backups:
docker exec linkace-app-1 php artisan backup:clean - Use cloud storage instead of local
S3 Upload Fails
Problem: Backups fail when uploading to S3.
Solutions:
-
Verify credentials:
# Test AWS CLI aws s3 ls s3://your-bucket --profile linkace -
Check endpoint:
# For non-AWS services, ensure endpoint is set AWS_ENDPOINT=https://your-service-endpoint.com -
Verify IAM permissions:
- User needs
s3:PutObject,s3:GetObject,s3:DeleteObject - Bucket policy allows access
- User needs
-
Check region:
AWS_DEFAULT_REGION=us-east-1 # Must match bucket region
Restore Fails
Problem: Database restore produces errors.
Solutions:
-
Check database version compatibility
- MySQL dump from 8.0 may not work on 5.7
- Use same database version as backup source
-
Verify database is empty:
# Drop and recreate database docker exec linkace-db-1 mysql -u root -p -e "DROP DATABASE linkace; CREATE DATABASE linkace;" -
Check for corruption:
# Verify backup file is valid unzip -t backup-file.zip -
Review error messages:
- SQL syntax errors indicate version mismatch
- Permission errors indicate user access issues
Email Notifications Not Received
Problem: No backup notification emails.
Solutions:
-
Verify email is configured:
grep MAIL_ .env -
Test email:
docker exec linkace-app-1 php artisan linkace:test-email your@email.com -
Check spam folder
-
Verify notification email is set:
BACKUP_NOTIFICATION_EMAIL=your@email.com BACKUP_NOTIFICATIONS_ENABLED=true
Advanced Configuration
Custom Backup Schedule
For more control, edit the backup schedule directly.
Not recommended for most users - use BACKUP_RUN_HOUR instead.
See Spatie documentation for advanced scheduling.
Exclude Files from Backup
Reduce backup size by excluding certain files.
Edit config/backup.php (advanced users only):
'exclude' => [
'storage/logs',
'storage/framework/cache',
],Multiple Backup Destinations
Back up to both local and S3 simultaneously.
Edit config/backup.php (advanced users only):
'destination' => [
'disks' => [
'local_backups',
's3',
],
],Next Steps
Essential Reading
- Post-Installation Setup - Configure cron for automated backups
- Email Configuration - Set up notifications
- Environment Variables - Advanced configuration
Related Topics
- Troubleshooting - Common issues
- Upgrading LinkAce - Update procedures
- CLI Commands - Command-line tools
Protect your bookmarks - set up backups today! 📦