Articles in this section
Category / Section

How to extract and restore necessary files in Kubernetes

Published:
Updated:

Introduction

This article provides a guide on how to identify and remove unnecessary files, how to reinstall the deleted files, and details about the backup and restore processes in Kubernetes.

Prerequisites:

Ensure you have the necessary permissions to access the Bold Reports deployment location and associated databases. This includes read, write, and delete access for both the file system and database operations within the Kubernetes environment.

Procedure for Kubernetes(K8’s):

1. Data Backup

  • Bash into the container using the command below on Server 1.

    kubectl exec -it <pod name> -n bold-services -- bash
    

    Note: Replace <pod_name> with the actual name of your pod.`

  • Navigate to the app_data folder. This folder contains critical application data.

    cd ../../app_data/
    

    app-data-k8.png

  • Before zipping the app_data folder, you can delete unnecessary files to save space. These files can be reinstalled later.

  • The files below are unnecessary :

    1. Optional Client Libraries
      • These libraries are required for specific functionalities within the Bold Reports server. Bold Reports supports Oracle, PostgreSQL, and MySQL databases, enabling connections to their respective SQL database variants.
      • Navigate to the app_data folder as shown in the following screenshot.
        app-data-k8.png
      • Enter the below command to remove the optional libraries:
        remove-opt-lib-k8.png
          rm -r optional-libs/
        
    2. Puppeteer:
      • In Bold Reports, Puppeteer is used for tasks such as exporting data visualization items. Chromium packages are necessary to achieve image and PDF export functionalities in reports, schedules from Bold Reports. Without these packages, the image and PDF export options in reports and schedules will no longer be available.
      • You can find the files at the following location: app_data/reporting/exporthelpers.
      • You can remove the puppeteer by the command below:
        remove-pupeteer-k8.png
        rm -r puppeteer/
        
  • After removing those unnecessary files, navigate to the app_data directory. Zip the app_data folder using the following command, where app_data.zip is the file name and app_data is the folder name.

    zip -r app_data.zip app_data/
    

    zip-ap-data-k8.png

  • Exit the container and run the following command:

    kubectl cp < bold-services pod name>:/application/app_data.zip /<backup folder name>/<backup file name> -n bold-services
    

    e.g

    kubectl cp reports-web-deployment-5bdd7bb-x9j16:/application/app_data.zip /test/app_data.zip -n bold-services
    

2. Backup Database
You need to take a backup of all the databases used in Bold Reports applications. Please follow the steps below to backup the databases:

  • Use pgAdmin to connect to the PostgreSql Server on Server1.

  • Expand Databases and select the database(s) used by your Bold Reports applications.

  • Right-click on the database and select Backup.

    backup-pg.png

  • In the Back Up Database window, select the browse option for the file name.

    backup-filename-pg.png

  • Select the folder and enter a file name that matches the database name with a .sql extension, then proceed by clicking Create.

    backup-file-cretae-pg.png

  • Click Backup to complete the backup process.

3. Restore

  • Restore the zipped files on Server 2 using the following command:

    kubectl cp <source_path> <destination_pod_name>:<destination_path> -n <namespace>
    

    e.g

    kubectl cp "/test/app_data.zip" reports-web-deployment-5bdd7bb-x9j16:/application/app_data/ -n bold-services
    
  • Unzip the zipped folder (app_data.zip) inside the app_data directory using the following command, and replace the existing folders and files in the app_data directory with those from the unzipped folder.

    unzip app_data.zip
    
  • You can reinstall the removed files by restarting the container. Follow the command below to restart the container:

    kubectl rollout restart deploy id-web-deployment -n bold-services
    

    restarting.png

4. Restore PostgreSQL Database Using pgAdmin

  • Open pgAdmin and connect to the database on Server-2.
  • Select Databases, then right-click and choose Restore Database.
    restore-pg.png
  • In the Restore Database window, select the browse option in the file name field.
    browse-file-name.png

    restore-select-pg.png
  • Select the backup file you want to restore, then click “Select.”
    restore-file-pg.png
  • Click Restore to initiate the restoration process.

Update database connection string in Bold Reports

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied