DataPower Backup Examples

CLI:

# Create non-secure backup including all the domains starting with "dpbuddy". Don't fail if no matching domain is found
dpbuddy backup -file backups/backup.zip -domainPatterns "dpbuddy.*" -failIfNoDomain false
# Restore the backup into our DR appliance
dpbuddy restore -file backups/backup.zip -env dr
# Create secure backup in the directory specified in dpDir and then download
# the backup files to toDir
dpbuddy secureBackup -cert dp-backup -toDir testfiles/sbackup -appendTimestamp
# Create backups of multiple devices
dpbuddy secureBackup -cert dp-backup -toDir 'testfiles/${dpEnv}/sbackup' -appendTimestamp -env "dev,test"
# Create another secure backup that we will subsequently restore
dpbuddy secureBackup -cert dp-backup -toDir sbackups/sync
# Perform secure restore of the DR appliance
dpbuddy secureRestore -cred dp-restore -dir sbackups/sync -waitForReboot -env dr

Ant:

<project name="dpbuddy.samples.backup" basedir="." xmlns:dp="antlib:com.myarch.dpbuddy" >

    <description>
        Samples demonstrating DataPower backup/restore using DPBuddy
    </description>

    <!-- Backup a domain or multiple domains
     All objects and files are backed up, but not users and certs -->
    <target name="backup" description="Backup one or multiple domains">
        <!-- Backup domains that match 'domainPatterns'. To backup all domains, simply use '.*'
        Here we're backing up all domains that start with 'dpbuddy' -->
        <!-- failIfNoDomain is set to false so if there is no matching domain, the task won't fail -->
        <dp:backup file="backups/backup.zip" domainPatterns="dpbuddy.*" failIfNoDomain="false"  />
    </target>

    <target name="restore" description="Perform the restore of all the domains taken by the backup">
        <dp:restore file="backups/backup.zip" env="dr"  />
    </target>

    <target name="secure.backup" description="Perform secure backup of the entire device">
        <!-- Creates secure backup in the directory specified in dpDir and then downloads
        the files to toDir.
        You can run secure backup for multiple devices using dp.env="device1,device" property.
        Note that we save backups in the directory with the host name of the device.
        if appendTimestamp is set to true, the timestamp will be automatically appended to the directory containing backups
        -->
        <dp:secureBackup cert="dp-backup" toDir="sbackups/${dpUrl}/backup" appendTimestamp="true" includeISCSI="false" includeRAID="false"  />
    </target>

    <target name="secure.backup.for.sync" description="Take secure backup for subsequent syncing of the DR appliance" >
        <dp:secureBackup cert="dp-backup" toDir="sbackups/sync" />
    </target>

    <target name="secure.restore" description="Perform secure restore of the entire device" >
        <!-- we explicitly specify DR environment as the target -->
        <dp:secureRestore cred="dp-restore" dir="sbackups/sync" waitForReboot="true" env="dr"/>
    </target>

    <target name="backup.restore.all" depends="backup, restore, secure.backup, secure.backup.for.sync, secure.restore" />

</project>