Backups
Schedule dPanel backups, upload them to remote storage, and restore them.
dPanel includes a built-in backup command:
php artisan serverpanel:backup
What gets backed up
- Database
- SQLite: copies the
.sqlitefile - MySQL/MariaDB: creates
.sqldump usingmysqldump - PostgreSQL: creates
.sqldump usingpg_dump
- SQLite: copies the
- Application data zip (
app-data.zip).envstorage/app(exceptstorage/app/backups)database/database.sqlite(if exists)
Backup files are saved in:
storage/app/backups/YYYYmmdd_HHMMSS/
Every full (--only=all) run also creates a portable archive named like:
backup-MM.DD.YYYY_HH-MM-SS_dpanel.tar.gz
The archive follows the familiar cPanel account-backup layout:
homedir/app-data.zip— panel environment and persistent application datamysql/database-*.sql(or.sqlite) — the panel databasemeta/manifest.json— format version, source details, sizes and SHA-256 checksums
This is a cPanel-style dPanel migration package, not a claim that WHM can import it as a native cPanel account. The explicit layout and versioned manifest keep restores deterministic across dPanel servers.
The web UI starts backups through the authenticated dRust endpoint (POST /api/v1/backup/run). dRust uses the explicit CLI binary configured by DRUST_PHP_CLI (default /usr/bin/php); it never reuses PHP-FPM's PHP_BINARY.
Old backups are auto-deleted based on BACKUP_RETENTION_DAYS.
Environment variables
Set these values in .env:
BACKUP_TIME=02:30
BACKUP_SCHEDULE_ENABLED=true
BACKUP_RETENTION_DAYS=7
MYSQLDUMP_PATH=mysqldump
PG_DUMP_PATH=pg_dump
BACKUP_REMOTE_UPLOAD_ENABLED=false
BACKUP_REMOTE_HOST=
BACKUP_REMOTE_PORT=22
BACKUP_REMOTE_USER=
BACKUP_REMOTE_PATH=
BACKUP_REMOTE_SSH_KEY_PATH=
BACKUP_REMOTE_STRICT_HOST_CHECKING=true
BACKUP_REMOTE_SSH_PATH=ssh
BACKUP_REMOTE_SCP_PATH=scp
Notes:
- If
mysqldumporpg_dumpis not in PATH, set full path. - Windows WAMP example:
MYSQLDUMP_PATH=C:\wamp64\bin\mysql\mysql8.0.31\bin\mysqldump.exe
- If remote upload is enabled,
sshandscpmust be available.
Run backup manually
php artisan serverpanel:backup
Only database:
php artisan serverpanel:backup --only=db
Only files:
php artisan serverpanel:backup --only=files
Restore on a new dPanel server
Install the same or a newer compatible dPanel release on the destination, copy the full backup-*.tar.gz file there, then validate it first:
php artisan serverpanel:restore /path/to/backup-*.tar.gz --dry-run
After the validation succeeds, put the panel in maintenance mode and restore:
php artisan down
php artisan serverpanel:restore /path/to/backup-file.tar.gz --force
php artisan up
Restore rejects absolute/traversal paths, verifies every manifest checksum, and refuses to modify data unless --force is supplied. It restores into the destination's currently configured database. Review .env, DNS, SSL, IP addresses, filesystem ownership and service configuration before switching production traffic.
Use from panel UI
- Open:
/backups - Run on-demand backup:
All (DB + Files)Database OnlyFiles Only
- Download single backup artifacts from each run row.
- Delete a single run folder from the same page.
- GUI control is available in Backup Settings block:
- Enable/disable backup schedule
- Set daily backup time
- Set retention days
- Enable/disable remote auto-upload
- Configure remote host/user/path/port and SSH/SCP paths
Daily automation
Laravel scheduler is already configured in routes/console.php:
- Runs daily at
BACKUP_TIME.
You must run Laravel scheduler every minute from OS scheduler.
Linux cron
* * * * * cd /path/to/ServerPanel && php artisan schedule:run >> /dev/null 2>&1
Windows Task Scheduler
Create a task that runs every 1 minute:
Program:
C:\wamp64\bin\php\php8.x.x\php.exe
Arguments:
artisan schedule:run
Start in:
D:\wamp64\www\ServerInstaller\ServerPanel
Note:
- If schedule is disabled from GUI,
schedule:runstill executes but backup task is skipped.
Verify
- Run:
php artisan serverpanel:backup
- Check folder:
storage/app/backups
- Test scheduler:
php artisan schedule:list
Configure another server
- Copy project and
.envto the new server. - Set correct PHP/DB backup binaries in
.env:MYSQLDUMP_PATHPG_DUMP_PATH
- Set retention and time:
BACKUP_RETENTION_DAYS=7BACKUP_TIME=02:30
- Ensure write permission:
storage/app/backups
- Run once manually:
php artisan serverpanel:backup --only=all
- Configure scheduler:
- Linux cron or Windows Task Scheduler to run
php artisan schedule:runevery minute.
- Linux cron or Windows Task Scheduler to run
- Open
/backupsand verify new run is listed and downloadable.
Enable automatic upload to another server
- In
.env, set:BACKUP_REMOTE_UPLOAD_ENABLED=trueBACKUP_REMOTE_HOST=<target-host>BACKUP_REMOTE_PORT=22BACKUP_REMOTE_USER=<ssh-user>BACKUP_REMOTE_PATH=/remote/backup/path- Optional key:
BACKUP_REMOTE_SSH_KEY_PATH=/path/to/private/key
- Keep host checking enabled for production:
BACKUP_REMOTE_STRICT_HOST_CHECKING=true
- Test manually:
php artisan serverpanel:backup --only=all
- Verify remote folder:
<BACKUP_REMOTE_PATH>/YYYYmmdd_HHMMSS/
- Open
/backupspage:- It now shows schedule status and remote upload status.
If upload fails, the command returns failed status and prints SSH/SCP error output.
Recommended GUI-first configuration
- Open
/backups. - In Backup Settings:
- Turn on
Enable daily backup schedule. - Set
Daily TimeandRetention Days. - Turn on
Enable auto-upload to remote server after backup(if needed). - Fill
Remote Host,Remote User,Remote Path,Remote Port.
- Turn on
- Click
Save Backup Settings. - Run
Run Backup Nowonce to test both backup and upload.
Questions & comments (0)