.. _Backup: ******************************* Backup and Restore Applications ******************************* ROBIN Storage allows one to: * Backup Apps+Data to an external storage repository such as S3 Object Store, Google Cloud Storage, etc. * Make Apps+Data portable across Kubernetes clusters spanning on-prem, publc and hybrid cloud environments. .. note :: Add backup summary **Topics covered in this chapter:** =========================== ==================================================== ``robin backup create`` Backup an application snapshot to repository ``robin backup delete`` Delete backup of an application snapshot ``robin backup list`` List all backups of an application ``robin backup info`` Show information about a specific backup ``robin backup status`` Show transfer status of backup to repository ``robin backup share`` Share a backup with one or more users ``robin backup unshare`` Stop sharing a backup with one or more users ``robin backup export`` Generate a token for use when importing an application backup into another cluster ``robin backup import`` Import an application backup from another cluster =========================== ==================================================== ----------------- Create App Backup ----------------- A backup of a snapshot can be created using the following command:: $ robin backup create ================ ========================================================= ``name`` | Name to assign to the backup created from the specified snapshot ``snapshotid`` | Unique ID of the snapshot (obtained from the output of ``robin snapshot list``) ``reponame`` | Name of the repo where you the backup will be pushed ================ ========================================================= **Example**:: $ robin backup create backup-init 39f292f85a6611e99bbdb91ac50a0916 datadump Use the ``robin backup list`` command to verify the backup has been succesfully created and pushed to an external repo. $ robin backup list +----------------------------------+--------------+--------------------+--------+ | Backup ID | Backup Name | Snapshot Name | State | +----------------------------------+--------------+--------------------+--------+ | a722a81e5a6811e9befabdcd54699900 | backup-mysql | mysql-1_snap-mysql | Pushed | | ebc453b45a6611e99876835407ddf3c4 | backup-init | mydb_snap-init | Pushed | +----------------------------------+--------------+--------------------+--------+ .. note:: The ability to create a backup is subject to ROBIN Role Based Access Control (RBAC). By default, all Cluster Users (users having the clusteruser role) have permission to create backups, provided they can access the underlying App snapshot. Cluster Administrators (users having the clusteradmin role) have permission to create backups from all App snapshots. See the section on :ref:`UserManagement` for details on how ROBIN RBAC works. Before creating a backup, the underlying App must have been attached to the target repo. ----------------- Delete App Backup ----------------- An Application backup can be deleted using the following command:: $ robin backup delete [--repo-purge] [--catalog-purge] [--force] =================== ========================================================= ``backupid`` | Unique ID of the backup (obtained from the output of ``robin backup list``) ``--repo-purge`` | Purge the backup from repo catalog and external repo ``--catalog-purge`` | Purge backup from the repo catalog only ``--force`` | Force removal of an application backup from the storage repo catalog and storage repo (required when the ``--repo-purge`` option is specified). =================== ========================================================= Following are a number of examples showing the various backup delete scenarios. Except when including the ``--repo-purge`` option, use the ``robin backup list`` command to verify the status of the backup after the completion of the delete operation. **Example 1: Delete the local copy of a backup**:: $ robin backup delete ebc453b45a6611e99876835407ddf3c4 $ robin backup list +----------------------------------+--------------+--------------------+-----------------+ | Backup ID | Backup Name | Snapshot Name | State | +----------------------------------+--------------+--------------------+-----------------+ | ebc453b45a6611e99876835407ddf3c4 | backup-mysql | mysql-1_snap-mysql | Deleted Locally | +----------------------------------+--------------+--------------------+-----------------+ **Example 2: Delete the local copy of a backup and purge it fro the repo catalog**:: Delete the local copy of a backup, but leave it in the repo catalog: $ robin backup delete ebc453b45a6611e99876835407ddf3c4 --catalog-purge $ robin backup list +----------------------------------+--------------+--------------------+-----------------+ | Backup ID | Backup Name | Snapshot Name | State | +----------------------------------+--------------+--------------------+-----------------+ +----------------------------------+--------------+--------------------+-----------------+ **Example 3: Delete the local copy of a backup and purge it fro the repo catalog and external repo**:: $ robin backup delete ebc453b45a6611e99876835407ddf3c4 --repo-purge There is no way to verify that the backup remains in the external repo since it was purged from the repo catalog. .. note:: The ability to delete a backup is subject to ROBIN Role Based Access Control (RBAC). By default, all Cluster Users (users having the clusteruser role) have permission to delete from local storage any backups they have created. They do not have permission, however, to purge backups from the repo. Cluster Administrators (users having the clusteradmin role), on the other hand, have permission to delete all backups as well as purge backups from a repo catalog and the external repo. All backups that have been pushed to a repo (which is to say, all backups), can be viewd using the ``robin backup list`` command. The ``robin repo contents`` command also provides informaton about backups that have been pushed to a repo. This command, however, can only be invoked by Cluster Administrators (users having the clusteradmin role). ---------------- List App Backups ---------------- Backups for snapshots are listed using the following command:: $ robin backup list [--app ] =================== ========================================================= ``--app `` | Only show backups for the specified application are displayed ``--wide`` | Provide additional informatoin about each backup ``--full`` | Same output as the ``--wide`` option, plus include which users the backup has been shared with =================== ========================================================= **Example 1: List backups of a specific app**:: $ robin backup list --app mydb +----------------------------------+-------------+----------------+--------+ | Backup ID | Backup Name | Snapshot Name | State | +----------------------------------+-------------+----------------+--------+ | ebc453b45a6611e99876835407ddf3c4 | backup-init | mydb_snap-init | Pushed | +----------------------------------+-------------+----------------+--------+ **Example 2: List all backups**:: $ robin backup list +----------------------------------+--------------+--------------------+--------+ | Backup ID | Backup Name | Snapshot Name | State | +----------------------------------+--------------+--------------------+--------+ | ebc453b45a6611e99876835407ddf3c4 | backup-init | mydb_snap-init | Pushed | | a722a81e5a6811e9befabdcd54699900 | backup-mysql | mysql-1_snap-mysql | Pushed | +----------------------------------+--------------+--------------------+--------+ .. note:: The ability to view backups is subject to ROBIN Role Based Access Control (RBAC). By default, Cluster Users (users having the clusteruser role) are able to view all backups they have created, pluss any that have been shared with them (see :ref:`ShareAppBackup` for details). See the section on :ref:`UserManagement` for details on how ROBIN RBAC works. ------------------------------------------- Get Information About a Specific App Backup ------------------------------------------- Details of a specific backup can be obtained using the following command:: $ robin backup info ==================== =================================================================================== ``backupid`` | Unique ID of the backup (obtained from the output of ``robin backup list``) ==================== =================================================================================== **Example**:: $ robin backup info ebc453b45a6611e99876835407ddf3c4 Name : backup-init Id : ebc453b45a6611e99876835407ddf3c4 Snapshot Name : mydb_snap-init Application Name : mydb Application Kind : helm State : Pushed Repo : datadump Description : - Start Time : 08 Apr 2019 18:29:30 End Time : 08 Apr 2019 18:29:37 Trigger Details ------- Operation : MANUAL User : robin Tenant : Administrators Data Details ------- Transferred : 96.0 MB Skipped : 0.0 MB Total : 96.0 MB Time Taken : 7s .. note:: The ability to view information about a backup is subject to ROBIN Role Based Access Control (RBAC). By default, Cluster Users (users having the clusteruser role) are able to view info for all backups they have created, pluss any that have been shared with them (see :ref:`ShareAppBackup` for details). See the section on :ref:`UserManagement` for details on how ROBIN RBAC works. Information about the local application will only be included in the output if the applicaton still exists. This information will never be displayed for backups which are imported from another ROBIN cluster. ---------------------------- Monitor Status of App Backup ---------------------------- The status of transfers of backups to their respective repositories can be viewed using the following command:: $ robin backup status **Example**:: $ robin backup status +-------------+----------------------------------+-----------------+ | Name | TransferStatus | Schedule/Manual | +-------------+----------------------------------+-----------------+ | backup-init | 9% [###.................] 96.0MB | MANUAL | +-------------+----------------------------------+-----------------+ After a few seconds. We can run the command again to see: $ robin backup status +-------------+----------------------------------+-----------------+ | Name | TransferStatus | Schedule/Manual | +-------------+----------------------------------+-----------------+ | backup-init | 100% [##################] 96.0MB | MANUAL | +-------------+----------------------------------+-----------------+ .. _ShareAppBackup: ---------------- Share App Backup ---------------- Share an Application backup with one or more users:: $ robin backup share [user_list] [--operations ] [--all-tenant-users] ============================= ========================================================= ``backupid`` | ID of the backup to share ``user_list`` | List of users to share the backup with ``--operations `` | List of operations the user will be allowed to perform or ALL_OPERATIONS (default is ``view``) ``--all-tenant-users`` | Share a backup with all users ============================= ========================================================= **Example**:: $ robin backup share 241e0236783811e9b8726147745c4a77 user1 --operations view $ robin backup list --full +----------------------------------+-------------+----------+--------------------+--------+---------+----------+----------+------------------+-------------+ | Backup ID | Backup Name | Repo | Snapshot Name | State | Managed | App Name | App Type | Owner/Tenant | Description | +----------------------------------+-------------+----------+--------------------+--------+---------+----------+----------+------------------+-------------+ | 241e0236783811e9b8726147745c4a77 | mysql1 | testrepo | mysql1_mysql1-snap | Pushed | True | mysql1 | helm | user1/K8sCluster | None | +----------------------------------+-------------+----------+--------------------+--------+---------+----------+----------+------------------+-------------+ User Shares: user2: view .. note:: The ability to share a backup is subject to ROBIN Role Based Access Control (RBAC). By default, only Cluster Administrators (users having the clusteradmin role) have permission to do so. See the section on :ref:`UserManagement` for details on how ROBIN RBAC works. ------------------ Unshare App Backup ------------------ Stop sharring an Application backup with one or more users:: $ robin backup unshare [user_list] [--operations ] [--all-tenant-users] ============================= ========================================================= ``backupid`` | ID of the backup to stop sharing ``user_list`` | List of users to stop sharing the backup with ``--operations `` | List of operations to stop allowing users to invoke on the shared backup or ALL_OPERATIONS (default is ``view``) ``--all-tenant-users`` | Stop sharing a backup with all users (overrides user_list) ============================= ========================================================= **Example**:: $ robin backup unshare 241e0236783811e9b8726147745c4a77 user1 --operations view .. note:: The ability to unshare a backup is subject to ROBIN Role Based Access Control (RBAC). By default, only Cluster Administrators (users having the clusteradmin role) have permission to do so. See the section on :ref:`UserManagement` for details on how ROBIN RBAC works. ----------------- Export App Backup ----------------- Generate a token for use when importing an application backup into another cluster:: $ robin backup export ============================= ========================================================= ``backupid`` | Application backup ID ============================= ========================================================= **Example**:: $ robin backup list +----------------------------------+-------------+----------+--------------------+--------+ | Backup ID | Backup Name | Repo | Snapshot Name | State | +----------------------------------+-------------+----------+--------------------+--------+ | 644770427d8911e9b908cbe6a78db423 | mysql1 | testrepo | mysql1_mysql1-snap | Pushed | +----------------------------------+-------------+----------+--------------------+--------+ $ robin backup export 644770427d8911e9b908cbe6a78db423 eyJyZXBvX3R5cGUiOiAiR0NTIiwgImJhY2t1cF9pZCI6ICI2NDQ3NzA0MjdkODkxMWU5YjkwOGNiZTZhNzhkYjQyMyIsICJiYWNrdXBfcGF0aCI6ICJkZXYvdGVzdGluZy9hcHBjb25maWcvMTU1ODU5NDE0Ny9teXNxbDFfMS9teXNxbDFfbXlzcWwxLXNuYXAuanNvbiIsICJyZXBvX3BhcmFtcyI6IHsiYnVja2V0IjogInRlc3RidWNrZXQtMTAyOTM4NDc1NiIsICJyZXBvX3R5cGUiOiAiR0NTIiwgInBhdGgiOiAiZGV2L3Rlc3RpbmcvIiwgImNyZWRlbnRpYWxzIjogeyJwcm9qZWN0X2lkIjogInJvY2stcmFuZ2UtMjA3NjIyIn19fQ== .. note:: The ability to export a backup is subject to ROBIN Role Based Access Control (RBAC). By default, only Cluster Administrators (users having the clusteradmin role) have permission to do so. See the section on :ref:`UserManagement` for details on how ROBIN RBAC works. ----------------- Import App Backup ----------------- Import an application backup from another cluster:: $ robin backup import ============================= ========================================================= ``backup_token`` | Token containing details of the backup to import ============================= ========================================================= **Example**:: $ robin backup import eyJyZXBvX3R5cGUiOiAiR0NTIiwgImJhY2t1cF9pZCI6ICI2NDQ3NzA0MjdkODkxMWU5YjkwOGNiZTZhNzhkYjQyMyIsICJiYWNrdXBfcGF0aCI6ICJkZXYvdGVzdGluZy9hcHBjb25maWcvMTU1ODU5NDE0Ny9teXNxbDFfMS9teXNxbDFfbXlzcWwxLXNuYXAuanNvbiIsICJyZXBvX3BhcmFtcyI6IHsiYnVja2V0IjogInRlc3RidWNrZXQtMTAyOTM4NDc1NiIsICJyZXBvX3R5cGUiOiAiR0NTIiwgInBhdGgiOiAiZGV2L3Rlc3RpbmcvIiwgImNyZWRlbnRpYWxzIjogeyJwcm9qZWN0X2lkIjogInJvY2stcmFuZ2UtMjA3NjIyIn19fQ== .. note:: The ability to import a backup is subject to ROBIN Role Based Access Control (RBAC). By default, only Cluster Administrators (users having the clusteradmin role) have permission to do so. See the section on :ref:`UserManagement` for details on how ROBIN RBAC works.