SQLite
Configure SQLite databases for backup, both local files and remote via SSH.
Overview
SQLite is a file-based database. DBackup supports two modes:
| Mode | Description |
|---|---|
| Local | SQLite file on the same machine as DBackup |
| SSH | SQLite file on a remote server via SSH |
Configuration
Local Mode
| Field | Description |
|---|---|
| Mode | Select "Local" |
| Path | Absolute path to .sqlite or .db file |
| SQLite Binary | Path to sqlite3 binary (default: sqlite3) |
SSH Mode
| Field | Description |
|---|---|
| Mode | Select "SSH" |
| Host | SSH server hostname |
| Port | SSH port (default: 22) |
| Username | SSH username |
| Auth Type | password, privateKey, or agent |
| Password | SSH password (if using password auth) |
| Private Key | PEM-formatted private key |
| Passphrase | Key passphrase (if encrypted) |
| Path | Remote path to SQLite file |
| SQLite Binary | Remote path to sqlite3 binary |
Local Mode Setup
Docker Configuration
When running DBackup in Docker, mount the SQLite database:
services:
dbackup:
volumes:
- /path/to/app/data.db:/data/app.db:roThen configure the source with path /data/app.db.
Read-Only Mount
Use :ro for read-only access to prevent accidental modifications.
File Permissions
Ensure DBackup can read the file:
chmod 644 /path/to/database.dbSSH Mode Setup
Password Authentication
- Select "SSH" mode
- Enter host, port, username
- Select "Password" auth type
- Enter password
- Enter remote path to SQLite file
SSH Key Authentication
- Select "SSH" mode
- Enter host, port, username
- Select "Private Key" auth type
- Paste your private key (PEM format)
- Enter passphrase if the key is encrypted
Example private key format:
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHI...
-----END OPENSSH PRIVATE KEY-----SSH Agent
For SSH agent forwarding:
- Select "SSH" mode
- Select "Agent" auth type
- Mount SSH agent socket in Docker:
services:
dbackup:
volumes:
- ${SSH_AUTH_SOCK}:/ssh-agent
environment:
- SSH_AUTH_SOCK=/ssh-agentBackup Process
DBackup uses the SQLite .dump command:
sqlite3 /path/to/database.db .dump > backup.sqlThis creates a text file with:
- Schema definitions (
CREATE TABLE) - Data as
INSERTstatements - Indexes and triggers
Backup Safety
The dump command is safe to run on a live database:
- Uses SQLite's built-in transaction handling
- Consistent snapshot of data
- No locking issues with WAL mode
SSH Remote Backup Flow
For SSH mode, the process is:
- Connect to remote server via SSH
- Execute
.dumpcommand remotely - Stream output back to DBackup
- Apply compression/encryption locally
- Upload to storage destination
This means:
- No large file transfers (streaming)
- Remote server needs
sqlite3installed - Bandwidth efficient
Remote File Browser
When configuring SSH mode, you can:
- Click "Browse" to open remote file browser
- Navigate the remote filesystem
- Select the SQLite database file
This helps find the correct path without manual entry.
Troubleshooting
File Not Found
Error: unable to open database fileSolutions:
- Verify the path is correct
- Check file permissions
- For Docker, ensure volume is mounted
SSH Connection Failed
Error: Connection refusedSolutions:
- Check SSH server is running
- Verify port number
- Check firewall rules
- Test with
ssh user@hostmanually
Permission Denied (SSH)
Error: Permission denied (publickey,password)Solutions:
- Verify credentials
- Check SSH key format (must be PEM/OpenSSH)
- Ensure user has shell access
sqlite3 Not Found
Error: sqlite3: command not foundSolutions:
- Install SQLite on the remote server
- Or specify full path in "SQLite Binary" field:
/usr/bin/sqlite3
Restore
Local Restore
- Go to Storage Explorer
- Find your backup file
- Click Restore
- Select target SQLite source
- Choose restore mode:
- Overwrite: Replace entire database
- Clean Slate: Delete file first, then restore
Path Remapping
You can restore to a different path:
- Enable "Remap Path" option
- Enter new destination path
- The backup will be restored to the new location
Best Practices
Use WAL mode for better concurrent access:
sqlPRAGMA journal_mode=WAL;Regular VACUUM before backup for smaller files:
sqlVACUUM;Mount read-only in Docker when possible
SSH key authentication is more secure than passwords
Test restore to verify backup integrity
Enable compression - SQLite dumps compress very well
Consider encryption for sensitive data