Repository navigation
Backup and Restore
🌐 Language: EN · DE · FR · ES · TR · EL
Your data (trips, charging history, logbook, settings) lives in SQLite databases on your server. Regular backups protect against hardware failure, accidental deletion, or migration to a new server.
| Data | Location | Size (typical) |
|---|---|---|
| Master database | /app/data/master.db |
~1 MB |
| Tenant databases | /app/data/tenants/*.db |
~50 MB per tenant (3 years) |
| Environment config | /opt/tesla-carview/backend/.env |
Tiny |
| SSL certificate | /etc/letsencrypt/ |
Tiny |
The Docker images and app code don't need backing up — they can be re-downloaded from GitHub at any time.
Tesla Carview has a built-in backup feature:
- Go to Admin → Data → Backup
- Click Download Backup
- A JSON file is downloaded containing all 25 database tables
- Save it somewhere safe (external drive, cloud storage, different device)
Restore from backup:
- Go to Admin → Data → Restore
- Upload the backup JSON file
- Type the confirmation phrase
RESTORE - The restore completes in seconds
- A safety backup of the current data is made automatically before restoring
For hands-off backups, create a cron job that saves a copy daily:
# Create backup directory
mkdir -p /opt/backups/tesla-carview
# Create backup script
cat > /opt/backups/backup-tesla.sh << 'EOF'
#!/bin/bash
DATE=$(date +%Y%m%d-%H%M)
BACKUP_DIR="/opt/backups/tesla-carview"
DATA_DIR="/var/lib/docker/volumes/tesla_data/_data"
# Copy databases
cp "$DATA_DIR/master.db" "$BACKUP_DIR/master-$DATE.db"
cp -r "$DATA_DIR/tenants" "$BACKUP_DIR/tenants-$DATE/"
cp "/opt/tesla-carview/backend/.env" "$BACKUP_DIR/env-$DATE.bak"
# Keep only last 14 days
find "$BACKUP_DIR" -name "*.db" -mtime +14 -delete
find "$BACKUP_DIR" -name "*.bak" -mtime +14 -delete
find "$BACKUP_DIR" -type d -name "tenants-*" -mtime +14 -exec rm -rf {} +
echo "Backup done: $DATE"
EOF
chmod +x /opt/backups/backup-tesla.sh
# Add to cron (runs daily at 2 AM)
echo "0 2 * * * root /opt/backups/backup-tesla.sh >> /var/log/tesla-backup.log 2>&1" > /etc/cron.d/tesla-backupA backup on the same server doesn't protect against server failure. Copy backups offsite:
# Add to your backup script:
rsync -az /opt/backups/tesla-carview/ user@nas-ip:/backups/tesla-carview/# Add to your backup script:
rsync -az /opt/backups/tesla-carview/ your-storagebox.your-storagebox.de:/backups/# Install rclone (supports most cloud providers):
curl https://rclone.org/install.sh | sudo bash
rclone config # Interactive setup for your cloud provider
# Add to backup script:
rclone sync /opt/backups/tesla-carview/ backblaze:my-bucket/tesla-carview/When moving to a new server (hardware upgrade, VPS change):
- On the old server: Download a full backup via Admin → Data → Backup
-
On the new server: Run the setup script:
curl -fsSL https://raw.githubusercontent.com/KnevS/Tesla-Carview/main/deploy/setup.sh | bash - Log in to the new installation
- Go to Admin → Data → Restore → upload the backup
- Update your DNS record to point to the new server IP
- Update the Tesla Developer Portal's Redirect URI if your domain changed
Tesla Carview runs an automatic maintenance task every night at 03:30 (Berlin timezone):
- Removes expired tokens and orphaned records
- WAL checkpoint (SQLite optimization)
- VACUUM — reclaims disk space if a database is over 50 MB
- If
AUTO_UPDATE_ENABLED=true: pulls latest code and restarts
You can trigger it manually:
- Admin → System → Run Maintenance Now
Or view the maintenance log:
- Admin → System → Maintenance Log
- 3-2-1 rule: 3 copies, 2 different storage types, 1 offsite
- Test your backups by actually restoring one (use the Admin → Restore test feature)
- Store your
.envfile backup separately and securely (it contains credentials) - Back up before any major update or configuration change
🇬🇧 Home · Installation · Troubleshooting · License | 🇩🇪 Startseite · Installation · Fehlerbehebung | 🇫🇷 Accueil | 🇪🇸 Inicio | 🇹🇷 Ana Sayfa | 🇬🇷 Αρχική
GitHub Repository · Report an Issue
Tesla Carview — non-commercial, self-hosted Tesla data logger · © Sven Krische
🇬🇧 English
🚀 Getting Started
🌐 Network & Infrastructure
⚙️ Configuration
🔐 Security
📱 Reference
🇩🇪 Deutsch
🚀 Einstieg
🌐 Netzwerk & Infrastruktur
⚙️ Konfiguration
🔐 Sicherheit
📱 Referenz
🇫🇷 Français
🚀 Démarrage
🌐 Réseau & Infrastructure
⚙️ Configuration
🔐 Sécurité
📱 Référence
🇪🇸 Español
🚀 Primeros pasos
🌐 Red & Infraestructura
⚙️ Configuración
🔐 Seguridad
📱 Referencia
🇹🇷 Türkçe
🚀 Başlarken
🌐 Ağ & Altyapı
⚙️ Yapılandırma
🔐 Güvenlik
📱 Başvuru