Backups in ISPmanager 5

Data collection

Before starting a backup process, data from the control panel's modules that support backups are collected. This process is started by calling the backup.list function for which the corresponding modules are set as events. The function returns the following XML-document:

<doc>
  <module name="user">
    <type name="user" filter_files="on"/>
  </module>
  <elem>
    <backup>
      <type>user</type>
      <name>user</name>
      <partname>metadata</partname>
      <filter_files/>
      <separate>on</separate>
      <path>/var/www/user/data</path>
    </backup>
    <data>...</data>
  </elem>
  <module name="db" owner="user">
    <type name="db"/>
    <type name="db.users"/>
  </module>
  <elem>
    <backup>
      <type>db</type>
      <subtype>mysql</subtype>
      <name>db</name>
      <owner>user</owner>
      <prepfunc>db.dump</prepfunc>
      <rootarchiver>on</rootarchiver>
      <edit_elid>db->MySQL</edit_elid>
      <depend type="user" name="user"/>
    </backup>
    <data>...</data>
  </elem>
</doc>

<module>

The module describes a certain module. Filters are configured per each module. The @name attribute - module name @owner - parent module. Depending on the modules' hierarchy, child dependencies are identified while restoring data. The type node included into the module associates data types with certain module.

<elem>

The elem node describes data or their part. <elem> contains two chield nodes: <backup> and .

  • <backup> - contains information and management elements that are required for backup system. The <backup> node is described in more details below.
  • <data> - certain information that you should save for future data restore. Contents of this node is specified by the user who is making a backup copy of that module. Normally the module contains nodes from the data creation/edit form, where the node name is parameter name, node contents - parameter value.

<backup>

This node is the interface of the general backup system and specific function for saving certain data. This module contains elements from the set specified earlier:

  • type (required) - type, such as webdomain, user,etc.
  • subtype (optional) - subtype, which is used for databases only. Example: mysql, posgresql. The subtype is used together with the type dot separated (".").
  • name (required) - name. For example: the name for "user" will be "username".
  • owner (optional) - Owner - owner of that data. This is a mandatory field for data with owners.
  • path (optional) - Absolute path to the object. For user - path to the home directory.
  • partname (optional) - If the object is specified in different directories, like, for example, user - home directory and panel settings, for each directory you may specify additional elem with the same type, subtype, name, owner, but with a different path. To deffirintiate elem and specify correct recovery order, you should specify a separate partname for each elem.
  • display_name (optional) - name that will be displayed in the panel interface.

Attention combination of type, subtype, name, partname and owner must be unique withing the list backup.list.

  • prepfunc (optional) - object preparation function. db.dump for a database. If the data filter is set, but databases are still backed up, the db.dump function will be called for creating databse dump and will return the XML containgin path to the damp in the <path> node. Nodes and contents as their parameters and values will sent to stdin for db.dump.
  • filter_files (optional) - files located in path can be filtered while filtering files.
  • view_files (optional) - files located in path can be viewed and selectively restored.
  • delete (optional) - delete object files upon backup. It can be used for database dumps, temporary metadata and parts of configuration files. Values specified in path will be deleted. If prepfunc is specified, it will be deleted as it is.
  • force (optional) - force save. Ignore incremental, differential and other backup types for files of that object.
  • depend (optional) - objects, on which this object depends. There can be several nodes. The node has the following attributes: @type - type of the object on which depends, @name - name of the object, on which it depends. The depended object will be searched by the same owner that this object has.
  • rootarchiver (optional) - when creating this node, archiving of object files for which the owner is specified, will be performed with superuser permissions. Otherwise, archiving will be performed with permissions of the user specified in the owner field.

The list will be divided into elem, each elem processes separately.

Data filter

For each element the filtering rules that were added in the Backup plans module will be applied. The filters will be applied as they appera on the list. If once the last filter is applied and elem is marked as active, the item will be added into the backup copy, otherwise, it will be deleted.

Attention You may perform all the steps below only if those elem that were filtered successfully.

prepfunc request

For each elem with prepfunc specified the corresponding function will be called. Contents of /elem/backup and /elem/data will be sent to the function's stdin, where names of nodes are names of parameters, nodes contents - parameters values. The parameters values from /elem/data will clear the corresponding values from /elem/backup

Applying user filters to files

For each elem with the specified path a list of files for backup will be generated. If the path is a file, the list will contain one file only. If the path is a directory, recursive walk through a directory tree will be made. File filters will be applied for file and idrectories names while walking. Sizes, modification dates and file permissions will be saved.

Filtering depending on backup type

For each elem the backup_type_filter.{type} function is called, where {type} is a type of the backup copy type in the backup plan edit form.

Full ({type} = full)

When making a full backup copy the list of files will remain unchanged.

Incremental({type} = inc)

A full backup copy will be made and the list of files will remain unchanged. If the number of days from the last full backup exceeds the мфдгу specified in the backup plan settings, a full backup copy will be made and list of files will remain unchanged. Otherwise, an incremental copy will be made - the list of files will contain files that were modified since the last backup copy (full or incremental). The file is considered modified, if its size ans/or modification date were changed.

Differential ({type} = diff)

A full backup copy will be made and the list of files will remain unchanged. If the number of days from the last full backup exceeds the мфдгу specified in the backup plan settings, a full backup copy will be made and list of files will remain unchanged. Otherwise, a differential copy will be made - the list of file will contain only those files that were modified since the last full backup. The file is considered modified, if its size ans/or modification date were changed.

Archiving

For each elem, the function backup_archive.{archiver} is started, where {archiver} is the archiver selected in the backup plan edit form.

tgz archiver

Based on the list of files and directories, a simplier list of files is generated. This list is sent to the tar archiver via the -T option. If the owner node is specified and the rootarchive node is not specified, tar will start with permissions of the user specified on the owner node, otherwise - with control pane'l permissions. The archive will be compressed with the gzip utility. As tar is started with the key --ignore-failed-read,from the list that were archived will be compared the files to ensure the service database does not contain information about unexisting files.

Save into storage

For each elem and each {storage} specified in the plan edit the function backup_storage.{storage} is started.

  • local - places the archive into the local directory
  • ftp/ftps - places the file on remote ftp server

Save into database

For each elem all required information is saved into the service database

 

Was this answer helpful?

 Print this Article

Also Read

List of users

This module can be used to manage your user accounts. You may add new users, edit their...

Backup plans

This module can be used you to manage the backup plans to save your server data from an accident...

Administrator accounts. Technical details. (ISPmanager)

While creating a new administrator account, a new system user with the same name is...

Afterlogic

ISPmanager by default uses Afterlogic as a web-interface for email management. Official...

Customizing DNSmanager

DNSmanager is a DNS slave server management system. It can be used both as a stand-alone...