Backup and restore

Back up and restore the OneFuse appliance and policies

Back up the OneFuse appliance

The steps below assume a single OVA instance. If you use an HA setup, adapt these steps to restore the necessary files and database to the appropriate locations.

Any backup tool or strategy of the Enterprise can be used for the OneFuse appliance.

The critical data needed from the appliance are as follows:

  1. Create a backup of the cloudbolt database:

    • PostgreSQL:

      # Execute the following command on the appliance
      # Replace '/tmp/' with the desired directory
      
      export PGPASSWORD=${postgresql_pass}
      pg_dump -h localhost -p 5432 -U cb_dba -w --clean -F t -f /tmp/cloudbolt.tar cloudbolt
      
      # The database will get backed up to the /tmp folder as file name: cloudbolt.tar
      
  2. Create a backup of the following directories:

    Path Location (for non-monolithic installs)
    /var/opt/cloudbolt All nodes
    /var/log/cloudbolt/jobs All nodes running Job Engine role
    /var/www/html/cloudbolt/static All nodes running Web Server role

It is ideal to keep the backups of the directories and database closely time-stamped to ensure integrity when restored (for example, Jobs in the database have corresponding Job Logs).

If your OneFuse instance is on a single appliance (monolithic), all the paths in the table above would be backed up and restored to that single appliance instance.

Refer to the Reference architecture documentation for more information on the distribution of Web Server and Job Engine roles.

Restore the OneFuse appliance

In the event of a complete loss of the Virtual Appliance, a complete recovery can be made given the proper backup material outlined above.

Follow the steps below to recreate the OneFuse instance.

Deploy the appliance

  1. Deploy the same version of the OneFuse Appliance that was being used previously and follow the install steps.
  2. During setup, use the same FQDN/IP address(es) as used previously.
  3. Copy and overwrite the following directories from backup via WinSCP or from Linux command line:
    Path Location (for non-monolithic installs)
    /var/opt/cloudbolt All nodes
    /var/log/cloudbolt/jobs All nodes running Job Engine role
    /var/www/html/cloudbolt/static All nodes running Web Server role

Restore the database

  1. Copy the database backup file (for example, cloudbolt.tar) to /tmp/cloudbolt.tar.

  2. SSH to the appliance and run the following commands:

    # Replace the following with the information from your new database: REMOTE_DB_DNS_NAME, REMOTE_DB_USER, and REMOTE_DB_PORT
    export PGPASSWORD=${REMOTE_DB_PASS}
    pg_restore -h REMOTE_DB_DNS_NAME -U REMOTE_DB_USER --no-owner --role=REMOTE_DB_USER -w -p REMOTE_DB_PORT -e --clean --if-exists -d REMOTE_DB_DNS_NAME /tmp/cloudbolt.tar
    
    # Connect to the "cloudbolt" database
    psql -U REMOTE_DB_USER -d cloudbolt
    
    # You should connect successfully
    
    \dt
    
    # You should see all tables listed
    
    SELECT * FROM job_log
    
    # You should see a list of all Job Logs
    
    exit
    exit
    

Restart web server processes

If the database restored properly, restart Web Server processes from the command line:

service httpd restart

Validate OneFuse functionality

Validate OneFuse functionality via UI:

  1. Open a browser to the application(s) UI.
  2. Log in to OneFuse.
  3. Verify previous Policies, Jobs and/or Managed Objects are visible.
  4. Verify (as a Super Admin) that the License file is present.

Back up OneFuse policies with the Python module

Leverage the OneFuse Python Module to back up OneFuse Policies from one OneFuse instance and then restore policies to another instance, store them in a git repository, or to provide the policies (in JSON format) to CloudBolt Customer Success.

Prerequisites

  1. Verify Python is installed

    • If Python is not installed (or upgrading), download the latest Python
  2. Verify pip is installed

  3. Review Python’s Installing Packages

Install the OneFuse Python package

OneFuse Python Module is distributed as a Python Package. Install the OneFuse Python Package using pip.

  1. Open a Command Prompt or Terminal window
  2. Install OneFuse Python Package using instructions below:

Option 1: Install the latest version

pip install onefuse

Option 2: Install a specific version

Optionally, list the available OneFuse Python package versions. Then, install with a specific version:

pip install onefuse==<version>

Upgrade the OneFuse Python package

Upgrade to the latest OneFuse Python Package using pip.

  1. Open a Command Prompt or Terminal window

  2. Install OneFuse Python Package using the command below:

    pip install --upgrade onefuse
    

Back up OneFuse policies

Once the OneFuse Python Module is installed, use the Python console to execute the commands to create backup of OneFuse Policies.

  1. Open a Command Prompt or Terminal window

  2. Enter the Python Console via command:

    python
    
  3. Import the necessary modules via commands:

    from onefuse.admin import OneFuseManager
    from onefuse.backups import BackupManager
    
  4. Connect to the OneFuse instance, replacing username, password and OneFuse FQDN appropriately, via command:

    # Replace <username>, <password> and <OneFuse FQDN> with your OneFuse information below:
    ofm = OneFuseManager("<username>", "<password>", "<OneFuse FQDN>")
    
    # Example
    # ofm = OneFuseManager("admin", "admin", "onefuse-staging.company.com")
    
  5. Instantiate the Backup module via command:

    backups = BackupManager(ofm)
    
  6. Run the Backup, replacing the path specified accordingly, via command:

    # Select your own backup path for the following command.
    # Windows Example: you will want to use double backslashes:
    backups.backup_policies('C:\\Temp\\onefuse_backups\\')
    
    # Linux Example:
    backups.backup_policies('/tmp/onefuse_backups/')
    
    • Note: For security reasons, passwords will not be exported.
  7. Verify backup: the backup will create a file structure in the folder specified from Step 6. View each of the policies under their respective folders.

If desired, restore OneFuse policies.

Restore OneFuse policies with the Python module

Leverage the OneFuse Python Module to restore OneFuse Policies.

Prerequisites

Verify the prerequisites were performed and the OneFuse Python Module is installed on the server you are performing restore Python commands on.

Restore OneFuse policies

Once the OneFuse Python Module is installed, use the Python console to execute the commands to restore OneFuse Policies.

  1. Open a Command Prompt or Terminal window.

  2. Enter the Python Console via command:

    python
    
  3. Import the necessary modules via commands:

    from onefuse.admin import OneFuseManager
    from onefuse.backups import BackupManager
    
  4. Connect to the OneFuse instance, replacing username, password and OneFuse FQDN appropriately, via command:

    # Replace <username>, <password> and <OneFuse FQDN> with your OneFuse information below:
    ofm = OneFuseManager("<username>", "<password>", "<OneFuse FQDN>")
    
    # Example
    # ofm = OneFuseManager("admin", "admin", "onefuse-staging.company.com")
    
  5. Instantiate the Backup module via command:

    backups = BackupManager(ofm)
    
  6. Verify backup policies exist: the backup folder that the OneFuse Policies are getting restored from should contain the folder structure created by the backup, with each policy under its respective folder.

  7. Run the Restore command, replacing the path specified accordingly, via command:

    # Select your own restore path for the following command.
    #Windows Example: you will want to use double backslashes:
    backups.restore_policies_from_file_path('C:\\Temp\\onefuse_backups\\')
    
    #Linux Example:
    backups.restore_policies_from_file_path('/tmp/onefuse_backups/')
    
  8. After restoring OneFuse Policies, log in to the restored OneFuse Instance and update all of the passwords for each Module Credential. The OneFuse Backup process does not export passwords.