Backup and restore
6 minute read
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:
-
Create a backup of the
cloudboltdatabase:-
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
-
-
Create a backup of the following directories:
Path Location (for non-monolithic installs) /var/opt/cloudboltAll nodes /var/log/cloudbolt/jobsAll nodes running Job Engine role /var/www/html/cloudbolt/staticAll 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
- Deploy the same version of the OneFuse Appliance that was being used previously and follow the install steps.
- During setup, use the same FQDN/IP address(es) as used previously.
- Copy and overwrite the following directories from backup via WinSCP or from Linux command line:
Path Location (for non-monolithic installs) /var/opt/cloudboltAll nodes /var/log/cloudbolt/jobsAll nodes running Job Engine role /var/www/html/cloudbolt/staticAll nodes running Web Server role
Restore the database
-
Copy the database backup file (for example,
cloudbolt.tar) to/tmp/cloudbolt.tar. -
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:
- Open a browser to the application(s) UI.
- Log in to OneFuse.
- Verify previous Policies, Jobs and/or Managed Objects are visible.
- 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
Identify a system to run the Python commands from. This could be your own desktop or a server in your environment. You will need to have Python 3 or greater installed on the system.
-
Verify Python is installed
Python 2 has sunset. If previously installed and on Python 2, upgrade to the latest Python.
- If Python is not installed (or upgrading), download the latest Python
-
Verify pip is installed
- Install pip if it does not exist
-
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.
It is recommended to install the latest OneFuse Python Package that matches the OneFuse Appliance version.
If the OneFuse Python Module is already installed, skip to Upgrade the OneFuse Python package.
- Open a Command Prompt or Terminal window
- 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.
-
Open a Command Prompt or Terminal window
-
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.
-
Open a Command Prompt or Terminal window
-
Enter the Python Console via command:
python -
Import the necessary modules via commands:
from onefuse.admin import OneFuseManager from onefuse.backups import BackupManager -
Connect to the OneFuse instance, replacing
username,passwordandOneFuse FQDNappropriately, 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") -
Instantiate the Backup module via command:
backups = BackupManager(ofm) -
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.
-
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.
Find and provide the
JSONfiles of the Policies in question along with the Module Endpoints, if any, to Customer Success.
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.
-
Open a Command Prompt or Terminal window.
-
Enter the Python Console via command:
python -
Import the necessary modules via commands:
from onefuse.admin import OneFuseManager from onefuse.backups import BackupManager -
Connect to the OneFuse instance, replacing
username,passwordandOneFuse FQDNappropriately, 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") -
Instantiate the Backup module via command:
backups = BackupManager(ofm) -
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.
-
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/') -
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.