PulseLMS Backup and Restore Guide¶
Overview¶
PulseLMS provides comprehensive backup and restore capabilities to protect your course content, user data, and learning activities. This guide covers all aspects of backup and restore operations, from individual course backups to site-wide data protection strategies.
Backups are essential for: - Data Protection: Safeguarding against accidental deletion or corruption - Course Replication: Creating copies of courses for new terms or sections - Migration: Moving courses between PulseLMS instances - Archival: Preserving completed courses for reference - Disaster Recovery: Restoring operations after system failures
1. Course Backup - What's Included¶
1.1 Understanding Backup Content¶
When you create a course backup in PulseLMS, the system packages various course components into a single compressed file (.mbz format). Understanding what's included helps you make informed backup decisions.
Core Course Elements¶
| Component | Description | Backup Behavior |
|---|---|---|
| Course Settings | General course configuration, format, appearance | Always included |
| Sections | Topic/week structure and descriptions | Always included |
| Activities | All activity modules (assignments, quizzes, forums, etc.) | Configurable |
| Resources | Files, folders, pages, URLs, labels | Configurable |
| Blocks | Sidebar blocks and their configurations | Configurable |
| Course Files | Uploaded files in course file areas | Included with activities |
| Completion Settings | Activity and course completion rules | Configurable |
| Competencies | Linked competencies and frameworks | Configurable |
User Data Components¶
| Component | Description | Default State |
|---|---|---|
| User Enrollments | Who is enrolled and their roles | Excluded by default |
| Activity Completion | Individual user completion records | Excluded by default |
| Gradebook Data | All grades and grade history | Excluded by default |
| Assignment Submissions | Student submitted files and text | Excluded by default |
| Forum Posts | Discussion posts and replies | Excluded by default |
| Quiz Attempts | Student quiz attempt data | Excluded by default |
| User Files | Private user files in course | Excluded by default |
| Logs | Course activity logs | Excluded by default |
| Comments | User comments on activities | Excluded by default |
| Badge Criteria Progress | Badge completion progress | Excluded by default |
1.2 Activity-Specific Backup Content¶
Assignment Backups¶
- Assignment description and instructions
- Submission settings (types, deadlines, attempts)
- Grading settings (rubrics, marking guides)
- Feedback types configuration
- Group submission settings
- Optional: Student submissions and grades
Quiz Backups¶
- Quiz settings and timing options
- Question bank categories (course-level)
- Individual questions and answers
- Random question selections
- Grade calculation settings
- Optional: Student attempts and grades
Forum Backups¶
- Forum type and settings
- Subscription and tracking settings
- Rating configurations
- Optional: Discussion threads and posts
- Optional: User subscriptions
Workshop Backups¶
- Workshop phases and settings
- Assessment forms and criteria
- Grading strategies
- Optional: Submissions and assessments
Database Activity Backups¶
- Field definitions
- Template designs
- Preset configurations
- Optional: User entries
Wiki Backups¶
- Wiki type and settings
- Page structures
- Optional: Page content and history
Glossary Backups¶
- Entry definitions
- Category structures
- Display formats
- Optional: User entries
1.3 Files and Media¶
Backup file handling depends on where files are stored:
Course Backup File Structure:
├── moodle_backup.xml # Master backup descriptor
├── files/ # All backed up files
│ ├── [hash1] # Individual files by content hash
│ ├── [hash2]
│ └── ...
├── course/ # Course data
│ └── course.xml
├── activities/ # Activity data
│ ├── assign_123/
│ ├── quiz_456/
│ └── ...
├── sections/ # Section data
│ ├── section_1/
│ └── ...
└── users.xml # User data (if included)
1.4 What's NOT Included in Course Backups¶
- System-level question bank categories
- User profile data beyond enrollments
- Course category structure
- External tool (LTI) credentials
- Repository configurations
- Plugin-specific external data
- User authentication details
- Site-wide badge definitions
2. Backup Settings and Options¶
2.1 Accessing Backup Settings¶
For Individual Course Backups: 1. Navigate to your course 2. Access Course Administration > Backup 3. Or use the gear icon > Backup
For Site-Wide Backup Settings: 1. Go to Site Administration 2. Navigate to Courses > Backups 3. Configure default settings
2.2 Initial Settings Page¶
When starting a backup, you'll encounter these setting categories:
Include Options¶
| Setting | Description | Recommendation |
|---|---|---|
| Include enrolled users | Backup user enrollment data | Enable for full restore |
| Anonymize user information | Replace real names with placeholders | For sharing externally |
| Include user role assignments | Preserve role configurations | Enable for full restore |
| Include activities and resources | Backup course content | Always enable |
| Include blocks | Backup sidebar blocks | Enable for complete backup |
| Include filters | Backup filter settings | Enable if using filters |
| Include comments | Backup activity comments | Based on needs |
| Include badges | Backup badge definitions | Enable if using badges |
| Include calendar events | Backup course calendar | Enable for full backup |
| Include competencies | Backup competency links | Enable if using competencies |
| Include content bank content | Backup H5P and other content | Enable if using content bank |
| Include custom fields | Backup custom course fields | Enable if using custom fields |
| Include groups and groupings | Backup group structures | Enable if using groups |
| Include question bank | Backup course question bank | Essential for quizzes |
| Include permissions overrides | Backup capability changes | Enable for full restore |
User Data Options¶
| Setting | Description | Privacy Consideration |
|---|---|---|
| Include user files | Personal files in course | Contains PII |
| Include grade history | Historical grade changes | Contains PII |
| Include user completion | Completion tracking data | Contains PII |
| Include logs | Activity log data | Contains PII |
2.3 Schema Settings¶
The schema settings page allows fine-grained control:
Activity Selection:
├── Section 1
│ ├── ☑ Assignment: Week 1 Essay
│ │ └── ☐ Include user data
│ ├── ☑ Quiz: Unit 1 Test
│ │ └── ☐ Include user data
│ └── ☑ Forum: Discussion 1
│ └── ☐ Include user data
├── Section 2
│ ├── ☑ Resource: Reading Materials
│ └── ☑ Page: Instructions
└── Section 3
└── ☑ Assignment: Final Project
└── ☐ Include user data
2.4 Confirmation and Execution¶
Before backup execution:
- Review Summary: Verify selected items
- Filename: Customize backup filename
- Default format:
backup-courseshortname-date-time.mbz - Example:
backup-eng101-20250115-1430.mbz - Destination: Choose where to store backup
- Course backup area
- User private files
- Download immediately
2.5 Default Backup Settings (Administrator)¶
Administrators can configure site-wide defaults:
Site Administration > Courses > Backups > General backup defaults
Recommended Defaults:
├── Include enrolled users: No
├── Anonymize user information: Yes
├── Include user role assignments: No
├── Include activities and resources: Yes
├── Include blocks: Yes
├── Include filters: Yes
├── Include comments: No
├── Include badges: Yes
├── Include calendar events: Yes
├── Include competencies: Yes
├── Include groups and groupings: Yes
├── Include question bank: Yes
└── Include permissions overrides: No
3. Automated Backups (Administrator)¶
3.1 Enabling Automated Backups¶
PulseLMS can automatically backup courses on a schedule. This requires administrator access.
Configuration Path:
Site Administration > Courses > Backups > Automated backup setup
3.2 Automated Backup Settings¶
General Settings¶
| Setting | Options | Recommendation |
|---|---|---|
| Active | Disabled / Enabled / Manual | Enabled |
| Schedule | Days of week / Time | Off-peak hours |
| Keep | Number to retain | 2-5 backups |
| Min kept | Minimum backups | 1 |
| Max kept | Maximum backups | 10 |
Schedule Configuration¶
Automated Backup Schedule:
├── Run on: ☑ Sunday
│ ☐ Monday
│ ☐ Tuesday
│ ☐ Wednesday
│ ☐ Thursday
│ ☐ Friday
│ ☑ Saturday
├── Execute at: 02:00 (2 AM server time)
└── Skip courses modified after: Never
Course Selection¶
| Option | Description |
|---|---|
| All courses | Backup every course |
| Courses modified since last backup | Only changed courses |
| Specific categories | Selected categories only |
| Skip hidden courses | Exclude hidden courses |
3.3 Storage Configuration¶
Backup Storage Settings:
├── Backup destination: Specified directory
├── Directory path: /var/backups/pulselms/automated/
├── Delete old backups: Yes
├── Keep this many: 3
└── Storage limit: 50 GB
3.4 Monitoring Automated Backups¶
Viewing Backup Status:
1. Go to Site Administration > Courses > Backups > Automated backup report
2. Review recent backup operations
3. Check for errors or warnings
Status Indicators: - OK: Backup completed successfully - Skipped: Course unchanged since last backup - Warning: Backup completed with issues - Error: Backup failed - Unfinished: Backup interrupted
3.5 Automated Backup Logs¶
Sample Backup Log Entry:
========================================
Backup started: 2025-01-15 02:00:05
Course: Introduction to Biology (BIO101)
Status: OK
Duration: 3 minutes 24 seconds
File size: 156.7 MB
Filename: backup-bio101-20250115-0200.mbz
========================================
Backup started: 2025-01-15 02:03:30
Course: Advanced Mathematics (MATH301)
Status: WARNING
Duration: 8 minutes 12 seconds
Warning: Large file truncated (video over 100MB limit)
File size: 89.3 MB
Filename: backup-math301-20250115-0200.mbz
========================================
3.6 Email Notifications¶
Configure email alerts for backup status:
Notification Settings:
├── Send to: [email protected], [email protected]
├── Send when:
│ ├── ☑ Backup fails
│ ├── ☑ Backup has warnings
│ └── ☐ Backup succeeds
└── Digest: Send daily summary at 06:00
3.7 Cron Job Requirements¶
Automated backups require proper cron configuration:
# PulseLMS Cron Job (Required for automated backups)
# Run every minute to allow PulseLMS scheduler to manage tasks
* * * * * /usr/bin/php /var/www/html/pulselms/admin/cli/cron.php >/dev/null
# Alternative: Dedicated backup cron (runs independently)
0 2 * * 0,6 /usr/bin/php /var/www/html/pulselms/admin/cli/automated_backups.php
4. Manual Backups¶
4.1 Creating a Manual Course Backup¶
Step-by-Step Process:
- Access Course Backup
- Navigate to your course
- Click gear icon (⚙) > Backup
-
Or: Course Administration > Backup
-
Initial Settings
- Select what to include (see Section 2)
- Choose whether to include user data
-
Click Next
-
Schema Settings
- Select specific activities to include
- Toggle user data per activity
-
Click Next
-
Confirmation
- Review backup summary
- Modify filename if desired
-
Click Perform backup
-
Completion
- Wait for backup to complete
- Download or note storage location
- Click Continue
4.2 Quick Backup (Default Settings)¶
For rapid backups using default settings:
- Navigate to your course
- Go to gear icon > Backup
- Click Jump to final step
- Review settings summary
- Click Perform backup
This uses administrator-configured defaults without customization options.
4.3 Backup with User Data¶
When including user data:
Important Considerations: - Increases backup file size significantly - Contains personally identifiable information (PII) - May be subject to data protection regulations (GDPR, FERPA) - Requires secure storage and handling
Enabling User Data: 1. On Initial Settings page, enable: - ☑ Include enrolled users - ☑ Include user role assignments 2. On Schema Settings, for each activity: - ☑ Include user information 3. This includes: - Enrollments - Submissions - Grades - Forum posts - Completion records
4.4 Anonymized Backups¶
For sharing courses externally:
- Enable Anonymize user information on Initial Settings
- Real names replaced with "User 1", "User 2", etc.
- Email addresses anonymized
- Profile pictures removed
- Useful for:
- Course templates
- Training materials
- External sharing
- Demonstration purposes
4.5 Partial Backups¶
Creating backups of specific content:
Backup Specific Sections: 1. Access Schema Settings 2. Uncheck unwanted sections 3. Keep desired sections checked
Backup Specific Activities: 1. Access Schema Settings 2. Expand each section 3. Uncheck individual activities to exclude
Backup Without Questions: 1. Uncheck "Include question bank" on Initial Settings 2. Note: Quiz content may be incomplete
4.6 Command Line Backups¶
For administrators, CLI backup provides additional options:
# Basic course backup
sudo -u www-data php /var/www/html/pulselms/admin/cli/backup.php \
--courseid=123 \
--destination=/var/backups/courses/
# Backup with all user data
sudo -u www-data php /var/www/html/pulselms/admin/cli/backup.php \
--courseid=123 \
--destination=/var/backups/courses/ \
--users=all
# Backup without user data
sudo -u www-data php /var/www/html/pulselms/admin/cli/backup.php \
--courseid=123 \
--destination=/var/backups/courses/ \
--users=none
# Backup multiple courses
for id in 101 102 103 104; do
sudo -u www-data php /var/www/html/pulselms/admin/cli/backup.php \
--courseid=$id \
--destination=/var/backups/courses/
done
5. Downloading Backup Files¶
5.1 Accessing Backup Files¶
From Course Backup Area: 1. Navigate to course 2. Go to gear icon > Restore 3. Scroll to Course backup area 4. Click backup filename to download
From User Private Backup Area: 1. Go to user profile 2. Access Manage private files 3. Locate backup file 4. Click to download
From Automated Backup Storage: 1. Access server storage location 2. Navigate to configured backup directory 3. Copy or download files directly
5.2 Backup File Naming Conventions¶
Standard Naming Pattern:
backup-[shortname]-[date]-[time].mbz
Examples:
├── backup-eng101-20250115-1430.mbz
├── backup-bio201-fall2025-20250108-0930.mbz
├── backup-intro_chemistry-20241220-1600.mbz
└── backup-mgt500_leadership-20250112-1100.mbz
Automated Backup Pattern:
backup-[shortname]-[date]-[time]-auto.mbz
5.3 Managing Backup Storage¶
Course Backup Area Management: 1. Go to course > Restore 2. View Course backup area 3. Delete old backups to free space 4. Rename backups for organization
Storage Limits: - Course backup area: Typically 100MB default - Can be increased by administrators - Check available space before large backups
5.4 Backup File Structure¶
Understanding the .mbz file contents:
# Examining backup contents (Linux/Mac)
unzip -l backup-course101-20250115-1430.mbz
# Archive Contents:
├── moodle_backup.xml # Backup metadata
├── moodle_backup.log # Backup log
├── files.xml # File manifest
├── files/ # Actual files
│ ├── ab/
│ │ └── abcd1234... # Files stored by hash
│ └── cd/
│ └── cdef5678...
├── course/
│ ├── course.xml # Course settings
│ ├── inforef.xml # Cross-references
│ └── roles.xml # Role assignments
├── activities/
│ ├── assign_123/
│ │ ├── module.xml
│ │ ├── assign.xml
│ │ ├── grades.xml
│ │ └── inforef.xml
│ ├── quiz_456/
│ │ ├── module.xml
│ │ ├── quiz.xml
│ │ └── questions.xml
│ └── forum_789/
│ ├── module.xml
│ ├── forum.xml
│ └── discussions.xml
├── sections/
│ ├── section_0/
│ │ └── section.xml
│ ├── section_1/
│ │ └── section.xml
│ └── section_2/
│ └── section.xml
├── users.xml # User data (if included)
├── groups.xml # Group data
├── outcomes.xml # Learning outcomes
├── gradebook.xml # Gradebook settings
├── scales.xml # Custom scales
├── question_categories.xml # Question bank categories
└── questions.xml # Question data
5.5 Transferring Backup Files¶
Between PulseLMS Instances: 1. Download backup from source instance 2. Upload to destination instance user files 3. Access Restore on destination 4. Select uploaded file
To External Storage: 1. Download backup file 2. Transfer to external location: - Cloud storage (Google Drive, Dropbox, etc.) - External hard drive - Network attached storage 3. Maintain proper access controls
6. Course Restore - New Course vs Existing¶
6.1 Understanding Restore Options¶
PulseLMS offers three primary restore approaches:
| Option | Description | Use Case |
|---|---|---|
| Restore to new course | Creates fresh course | Course duplication, new term |
| Restore to existing course | Adds to current course | Content merge, updates |
| Delete existing and restore | Replaces course content | Course reset |
6.2 Restoring to a New Course¶
Step-by-Step Process:
- Access Restore Interface
- Navigate to any course or Site Administration
- Go to Restore
-
Upload backup file or select from course backup area
-
Select Backup File
- Upload new backup (.mbz file)
- Or choose from existing backups
-
Click Restore
-
Destination Selection
- Choose Restore as a new course
- Select target category
-
Click Continue
-
Settings Configuration
- Configure course settings
- Modify course name/shortname
- Set start date
-
Click Next
-
Schema Selection
- Select content to restore
- Choose user data options
-
Click Next
-
Process and Complete
- Review restoration summary
- Click Perform restore
- Wait for completion
6.3 Restoring to an Existing Course¶
Merge Content Options:
| Option | Behavior |
|---|---|
| Merge the backup course into this course | Adds backup content to existing content |
| Delete the contents of this course and then restore | Replaces all content |
Merging Content: 1. Select Merge the backup course into this course 2. Existing content remains 3. Backup content added as new sections 4. May result in duplicate content if not careful
Replacing Content: 1. Select Delete the contents of this course and then restore 2. All existing content removed 3. Fresh content from backup restored 4. Use with caution - no undo
6.4 Restore Settings¶
Course Settings Override:
| Setting | Description | Options |
|---|---|---|
| Overwrite course configuration | Replace course settings | Yes / No |
| Course name | New course name | Custom or from backup |
| Course short name | New short name | Custom or from backup |
| Course start date | When course begins | Custom or from backup |
| Keep current groups and groupings | Preserve existing groups | Yes / No |
| Keep current enrollments | Preserve current users | Yes / No |
6.5 Selective Restoration¶
Restore only specific content:
-
On Schema settings page, uncheck unwanted items:
-
Proceed with restore
- Only selected items restored
6.6 User Data Restoration¶
Restoring with User Data: - Requires backup that includes user data - Matches users by email or username - Creates new users if "Restore as new users" selected - Respects site authentication methods
User Matching Process: 1. System checks for existing users 2. Matches by email address first 3. Falls back to username matching 4. Unmatched users: skip or create new
User Data Conflicts: - Existing grades: keep or overwrite - Enrollments: merge or replace - Completion: preserve or restore
6.7 Post-Restore Verification¶
After restoration, verify:
- Course Structure
- All sections present
- Activities in correct locations
-
Resources accessible
-
Content Integrity
- Files open correctly
- Links functional
-
Images display properly
-
Settings Accuracy
- Dates adjusted correctly
- Completion settings intact
-
Grade settings preserved
-
User Data (if restored)
- Enrollments correct
- Grades present
- Submissions accessible
7. Import Course Data¶
7.1 Understanding Import vs Restore¶
| Feature | Import | Restore |
|---|---|---|
| Source | Another course on same site | Backup file |
| User data | Never included | Optionally included |
| Speed | Faster | Variable |
| Use case | Copy content between courses | Full course recovery |
7.2 Importing from Another Course¶
Step-by-Step Process:
- Access Import
- Navigate to destination course
-
Go to gear icon > Import
-
Select Source Course
- Browse available courses
- Search by name or short name
- Select source course
-
Click Continue
-
Initial Settings
-
Choose what to import:
- ☑ Include activities and resources
- ☑ Include blocks
- ☑ Include filters
- ☑ Include calendar events
- ☑ Include question bank
- ☑ Include competencies
-
Schema Settings
- Select specific items to import
- Expand sections for granular control
-
Click Next
-
Confirmation
- Review import summary
-
Click Perform import
-
Completion
- Wait for import to complete
- Review imported content
- Click Continue
7.3 Import Scenarios¶
Scenario 1: Importing a Single Activity 1. Start import process 2. On Schema settings, uncheck all sections 3. Expand desired section 4. Check only the activity to import 5. Complete import
Scenario 2: Importing Question Bank Only 1. On Initial Settings, uncheck all except "Include question bank" 2. Proceed through import 3. Only questions imported
Scenario 3: Importing Multiple Activities 1. Select multiple activities across sections 2. Activities imported to matching sections 3. New sections created if needed
7.4 Import Permissions¶
Who Can Import: - Users with 'import' capability in destination course - Typically: Teachers, Course creators, Managers - Must also have access to source course
Visibility of Source Courses: - Only courses where user has backup permission visible - Hidden courses may not appear - Site administrators see all courses
7.5 Import Best Practices¶
- Before Importing:
- Review source course content
- Plan section structure in destination
-
Consider question bank organization
-
During Import:
- Use descriptive section names
- Import related content together
-
Check dependencies (e.g., quiz + questions)
-
After Import:
- Verify all content transferred
- Update dates and deadlines
- Review completion settings
- Test links and resources
8. Backup/Restore Best Practices¶
8.1 Backup Strategy¶
Recommended Backup Frequency:
| Course Type | Backup Frequency | Retention |
|---|---|---|
| Active course (high activity) | Weekly | 4 weeks |
| Active course (moderate) | Bi-weekly | 6 weeks |
| Completed course | End of term | 1 year |
| Template courses | After each update | All versions |
| Archive courses | Once | Indefinite |
8.2 Pre-Backup Checklist¶
Before Creating Important Backups:
☐ Review course for sensitive data
☐ Remove unnecessary large files
☐ Clean up unused question bank entries
☐ Archive old forum discussions if not needed
☐ Verify all links are current
☐ Check file storage space availability
☐ Plan backup during low-usage hours
☐ Notify users if system may be slow
8.3 Backup Naming Conventions¶
Recommended Format:
[shortname]-[type]-[date]-[version].mbz
Examples:
├── eng101-full-20250115-v1.mbz # Full backup
├── eng101-nouser-20250115-v1.mbz # Without user data
├── eng101-template-20250115-v1.mbz # Template version
├── eng101-archive-20250115-final.mbz # End of term archive
└── eng101-questions-20250115.mbz # Question bank only
8.4 Storage Best Practices¶
Local Storage: - Dedicated backup partition - Separate from PulseLMS installation - Regular disk space monitoring - RAID or redundant storage
Off-site Storage: - Encrypted cloud storage - Scheduled automatic transfers - Geographic redundancy - Tested restoration procedures
Retention Policy:
Backup Retention Schedule:
├── Daily automated backups: 7 days
├── Weekly backups: 4 weeks
├── Monthly backups: 12 months
├── Semester archives: 5 years
└── Compliance backups: As required
8.5 Security Considerations¶
Backup Security: 1. Encrypt backup files containing user data 2. Restrict access to backup storage 3. Use secure transfer methods (SFTP, encrypted upload) 4. Maintain access logs 5. Regular security audits
Data Protection:
Security Measures:
├── File encryption: AES-256
├── Transfer: SFTP or HTTPS only
├── Access: Role-based permissions
├── Storage: Encrypted at rest
├── Retention: Documented policy
└── Disposal: Secure deletion
8.6 Testing Backups¶
Regular Restore Testing: 1. Schedule quarterly restore tests 2. Use test environment for verification 3. Document test results 4. Address any issues found
Test Checklist:
Backup Restore Test:
☐ Backup file integrity check
☐ Complete restore to test instance
☐ Content verification
☐ File accessibility
☐ User data accuracy (if included)
☐ Grade data accuracy (if included)
☐ Plugin compatibility
☐ Performance assessment
☐ Document findings
☐ Update procedures if needed
8.7 Documentation¶
Maintain Backup Documentation: - Backup procedures and schedules - Storage locations and access info - Restoration procedures - Contact information for issues - Compliance requirements - Change log for procedures
9. Troubleshooting Large Backups¶
9.1 Common Size Issues¶
Causes of Large Backups: 1. Many video files embedded in course 2. Large document repositories 3. Extensive question bank with images 4. Multiple years of user data 5. Uncompressed image files 6. Redundant file uploads
9.2 Reducing Backup Size¶
Before Backup:
-
Audit Course Content
-
External File Hosting
- Move large videos to YouTube/Vimeo
- Use cloud storage for large documents
-
Embed external content rather than upload
-
Question Bank Cleanup
- Remove unused questions
- Consolidate duplicate questions
- Optimize question images
9.3 PHP Configuration for Large Backups¶
Required PHP Settings:
; php.ini settings for large backups
max_execution_time = 7200 ; 2 hours
memory_limit = 512M ; or higher for very large courses
post_max_size = 2048M ; larger than max backup size
upload_max_filesize = 2048M ; matches post_max_size
max_input_time = 7200 ; matches execution time
9.4 Server Configuration¶
Apache Settings:
# .htaccess or virtual host configuration
<Directory /var/www/html/pulselms>
php_value max_execution_time 7200
php_value memory_limit 512M
php_value post_max_size 2048M
php_value upload_max_filesize 2048M
</Directory>
# Timeout settings
Timeout 7200
ProxyTimeout 7200
Nginx Settings:
# nginx.conf
http {
client_max_body_size 2048M;
location ~ \.php$ {
fastcgi_read_timeout 7200;
fastcgi_send_timeout 7200;
}
}
9.5 Command Line for Large Backups¶
CLI Backup for Large Courses:
# Use CLI to avoid browser timeouts
sudo -u www-data php /var/www/html/pulselms/admin/cli/backup.php \
--courseid=123 \
--destination=/var/backups/pulselms/
# With increased memory limit
sudo -u www-data php -d memory_limit=1024M \
/var/www/html/pulselms/admin/cli/backup.php \
--courseid=123 \
--destination=/var/backups/pulselms/
# Background execution for very large backups
nohup sudo -u www-data php -d memory_limit=2048M \
/var/www/html/pulselms/admin/cli/backup.php \
--courseid=123 \
--destination=/var/backups/pulselms/ \
> /var/log/pulselms/backup-123.log 2>&1 &
9.6 Timeout Issues¶
Problem: Backup times out before completion
Solutions:
- Use CLI backup instead of web interface
- Split backup into parts
- Backup sections separately
-
Combine using import
-
Increase timeout settings
-
Use asynchronous backup (if available)
9.7 Memory Errors¶
Problem: "Allowed memory size exhausted" error
Solutions:
-
Increase PHP memory limit
-
Check for memory leaks in plugins
- Disable non-essential plugins during backup
-
Update all plugins to latest versions
-
Backup without resource-heavy content
- Exclude large file areas
- Backup question bank separately
9.8 Disk Space Issues¶
Problem: "Not enough disk space" error
Solutions:
-
Check available space
-
Clear temporary files
-
Use alternative temp directory
-
Clean up old backups
9.9 Backup Progress Monitoring¶
CLI Progress Monitoring:
# Monitor backup log in real-time
tail -f /var/log/pulselms/backup-123.log
# Check backup file size growth
watch -n 10 'ls -lh /var/backups/pulselms/*.mbz'
# Monitor PHP process
ps aux | grep backup.php
10. Site-Level Backups¶
10.1 Understanding Site Backups¶
Site-level backups protect the entire PulseLMS installation, including: - Database (all courses, users, configurations) - PulseLMS files (PulseLMS data directory) - Plugin installations - Custom configurations - Uploaded content
10.2 Database Backup¶
MySQL/MariaDB Backup:
# Basic database backup
mysqldump -u pulselms_user -p pulselms_db > pulselms_backup_$(date +%Y%m%d).sql
# Compressed backup
mysqldump -u pulselms_user -p pulselms_db | gzip > pulselms_backup_$(date +%Y%m%d).sql.gz
# With additional options for reliability
mysqldump -u pulselms_user -p \
--single-transaction \
--quick \
--lock-tables=false \
--routines \
--triggers \
pulselms_db > pulselms_backup_$(date +%Y%m%d).sql
PostgreSQL Backup:
# Basic database backup
pg_dump -U pulselms_user pulselms_db > pulselms_backup_$(date +%Y%m%d).sql
# Compressed backup
pg_dump -U pulselms_user pulselms_db | gzip > pulselms_backup_$(date +%Y%m%d).sql.gz
# Custom format for faster restore
pg_dump -U pulselms_user -Fc pulselms_db > pulselms_backup_$(date +%Y%m%d).dump
10.3 File System Backup¶
PulseLMS Data Directory:
# Backup PulseLMS data directory
tar -czf pulselmsdata_$(date +%Y%m%d).tar.gz /var/www/pulselmsdata/
# Backup with progress indicator
tar -czvf pulselmsdata_$(date +%Y%m%d).tar.gz /var/www/pulselmsdata/ 2>&1 | \
pv -l > /dev/null
# Incremental backup using rsync
rsync -av --delete /var/www/pulselmsdata/ /backup/pulselmsdata/
Code Directory:
# Backup PulseLMS code (including plugins)
tar -czf pulselms_code_$(date +%Y%m%d).tar.gz /var/www/html/pulselms/
# Exclude unnecessary directories
tar -czf pulselms_code_$(date +%Y%m%d).tar.gz \
--exclude='*.log' \
--exclude='cache' \
/var/www/html/pulselms/
10.4 Complete Site Backup Script¶
#!/bin/bash
# complete_backup.sh - Full PulseLMS site backup
# Configuration
BACKUP_DIR="/var/backups/pulselms"
DATE=$(date +%Y%m%d_%H%M%S)
PULSELMSDATA="/var/www/pulselmsdata"
PULSELMS_DIR="/var/www/html/pulselms"
DB_USER="pulselms_user"
DB_NAME="pulselms_db"
DB_PASS="your_password" # Consider using .my.cnf instead
RETENTION_DAYS=30
# Create backup directory
mkdir -p "$BACKUP_DIR/$DATE"
cd "$BACKUP_DIR/$DATE"
# Enable maintenance mode
sudo -u www-data php "$PULSELMS_DIR/admin/cli/maintenance.php" --enable
# Backup database
echo "Backing up database..."
mysqldump -u "$DB_USER" -p"$DB_PASS" \
--single-transaction \
--quick \
"$DB_NAME" | gzip > database_$DATE.sql.gz
# Backup PulseLMS data
echo "Backing up PulseLMS data..."
tar -czf pulselmsdata_$DATE.tar.gz "$PULSELMSDATA"
# Backup code (optional - usually in version control)
echo "Backing up code..."
tar -czf code_$DATE.tar.gz "$PULSELMS_DIR"
# Backup config file
cp "$PULSELMS_DIR/config.php" config_$DATE.php
# Disable maintenance mode
sudo -u www-data php "$PULSELMS_DIR/admin/cli/maintenance.php" --disable
# Create backup manifest
echo "Creating manifest..."
cat > manifest.txt << EOF
PulseLMS Complete Backup
========================
Date: $(date)
Database: database_$DATE.sql.gz
Data: pulselmsdata_$DATE.tar.gz
Code: code_$DATE.tar.gz
Config: config_$DATE.php
Checksums:
$(md5sum *)
EOF
# Clean up old backups
echo "Cleaning up old backups..."
find "$BACKUP_DIR" -maxdepth 1 -type d -mtime +$RETENTION_DAYS -exec rm -rf {} \;
echo "Backup complete: $BACKUP_DIR/$DATE"
10.5 Automated Site Backup with Cron¶
# /etc/cron.d/pulselms_backup
# Daily incremental backup at 2 AM
0 2 * * * root /usr/local/bin/pulselms_incremental_backup.sh >> /var/log/pulselms_backup.log 2>&1
# Weekly full backup on Sunday at 3 AM
0 3 * * 0 root /usr/local/bin/pulselms_full_backup.sh >> /var/log/pulselms_backup.log 2>&1
# Monthly archive on 1st at 4 AM
0 4 1 * * root /usr/local/bin/pulselms_archive_backup.sh >> /var/log/pulselms_backup.log 2>&1
10.6 Site Restoration¶
Full Site Restore Process:
#!/bin/bash
# restore_site.sh - Restore PulseLMS from backup
BACKUP_DIR="/var/backups/pulselms/20250115_020000"
PULSELMSDATA="/var/www/pulselmsdata"
PULSELMS_DIR="/var/www/html/pulselms"
DB_USER="pulselms_user"
DB_NAME="pulselms_db"
# Stop web server
sudo systemctl stop apache2
# Restore database
echo "Restoring database..."
gunzip < "$BACKUP_DIR/database_*.sql.gz" | mysql -u "$DB_USER" -p "$DB_NAME"
# Restore PulseLMS data
echo "Restoring PulseLMS data..."
rm -rf "$PULSELMSDATA"
tar -xzf "$BACKUP_DIR/pulselmsdata_*.tar.gz" -C /
# Restore code (if needed)
echo "Restoring code..."
rm -rf "$PULSELMS_DIR"
tar -xzf "$BACKUP_DIR/code_*.tar.gz" -C /
# Restore config
cp "$BACKUP_DIR/config_*.php" "$PULSELMS_DIR/config.php"
# Fix permissions
chown -R www-data:www-data "$PULSELMSDATA"
chown -R www-data:www-data "$PULSELMS_DIR"
# Clear cache
sudo -u www-data php "$PULSELMS_DIR/admin/cli/purge_caches.php"
# Start web server
sudo systemctl start apache2
echo "Restoration complete"
10.7 Cloud Backup Integration¶
AWS S3 Backup:
#!/bin/bash
# s3_backup.sh - Backup to AWS S3
BACKUP_DIR="/var/backups/pulselms"
S3_BUCKET="s3://your-pulselms-backups"
DATE=$(date +%Y%m%d)
# Sync backups to S3
aws s3 sync "$BACKUP_DIR" "$S3_BUCKET" \
--delete \
--storage-class STANDARD_IA \
--exclude "*.log"
# Lifecycle policy handles old backup deletion
Google Cloud Storage:
#!/bin/bash
# gcs_backup.sh - Backup to Google Cloud Storage
BACKUP_DIR="/var/backups/pulselms"
GCS_BUCKET="gs://your-pulselms-backups"
DATE=$(date +%Y%m%d)
# Sync backups to GCS
gsutil -m rsync -r -d "$BACKUP_DIR" "$GCS_BUCKET"
10.8 Backup Verification¶
Verify Backup Integrity:
#!/bin/bash
# verify_backup.sh - Verify backup integrity
BACKUP_FILE="$1"
echo "Verifying backup: $BACKUP_FILE"
# Check file exists
if [ ! -f "$BACKUP_FILE" ]; then
echo "ERROR: Backup file not found"
exit 1
fi
# Check gzip integrity
if [[ "$BACKUP_FILE" == *.gz ]]; then
if gzip -t "$BACKUP_FILE" 2>/dev/null; then
echo "GZIP integrity: OK"
else
echo "ERROR: GZIP integrity check failed"
exit 1
fi
fi
# Check tar integrity
if [[ "$BACKUP_FILE" == *.tar.gz ]]; then
if tar -tzf "$BACKUP_FILE" >/dev/null 2>&1; then
echo "TAR integrity: OK"
else
echo "ERROR: TAR integrity check failed"
exit 1
fi
fi
# Check SQL dump
if [[ "$BACKUP_FILE" == *.sql.gz ]]; then
# Quick check for valid SQL
if gunzip -c "$BACKUP_FILE" | head -1 | grep -q "MySQL\|PostgreSQL\|-- "; then
echo "SQL format: OK"
else
echo "WARNING: SQL format may be incorrect"
fi
fi
echo "Verification complete"
10.9 Disaster Recovery Planning¶
Recovery Time Objectives:
| Scenario | RTO Target | Recovery Method |
|---|---|---|
| Single course corruption | 1 hour | Course restore from backup |
| Database corruption | 4 hours | Database restore |
| Server failure | 8 hours | Full site restore |
| Data center failure | 24 hours | Offsite backup restore |
Disaster Recovery Checklist:
Disaster Recovery Preparation:
☐ Documented recovery procedures
☐ Tested recovery in staging environment
☐ Offsite backup copies verified
☐ Recovery team contact information
☐ Service provider support contacts
☐ Communication plan for users
☐ Alternative access arrangements
☐ Regular DR drills scheduled
10.10 Backup Monitoring and Alerts¶
Monitoring Script:
#!/bin/bash
# monitor_backups.sh - Check backup status
BACKUP_DIR="/var/backups/pulselms"
ALERT_EMAIL="[email protected]"
MAX_AGE_HOURS=26 # Alert if backup older than 26 hours
# Find most recent backup
LATEST=$(find "$BACKUP_DIR" -name "*.sql.gz" -type f -printf '%T+ %p\n' | sort -r | head -1)
if [ -z "$LATEST" ]; then
echo "CRITICAL: No backup files found" | mail -s "PulseLMS Backup CRITICAL" "$ALERT_EMAIL"
exit 2
fi
# Check age
LATEST_FILE=$(echo "$LATEST" | cut -d' ' -f2)
AGE_SECONDS=$(( $(date +%s) - $(stat -c %Y "$LATEST_FILE") ))
AGE_HOURS=$(( AGE_SECONDS / 3600 ))
if [ $AGE_HOURS -gt $MAX_AGE_HOURS ]; then
echo "WARNING: Latest backup is $AGE_HOURS hours old" | mail -s "PulseLMS Backup Warning" "$ALERT_EMAIL"
exit 1
fi
echo "OK: Latest backup is $AGE_HOURS hours old"
exit 0
Quick Reference¶
Backup Commands Summary¶
| Action | Web Interface | CLI Command |
|---|---|---|
| Course backup | Course > Backup | php admin/cli/backup.php --courseid=X |
| Automated backup | Site admin > Backups | php admin/cli/automated_backups.php |
| Database backup | N/A | mysqldump -u user -p db > backup.sql |
| File backup | N/A | tar -czf backup.tar.gz /path |
| Restore course | Course > Restore | php admin/cli/restore_backup.php |
Troubleshooting Quick Reference¶
| Issue | Quick Fix |
|---|---|
| Backup timeout | Use CLI, increase PHP timeout |
| Memory error | Increase memory_limit |
| Disk space | Clear temp files, old backups |
| Large backup | Exclude user data, split backup |
| Corrupt backup | Verify integrity, use latest good backup |
Best Practices Summary¶
- Regular Backups: Weekly minimum, daily for active courses
- Test Restores: Quarterly in staging environment
- Offsite Storage: Cloud or remote location
- Documentation: Maintain current procedures
- Monitoring: Automated checks and alerts
- Security: Encrypt backups with user data
- Retention: Follow organizational policy
- Verification: Check backup integrity regularly
Additional Resources¶
- PulseLMS Administration Guide: Site management procedures
- PulseLMS Security Guide: Data protection guidelines
- System Requirements: Server configuration reference
- Plugin Management: Backup considerations for plugins
This documentation is for PulseLMS. For the latest updates and additional resources, consult your system administrator.