AA-2489: Support On-Demand Backups

Review Request #710 — Created March 13, 2025 and submitted

apoorva.sn
AMP
AA-2489
pmurugaiyan, prajesh, shuinvy

Problem

Support of Backup functionality on AMP

Solution

Have made changes to support backup of postgres DB, Influx DB and SQLite file and also the running configuration on AMP.
Creating a tar file with these and storing it under /var/backups so that users are able to download it locally for now.
Created API for starting backup job and also to get the status of the ongoing backup

API to start backup

  1. POST https://192.168.162.162:8888/backup/start

Response:
{
"message": "Backup started!"
}

  1. GET https://192.168.162.162:8888/backup/status
    Response when backup is in progress

{
"message": "Backup In-progress!"
}

Response when completed
{
"message": "Backup Completed!",
"Download url": "https://192.168.162.162:8888/backup/download?filename=backup_20250313_150909.tar.gz"
}

  1. GET https://192.168.162.162:8888/backup/download?filename=backup_20250313_150909.tar.gz
    to download the backup file
Description From Last Updated

Can we use API versioning for the newly added APIs, so that we can differentiate from the legacy API for …

pmurugaiyanpmurugaiyan

BACKUP_FILE_SCRIPT ?

pmurugaiyanpmurugaiyan

else return.method == 'GET': if path == 'status': return backup_status(request) elif path == 'download': return download_backup(request.GET.get('filename')) else: # Raise Bad …

pmurugaiyanpmurugaiyan

Shoud this be a another script and just call the script here?

prajeshprajesh

"downloadURL" or "download_url"

pmurugaiyanpmurugaiyan

Can we create a separate file for the variables?

pmurugaiyanpmurugaiyan

Can there be multiple backups running at the same time? Should we stop issuing backups when one is already in …

prajeshprajesh
prajesh
  1. 
      
  2. Shoud this be a another script and just call the script here?

    1. want to call the backup_script as part of seperate process so that it runs in backgroud. So calling it as part of subprocess here

  3. 
      
pmurugaiyan
  1. 
      
  2. Can we use API versioning for the newly added APIs, so that we can differentiate from the legacy API for the future improvements.

    1. there is some issue using /api/v2

  3. else return.method == 'GET':
    if path == 'status':
    return backup_status(request)
    elif path == 'download':
    return download_backup(request.GET.get('filename'))
    else:
    # Raise Bad Request Http Exception

    Can we simplify this.

    1. we will need to handle multiple else part for POST and GET with this scenario.

  4. Can we create a separate file for the variables?

    1. Created service_utils

  5. 
      
apoorva.sn
pmurugaiyan
  1. Ship It!
  2. 
      
apoorva.sn
apoorva.sn
prajesh
  1. 
      
  2. Can there be multiple backups running at the same time? Should we stop issuing backups when one is already in progress?

    1. Will take this up as a subtask and check what can be done

  3. 
      
prajesh
  1. Ship It!
  2. 
      
apoorva.sn
Review request changed

Status: Closed (submitted)

Loading...