mb-backup-manager/manifest.jps

393 lines
13 KiB
Plaintext
Raw Permalink Normal View History

2024-02-29 12:36:59 +00:00
type: update
2025-01-07 17:15:11 +00:00
jpsVersion: 1.8
2024-02-29 12:36:59 +00:00
name: MightyBox WordPress Backup/Restore Addon
id: mb-backup-manager
description: Custom Backup and Restore Addon for WordPress using Restic. Supports backing up databases, core files, media files, and full backups with scheduling and retention policies.
2024-03-12 15:45:00 +00:00
baseUrl: https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main
2024-03-07 15:23:59 +00:00
2024-02-29 12:36:59 +00:00
targetNodes:
2024-03-07 14:39:23 +00:00
nodeType:
- nginxphp
- litespeedphp
- lemp
- llsmp
2024-02-29 12:36:59 +00:00
2024-03-04 17:31:33 +00:00
globals:
2024-03-14 10:46:58 +00:00
envName: "${env.name}"
scriptPath: "/home/litespeed/mb-backups"
logPath: "/home/litespeed/mb-backups/logs"
2024-02-29 12:36:59 +00:00
onInstall:
- checkAddons
- installRestic
2024-09-18 17:14:47 +00:00
- importScripts
2024-03-13 13:25:45 +00:00
2024-09-18 16:53:20 +00:00
settings:
backupSettings:
submitUnchanged: true
fields:
- name: blabel
caption: Backup Label
type: string
restoreSettings:
submitUnchanged: true
fields:
- name: snapshotId
caption: Snapshot ID
type: string
2025-06-19 10:00:57 +00:00
fullRestoreSettings:
submitUnchanged: true
fields:
- name: backupSessionTag
caption: Backup Session Tag
type: string
placeholder: "e.g., manual-backup-2024-01-15_10-30-45"
2025-01-06 15:48:39 +00:00
2024-03-14 10:46:58 +00:00
buttons:
- caption: Backup Now
2024-09-18 16:53:20 +00:00
action: backupnow
2024-03-14 10:46:58 +00:00
loadingText: Backing up...
confirmText: Do you want to initiate the backup process?
successText: The backup process has been finished successfully.
2025-01-06 15:48:39 +00:00
2025-06-19 10:12:45 +00:00
- caption: Full Backup Session Restore
action: restoreFullBackupSession
loadingText: Restoring full backup session...
confirmText: Restore complete backup session? This will restore database, core files, and media files from the same backup session.
successText: Full backup session restoration completed successfully
settings: fullRestoreSettings
2024-03-13 13:25:45 +00:00
menu:
2024-11-12 18:15:11 +00:00
- caption: Configure Auto Backup
action: configureAutoBackup
confirmText: Configure automated backup schedule?
loadingText: Setting up backup schedule...
successText: Backup schedule configured successfully
title: Configure Automated Backup Schedule
submitButtonText: Save Schedule
- caption: List Scheduled Backups
action: listScheduledBackups
confirmText: List scheduled backups?
loadingText: Listing scheduled backups...
successText: Scheduled backups listed successfully
2024-11-12 18:15:11 +00:00
- caption: Remove Auto Backup
action: removeAutoBackup
confirmText: Remove automated backup schedule?
loadingText: Removing backup schedule...
successText: Backup schedule removed successfully
- caption: View Schedule
action: viewBackupSchedule
confirmText: View current backup schedule?
successText: Current schedule retrieved successfully
- caption: Check Backup Repository
confirmText: Do you want to check and repair the backup repository?
loadingText: Checking and repairing backup repository...
action: checkBackupRepo
successText: Backup repository check completed successfully.
title: Check Backup Repository
submitButtonText: Run Check
- caption: Core File Backup
confirmText: Backup Core Files?
loadingText: Backing up Core Files...
action: backupcore
successText: Core Files Backup Completed Successfully
settings: backupSettings
title: Backup Core Files
submitButtonText: Backup Now
- caption: Media Backup
confirmText: Backup Media Files?
loadingText: Backing up Media Files...
action: backupmedia
successText: Media Files Backup Completed Successfully
settings: backupSettings
title: Backup Media Files
submitButtonText: Backup Now
- caption: Database Backup
confirmText: Backup Database?
loadingText: Backing up Database...
action: backupdb
successText: Database Backup Completed Successfully
settings: backupSettings
title: Backup Database
submitButtonText: Backup Now
- caption: Restore
confirmText: Restore from Snapshot?
loadingText: Restoring...
action: restore
successText: Restore Completed Successfully
settings: restoreSettings
title: Restore from Snapshot
submitButtonText: Restore Now
2025-06-19 10:00:57 +00:00
- caption: View Backup Sessions
action: viewBackupSessions
confirmText: View available backup sessions?
loadingText: Retrieving backup sessions...
successText: Backup sessions listed successfully.
2025-01-07 17:15:11 +00:00
- caption: View All Backups
action: viewAllBackups
confirmText: Are you sure you want to view all backups?
successText: All backups listed successfully.
2025-01-06 15:13:20 +00:00
- caption: View Core Backups
action: viewCoreBackups
confirmText: Are you sure you want to view core backups?
successText: Core backups listed successfully.
- caption: View Media Backups
action: viewMediaBackups
confirmText: Are you sure you want to view media backups?
successText: Media backups listed successfully.
- caption: View Database Backups
action: viewDatabaseBackups
confirmText: Are you sure you want to view database backups?
2025-01-06 15:13:20 +00:00
successText: Database backups listed successfully.
- caption: Check Repository Stats
confirmText: Check repository stats?
loadingText: Checking repository stats...
action: checkRepoStats
successText: Repository stats checked successfully.
2024-03-04 17:31:33 +00:00
onUninstall:
2025-03-19 16:21:51 +00:00
- removeScripts
2024-03-04 17:31:33 +00:00
onBeforeDelete:
2025-03-19 16:21:51 +00:00
- removeScripts
2024-03-04 17:31:33 +00:00
onAfterRedeployContainer[cp]:
- installRestic
onAfterClone:
2024-03-04 17:31:33 +00:00
- script: return {result:0, jps:MANIFEST};
- install: ${response.jps}
nodeGroup: ${targetNodes.nodeGroup:cp}
settings:
2024-03-12 15:45:00 +00:00
cronTime: "0 * * * *"
backupCount: "5"
2024-03-04 17:31:33 +00:00
2024-02-29 12:36:59 +00:00
actions:
2025-01-06 17:18:17 +00:00
2024-11-12 18:15:11 +00:00
configureAutoBackup:
2024-11-12 18:58:17 +00:00
- cmd[cp]:
user: root
commands: bash "/home/litespeed/mb-backups/manage_backup_schedule.sh" add "0 0 * * *" "$(cat /etc/restic-password)"
2024-11-12 18:58:17 +00:00
- return:
type: info
message: "Daily backup schedule configured successfully"
2024-11-12 18:15:11 +00:00
listScheduledBackups:
- cmd[cp]:
user: root
commands: bash /home/litespeed/mb-backups/manage_backup_schedule.sh list
- return:
type: info
message: "${response.out}"
2024-11-12 18:15:11 +00:00
removeAutoBackup:
- cmd[cp]:
user: root
2025-01-06 17:18:17 +00:00
commands: bash /home/litespeed/mb-backups/manage_backup_schedule.sh remove
2024-11-12 18:15:11 +00:00
- return:
type: info
message: "${response.out}"
2025-01-06 15:48:39 +00:00
checkBackupRepo:
- cmd[cp]:
2025-01-06 15:48:39 +00:00
user: root
commands: bash /home/litespeed/mb-backups/check_backup_repo.sh
- return:
type: info
message: "${response.out}"
2024-11-12 17:00:19 +00:00
2024-03-13 13:25:45 +00:00
backupnow:
- cmd[cp]:
2025-01-06 15:48:39 +00:00
user: root
commands: bash /home/litespeed/mb-backups/backup_all.sh manual
- return:
type: info
message: "${response.out}"
backupcore:
- cmd[cp]:
2025-01-06 15:48:39 +00:00
user: root
commands: bash /home/litespeed/mb-backups/backup_core_files.sh "$(cat /etc/restic-password)" "${settings.blabel}"
- return:
type: info
message: "${response.out}"
backupmedia:
- cmd[cp]:
2025-01-06 15:48:39 +00:00
user: root
commands: bash /home/litespeed/mb-backups/backup_media.sh "$(cat /etc/restic-password)" "${settings.blabel}"
- return:
type: info
message: "${response.out}"
backupdb:
- cmd[cp]:
2025-01-06 15:48:39 +00:00
user: root
commands: bash /home/litespeed/mb-backups/backup_database.sh "$(cat /etc/restic-password)" "${settings.blabel}"
- return:
type: info
message: "${response.out}"
restore:
- cmd[cp]:
2025-01-06 15:48:39 +00:00
user: root
commands: bash /home/litespeed/mb-backups/restore_backup_direct.sh "${settings.snapshotId}"
- return:
type: info
message: "${response.out}"
2025-06-19 10:00:57 +00:00
viewBackupSessions:
- cmd[cp]:
user: root
commands: bash /home/litespeed/mb-backups/view_backup_sessions.sh sessions
- return:
type: info
message: "${response.out}"
restoreFullBackupSession:
- cmd[cp]:
user: root
commands: bash /home/litespeed/mb-backups/restore_full_backup_session.sh "${settings.backupSessionTag}"
- return:
type: info
message: "${response.out}"
2025-01-07 17:15:11 +00:00
viewAllBackups:
2024-09-18 16:53:20 +00:00
- cmd[cp]:
user: root
commands: bash /home/litespeed/mb-backups/view_snapshots.sh all
- return:
2024-09-18 16:53:20 +00:00
type: info
message: "${response.out}"
2024-09-18 16:53:20 +00:00
viewCoreBackups:
- cmd[cp]:
user: root
commands: bash /home/litespeed/mb-backups/view_snapshots.sh core_files
- return:
type: info
message: "${response.out}"
viewMediaBackups:
- cmd[cp]:
user: root
commands: bash /home/litespeed/mb-backups/view_snapshots.sh media_themes
- return:
type: info
message: "${response.out}"
viewDatabaseBackups:
- cmd[cp]:
user: root
commands: bash /home/litespeed/mb-backups/view_snapshots.sh wordpress_db
- return:
type: info
message: "${response.out}"
2025-01-06 15:48:39 +00:00
2024-11-12 18:15:11 +00:00
viewBackupSchedule:
2024-09-18 16:53:20 +00:00
- cmd[cp]:
user: root
commands: bash /home/litespeed/mb-backups/check_sched.sh
2024-11-12 18:15:11 +00:00
- return:
2024-09-18 16:53:20 +00:00
type: info
2024-11-12 18:15:11 +00:00
message: "${response.out}"
2024-03-13 13:25:45 +00:00
checkRepoStats:
- cmd[cp]:
user: root
commands: bash /home/litespeed/mb-backups/check_repo_stats.sh
- return:
type: info
message: "${response.out}"
checkAddons:
- script: |-
var onAfterReturn = { setGlobals: {} },
glbs = onAfterReturn.setGlobals,
resp = api.marketplace.app.GetAddonList({
search: {},
envName: "${env.name}",
session: session
});
if (resp.result != 0) return resp;
glbs["alreadyInstalled"] = false;
for (let i = 0, n = resp.apps.length; i < n; i++) {
if (resp.apps[i].isInstalled) {
if (resp.apps[i].app_id == 'db-backup') {
glbs["alreadyInstalled"] = true;
break;
}
}
}
return { result: 0, onAfterReturn: onAfterReturn };
- if ('${globals.alreadyInstalled}' == 'true' ):
- stopEvent:
type: warning
message: Database backup add-on is already installed on ${env.name}. Backup addon installation is not possible.
installRestic:
2025-06-02 17:51:32 +00:00
- cmd[cp]:
user: root
commands:
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/install-restic.sh
- chmod +x install-restic.sh
- bash install-restic.sh
2024-09-18 17:14:47 +00:00
importScripts:
- cmd[cp]:
user: root
commands:
- mkdir -p /home/litespeed/mb-backups
- mkdir -p /home/litespeed/mb-backups/logs
- mkdir -p /home/litespeed/mb-backups/logs/auto
- mkdir -p /home/litespeed/mb-backups/logs/manual
- mkdir -p /home/litespeed/mb-backups/logs/restore
- cd /home/litespeed/mb-backups
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/backup_all.sh
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/backup_core_files.sh
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/backup_database.sh
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/backup_media.sh
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/check_sched.sh
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/manage_backup_schedule.sh
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/restore_backup_direct.sh
2025-06-19 10:00:57 +00:00
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/restore_full_backup_session.sh
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/view_snapshots.sh
2025-06-19 10:00:57 +00:00
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/view_backup_sessions.sh
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/check_backup_repo.sh
- curl -O https://deploy-proxy.mightybox.io/addons/mb-backup-manager/raw/branch/main/scripts/imports/check_repo_stats.sh
- chmod +x /home/litespeed/mb-backups/*.sh
2025-01-07 17:24:44 +00:00
removeScripts:
- cmd[cp]:
user: root
commands:
# Remove the crontab entry for the add-on
- (crontab -l | grep -v "${globals.scriptPath}/manage_backup_schedule.sh" | crontab -) || true
# Stop any running backup processes
- pkill -f "restic" || true
- pkill -f "mb-backups" || true
# Remove script directory
- rm -rf "${globals.scriptPath}"
# Remove backup repository completely
- rm -rf /mnt/backups
# Remove password file
2025-01-07 17:24:44 +00:00
- rm -f /etc/restic-password
# Remove log rotation config
- rm -f /etc/logrotate.d/backup-addon
# Remove any restic cache
- rm -rf /home/*/cache/restic || true
- rm -rf /root/.cache/restic || true