mirror of
https://github.com/taogaetz/chefbible.git
synced 2025-12-06 11:47:24 -05:00
2.5 KiB
2.5 KiB
ChefBible Database Management
Easy backup and restore for your recipes using the db-manager.sh script.
Quick Start
1. Setup (One-time)
# Create the data directory on your server
sudo mkdir -p /home/chefbible/data
sudo chown 1001:1001 /home/chefbible/data
sudo chmod 755 /home/chefbible/data
2. Before Updating Your App
# Create a backup
./db-manager.sh backup
3. After Updating (if data is lost)
# Restore from the latest backup
./db-manager.sh restore
Available Commands
| Command | Description | Example |
|---|---|---|
backup |
Create a backup of the database | ./db-manager.sh backup |
restore |
Restore from the most recent backup | ./db-manager.sh restore |
list |
List all available backups | ./db-manager.sh list |
status |
Show current database status | ./db-manager.sh status |
help |
Show help message | ./db-manager.sh help |
Typical Workflow
Before App Updates:
# 1. Check current status
./db-manager.sh status
# 2. Create backup
./db-manager.sh backup
# 3. Update your app in Portainer
# (Your data should be preserved, but backup is safety net)
If Data Gets Lost:
# 1. Check available backups
./db-manager.sh list
# 2. Restore from latest backup
./db-manager.sh restore
# 3. Restart your container in Portainer
Backup Storage
- Location:
/home/chefbible/backups/ - Format:
chefbible_backup_YYYYMMDD_HHMMSS.db - Retention: Keeps last 5 backups automatically
- Size: Typically 1-10MB per backup
Troubleshooting
Permission Issues
# If you get permission errors, run with sudo:
sudo ./db-manager.sh backup
sudo ./db-manager.sh restore
Container Not Found
# If container name is different, edit the script:
# Change CONTAINER_NAME="chefbible" to your actual container name
Database Path Issues
# Check if the database path exists:
ls -la /home/chefbible/data/
Safety Features
✅ Automatic cleanup - Keeps only last 5 backups
✅ Size reporting - Shows backup sizes
✅ Status checking - Verifies database and container state
✅ Error handling - Clear error messages and suggestions
✅ Color output - Easy to read status messages
Pro Tips
- Always backup before major updates
- Test restore process on a test environment first
- Keep backups in a separate location for extra safety
- Monitor backup sizes - large backups might indicate issues