Backup Procedures
Nguhöe EHR uses Spatie Laravel Backup for automated backup management.Backup Configuration
The backup system is configured inconfig/backup.php. Key settings:
- Backup includes: Application files (excluding vendor, node_modules) and database
- Backup destination: Local disk by default (configurable for S3, FTP, etc.)
- Database: Configured connection (MySQL, PostgreSQL, or SQLite)
- Encryption: Optional password protection for backup archives
Manual Backup
Create a backup manually:Automated Backup Schedule
Backups are automatically scheduled. Verify inapp/Console/Kernel.php or routes/console.php:
Backup Retention Policy
Default retention (configured inconfig/backup.php):
- All backups: Keep for 7 days
- Daily backups: Keep for 16 days
- Weekly backups: Keep for 8 weeks
- Monthly backups: Keep for 4 months
- Yearly backups: Keep for 2 years
Backup to Cloud Storage
Configure S3 or other cloud storage inconfig/filesystems.php, then update config/backup.php:
.env:
Backup Encryption
Enable password protection in.env:
Monitoring Backup Health
Check backup status:Restore from Backup
Backup Notifications
Configure email notifications for backup events inconfig/backup.php:
Update Procedures
Before Updating
- Create a full backup
- Review changelog for breaking changes
- Test in staging environment if available
- Schedule maintenance window for production
Update Process
Security Updates
For critical security updates:Rolling Back Updates
If an update fails:Database Maintenance
Database Optimization
Database Size Monitoring
Clean Old Sessions
If using database sessions, clean expired sessions periodically:Prune Old Records
Laravel 12 includes model pruning for cleaning old data:Log Management
Nguhöe EHR uses Laravel 12’s logging system with optional Laravel Pail for development.Log Location
Log Rotation
Configure logrotate to prevent logs from filling disk space. Create/etc/logrotate.d/nguhoe:
Monitoring Logs for Errors
Laravel Pail (Development)
In development, use Laravel Pail for real-time log viewing:composer run dev but should not be used in production.
Centralized Logging
For production, consider centralized logging:- Sentry: Error tracking and monitoring
- Papertrail: Cloud-hosted log management
- ELK Stack: Elasticsearch, Logstash, Kibana
- Graylog: Open-source log management
Queue Monitoring
Check Queue Status
Failed Jobs
Queue Worker Management
Queue Performance
Monitor queue processing times:Health Checks
Application Health
System Health
Automated Health Monitoring
Create a health check endpoint inroutes/web.php:
- UptimeRobot
- Pingdom
- StatusCake
- Nagios
Performance Monitoring
Enable Query Logging (Development Only)
Identify Slow Queries
Cache Monitoring
Application Performance Monitoring (APM)
Consider using:- Laravel Telescope: Development debugging
- New Relic: Full-stack monitoring
- Datadog: Infrastructure and APM
- Blackfire.io: PHP profiling
Troubleshooting Common Issues
Issue: 500 Internal Server Error
Diagnosis:.envfile missing or misconfigured- File permission issues
- Missing APP_KEY
- Database connection failure
Issue: Queue Jobs Not Processing
Diagnosis:Issue: High Memory Usage
Diagnosis:- Reduce number of queue workers
- Optimize database queries (use eager loading)
- Increase server RAM
- Enable OPcache
- Clear unused caches
Issue: Slow Page Loads
Diagnosis:- Use eager loading:
User::with('roles')->get() - Implement caching for expensive queries
- Optimize images and assets
- Enable OPcache and browser caching
- Use CDN for static assets
Issue: Database Connection Failed
Diagnosis:Issue: Assets Not Loading (404)
Diagnosis:Issue: Session Lost/Users Logged Out
Diagnosis:- Check session driver configuration
- Verify session table exists (if using database sessions)
Maintenance Mode
Enable Maintenance Mode
Disable Maintenance Mode
Custom Maintenance Page
Createresources/views/errors/503.blade.php for a custom maintenance page.
Monitoring Checklist
Regular monitoring tasks: Daily:- Check error logs for critical issues
- Verify backup completion
- Monitor disk space usage
- Check queue workers are running
- Review failed jobs
- Check database size and performance
- Audit security logs
- Test backup restoration (sample)
- Update dependencies (security patches)
- Review user access and permissions
- Optimize database tables
- Review and clean old logs
- Check SSL certificate expiration
- Full backup restoration test
- Security audit
- Performance review and optimization
- Update documentation
Emergency Contacts
Maintain a contact list for emergencies:- System Administrator: [contact info]
- Database Administrator: [contact info]
- Application Developer: [contact info]
- Hosting Provider Support: [contact info]
- Security Team: [contact info]