From 2790ebbf9603b496ac814b313285dee0adff6a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Thu, 26 Jan 2023 01:17:03 -0300 Subject: [PATCH 01/21] Add path option to createChild function --- cli/cyberPanel.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cli/cyberPanel.py b/cli/cyberPanel.py index 734136e70..7c34ece6e 100755 --- a/cli/cyberPanel.py +++ b/cli/cyberPanel.py @@ -75,14 +75,13 @@ class cyberPanel: logger.writeforCLI(str(msg), "Error", stack()[0][3]) self.printStatus(0, str(msg)) - def createDomain(self, masterDomain, domainName, owner, php, ssl, dkim, openBasedir): + def createDomain(self, masterDomain, domainName, owner, php, ssl, dkim, openBasedir, path): try: - path = '/home/' + masterDomain + '/public_html/' + domainName + complete_path = '/home/' + masterDomain + '/' + path phpSelection = 'PHP ' + php - result = virtualHostUtilities.createDomain(masterDomain, domainName, phpSelection, path, ssl, dkim, - openBasedir, owner, 0) + result = virtualHostUtilities.createDomain(masterDomain, domainName, phpSelection, complete_path, ssl, dkim, openBasedir, owner, 0) if result[0] == 1: self.printStatus(1, 'None') @@ -920,8 +919,13 @@ def main(): openBasedir = int(args.openBasedir) else: openBasedir = 0 + + if args.path: + path = args.path + else: + path = "public_html/" + args.childDomain - cyberpanel.createDomain(args.masterDomain, args.childDomain, args.owner, args.php, ssl, dkim, openBasedir) + cyberpanel.createDomain(args.masterDomain, args.childDomain, args.owner, args.php, ssl, dkim, openBasedir, path) elif args.function == "deleteChild": completeCommandExample = 'cyberpanel deleteChild --childDomain cyberpanel.net' From b19fdaa262a729fcf0ebb2542c164cd5bd55f87c Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Sat, 4 Mar 2023 11:14:05 +0500 Subject: [PATCH 02/21] converting --parent lable to --tag as per suggestion by rustic dev --- plogical/Backupsv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 06f51ce5d..7924e46ad 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -110,7 +110,7 @@ pass = {ObsecurePassword} #command = f'chown cyberpanel:cyberpanel {self.FinalPathRuctic}' #ProcessUtilities.executioner(command) - command = f'rustic -r {self.repo} backup {self.FinalPathRuctic}/config.json --password "" --parent {parent}' + command = f'rustic -r {self.repo} backup {self.FinalPathRuctic}/config.json --password "" --tag {parent}' ProcessUtilities.executioner(command) def InitiateBackup(self): From c6bf9d205071f5c1ac608d37aa45d136a2af2858 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Sat, 4 Mar 2023 12:47:34 +0500 Subject: [PATCH 03/21] bug fix: config issue --- plogical/Backupsv2.py | 6 ++++++ serverStatus/views.py | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 7924e46ad..0c1347d0d 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -110,7 +110,13 @@ pass = {ObsecurePassword} #command = f'chown cyberpanel:cyberpanel {self.FinalPathRuctic}' #ProcessUtilities.executioner(command) + command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' + ProcessUtilities.executioner(command) + command = f'rustic -r {self.repo} backup {self.FinalPathRuctic}/config.json --password "" --tag {parent}' + ProcessUtilities.executioner(command, self.website.externalApp) + + command = f'chown cyberpanel:cyberpanel {self.FinalPathRuctic}/config.json' ProcessUtilities.executioner(command) def InitiateBackup(self): diff --git a/serverStatus/views.py b/serverStatus/views.py index 1ba3ed931..1e93cd190 100755 --- a/serverStatus/views.py +++ b/serverStatus/views.py @@ -455,9 +455,11 @@ def refreshLicense(request): {'domain': 'cyberpanel.net', 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1, 'BackupEmails': 1, 'BackendName': 'testremote'}) RcloneData = {"name":'testremote', "host":"staging.cyberpanel.net", "user": "abcds2751", "port": "22", "password":"hosting",} - cpbuv2.SetupRcloneBackend(CPBackupsV2.SFTP, RcloneData) + #cpbuv2.SetupRcloneBackend(CPBackupsV2.SFTP, RcloneData) cpbuv2.InitiateBackup() + + #cpbuv2.InstallRustic() final_dic = {'status': 1} From a12ab19267f1d99a55b9c880d707e1f820e5ce32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 06:15:31 -0300 Subject: [PATCH 04/21] Update cyberpanel_upgrade.sh --- cyberpanel_upgrade.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 4779a2f5c..8d76a764e 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -271,7 +271,7 @@ fi Pre_Upgrade_Setup_Git_URL() { if [[ $Server_Country != "CN" ]] ; then - Git_User="usmannasir" + Git_User="NNetworkBR" Git_Content_URL="https://raw.githubusercontent.com/${Git_User}/cyberpanel" Git_Clone_URL="https://github.com/${Git_User}/cyberpanel.git" else @@ -553,7 +553,7 @@ fi Pre_Upgrade_Setup_Git_URL() { if [[ $Server_Country != "CN" ]] ; then - Git_User="usmannasir" + Git_User="NNetworkBR" Git_Content_URL="https://raw.githubusercontent.com/${Git_User}/cyberpanel" Git_Clone_URL="https://github.com/${Git_User}/cyberpanel.git" else From 8ad3f904a3bee2a166e229a9a767fac93ccaaa21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 06:16:39 -0300 Subject: [PATCH 05/21] Update preUpgrade.sh --- preUpgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preUpgrade.sh b/preUpgrade.sh index a1cdbad7e..b4c1a15f9 100644 --- a/preUpgrade.sh +++ b/preUpgrade.sh @@ -3,6 +3,6 @@ BRANCH_NAME=v$(curl -s https://cyberpanel.net/version.txt | sed -e 's|{"version":"||g' -e 's|","build":|.|g'| sed 's:}*$::') rm -f /usr/local/cyberpanel_upgrade.sh -wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh 2>/dev/null +wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/NNetworkBR/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh 2>/dev/null chmod 700 /usr/local/cyberpanel_upgrade.sh /usr/local/cyberpanel_upgrade.sh From 14cb58549576b574e26ac0471f68af2c22c4369b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 06:18:12 -0300 Subject: [PATCH 06/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c18ea068a..386f3bf49 100755 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/ ``` -sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh) +sh <(curl https://raw.githubusercontent.com/NNetworkBR/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/NNetworkBR/cyberpanel/stable/preUpgrade.sh) ``` # Resources From e705a21029c1d9f591d3b42a0ccd2a0d9131b990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 06:23:59 -0300 Subject: [PATCH 07/21] Update preUpgrade.sh --- preUpgrade.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/preUpgrade.sh b/preUpgrade.sh index b4c1a15f9..f2828a869 100644 --- a/preUpgrade.sh +++ b/preUpgrade.sh @@ -3,6 +3,7 @@ BRANCH_NAME=v$(curl -s https://cyberpanel.net/version.txt | sed -e 's|{"version":"||g' -e 's|","build":|.|g'| sed 's:}*$::') rm -f /usr/local/cyberpanel_upgrade.sh -wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/NNetworkBR/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh 2>/dev/null +#wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/NNetworkBR/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh 2>/dev/null +wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/NNetworkBR/cyberpanel/stable/cyberpanel_upgrade.sh 2>/dev/null chmod 700 /usr/local/cyberpanel_upgrade.sh /usr/local/cyberpanel_upgrade.sh From ff8bb3060394b93fa1cc67d140dd847106e5b4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 06:28:37 -0300 Subject: [PATCH 08/21] Update cyberpanel_upgrade.sh --- cyberpanel_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 8d76a764e..7cda1c01d 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -471,7 +471,7 @@ fi Download_Requirement() { for i in {1..50}; do - wget -O /usr/local/requirments.txt "${Git_Content_URL}/${Branch_Name}/requirments.txt" + wget -O /usr/local/requirments.txt "${Git_Content_URL}/stable/requirments.txt" if grep -q "Django==" /usr/local/requirments.txt ; then break else From 0ae18e1dfe02fb465d5407ffac8472623de4f90d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 06:38:30 -0300 Subject: [PATCH 09/21] Update cyberpanel_upgrade.sh --- cyberpanel_upgrade.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 7cda1c01d..c40ecb276 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -29,7 +29,8 @@ Temp_Value=$(curl --silent --max-time 30 -4 https://cyberpanel.net/version.txt) Panel_Version=${Temp_Value:12:3} Panel_Build=${Temp_Value:25:1} -Branch_Name="v${Panel_Version}.${Panel_Build}" +#Branch_Name="v${Panel_Version}.${Panel_Build}" +Branch_Name="stable" Base_Number="1.9.3" Git_User="" From ebc6837e42d7ab2683e714bf440d1e1bf7d77a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 07:21:59 -0300 Subject: [PATCH 10/21] Revert "Update cyberpanel_upgrade.sh" This reverts commit 74a6f0312e2b52927c173f6b9beaea5b03c1b1cd. --- cyberpanel_upgrade.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index c40ecb276..b7efd4fda 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -272,7 +272,7 @@ fi Pre_Upgrade_Setup_Git_URL() { if [[ $Server_Country != "CN" ]] ; then - Git_User="NNetworkBR" + Git_User="usmannasir" Git_Content_URL="https://raw.githubusercontent.com/${Git_User}/cyberpanel" Git_Clone_URL="https://github.com/${Git_User}/cyberpanel.git" else @@ -554,7 +554,7 @@ fi Pre_Upgrade_Setup_Git_URL() { if [[ $Server_Country != "CN" ]] ; then - Git_User="NNetworkBR" + Git_User="usmannasir" Git_Content_URL="https://raw.githubusercontent.com/${Git_User}/cyberpanel" Git_Clone_URL="https://github.com/${Git_User}/cyberpanel.git" else From d664db13ff79ed0affb452b2296581f71f406420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 07:22:05 -0300 Subject: [PATCH 11/21] Revert "Update cyberpanel_upgrade.sh" This reverts commit 4a14ab6dfc3e06890b719400e245b1f1e31d4117. --- cyberpanel_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index b7efd4fda..4c260200b 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -472,7 +472,7 @@ fi Download_Requirement() { for i in {1..50}; do - wget -O /usr/local/requirments.txt "${Git_Content_URL}/stable/requirments.txt" + wget -O /usr/local/requirments.txt "${Git_Content_URL}/${Branch_Name}/requirments.txt" if grep -q "Django==" /usr/local/requirments.txt ; then break else From c2d53fea0cf12dadd4c42d73eed3a6f06e786bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 07:22:08 -0300 Subject: [PATCH 12/21] Revert "Update cyberpanel_upgrade.sh" This reverts commit 93a48236bc633142a4686358d101d5b3d52bc790. --- cyberpanel_upgrade.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 4c260200b..4779a2f5c 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -29,8 +29,7 @@ Temp_Value=$(curl --silent --max-time 30 -4 https://cyberpanel.net/version.txt) Panel_Version=${Temp_Value:12:3} Panel_Build=${Temp_Value:25:1} -#Branch_Name="v${Panel_Version}.${Panel_Build}" -Branch_Name="stable" +Branch_Name="v${Panel_Version}.${Panel_Build}" Base_Number="1.9.3" Git_User="" From e5df08dbd72af9389b15ba6fd2e9ca735240f809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 07:23:19 -0300 Subject: [PATCH 13/21] Revert "Update README.md" This reverts commit af43ae0c307b15099daaa0861bba4a331d131cc3. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 386f3bf49..c18ea068a 100755 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/ ``` -sh <(curl https://raw.githubusercontent.com/NNetworkBR/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/NNetworkBR/cyberpanel/stable/preUpgrade.sh) +sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh) ``` # Resources From cca9e32bc3971bd392ac4c32d11d29749cf38210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 07:24:43 -0300 Subject: [PATCH 14/21] Revert "Update preUpgrade.sh" This reverts commit bc7ceb59fa177443cb2e1e492f10a21e9ee2bb43. --- preUpgrade.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/preUpgrade.sh b/preUpgrade.sh index f2828a869..b4c1a15f9 100644 --- a/preUpgrade.sh +++ b/preUpgrade.sh @@ -3,7 +3,6 @@ BRANCH_NAME=v$(curl -s https://cyberpanel.net/version.txt | sed -e 's|{"version":"||g' -e 's|","build":|.|g'| sed 's:}*$::') rm -f /usr/local/cyberpanel_upgrade.sh -#wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/NNetworkBR/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh 2>/dev/null -wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/NNetworkBR/cyberpanel/stable/cyberpanel_upgrade.sh 2>/dev/null +wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/NNetworkBR/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh 2>/dev/null chmod 700 /usr/local/cyberpanel_upgrade.sh /usr/local/cyberpanel_upgrade.sh From 8c3e88fcf9a54834772901aaf34bf864674a7981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilberto=20C=C3=A9sar?= Date: Sat, 4 Mar 2023 07:25:03 -0300 Subject: [PATCH 15/21] Revert "Update preUpgrade.sh" This reverts commit 6899ba169fbd817f3525df952c8a2a85244dc2ac. --- preUpgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preUpgrade.sh b/preUpgrade.sh index b4c1a15f9..a1cdbad7e 100644 --- a/preUpgrade.sh +++ b/preUpgrade.sh @@ -3,6 +3,6 @@ BRANCH_NAME=v$(curl -s https://cyberpanel.net/version.txt | sed -e 's|{"version":"||g' -e 's|","build":|.|g'| sed 's:}*$::') rm -f /usr/local/cyberpanel_upgrade.sh -wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/NNetworkBR/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh 2>/dev/null +wget -O /usr/local/cyberpanel_upgrade.sh https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh 2>/dev/null chmod 700 /usr/local/cyberpanel_upgrade.sh /usr/local/cyberpanel_upgrade.sh From 9e1484c1b62f027991c93a56ddb13d084d0d9424 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Mon, 6 Mar 2023 09:28:51 +0500 Subject: [PATCH 16/21] pack config and backup to same snapshot ref https://github.com/rustic-rs/rustic/issues/463 --- plogical/Backupsv2.py | 25 ++++++++++++++++++------- serverStatus/views.py | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 0c1347d0d..3854c0813 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -336,7 +336,7 @@ pass = {ObsecurePassword} break except BaseException as msg: - self.UpdateStatus(f'Failed after config generation, Error: {str(msg)}', CPBackupsV2.FAILED) + self.UpdateStatus(f'Failed, Error: {str(msg)}', CPBackupsV2.FAILED) return 0 else: time.sleep(5) @@ -417,7 +417,12 @@ pass = {ObsecurePassword} command = f'chown {self.website.externalApp}:{self.website.externalApp} {CurrentDBPath}' ProcessUtilities.executioner(command) - command = f'rustic -r {self.repo} backup {CurrentDBPath} --password "" --json 2>/dev/null' + ## Now pack config into same thing + + command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' + ProcessUtilities.executioner(command) + + command = f'rustic -r {self.repo} backup {CurrentDBPath} {self.FinalPathRuctic}/config.json --password "" --json 2>/dev/null' print(f'db command rustic: {command}') result = json.loads( ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) @@ -429,7 +434,7 @@ pass = {ObsecurePassword} ### Config is saved with each database, snapshot of config is attached to db snapshot with parent - self.BackupConfig(SnapShotID) + #self.BackupConfig(SnapShotID) command = f'chown cyberpanel:cyberpanel {self.FinalPathRuctic}' ProcessUtilities.executioner(command) @@ -494,11 +499,14 @@ pass = {ObsecurePassword} source = f'/home/{self.website.domain}' + command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' + ProcessUtilities.executioner(command) + ## Pending add user provided folders in the exclude list exclude = f' --exclude-if-present rusticbackup --exclude-if-present logs ' - command = f'rustic -r {self.repo} backup {source} --password "" {exclude} --json 2>/dev/null' + command = f'rustic -r {self.repo} backup {source} {self.FinalPathRuctic}/config.json --password "" {exclude} --json 2>/dev/null' result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) try: @@ -508,7 +516,7 @@ pass = {ObsecurePassword} ### Config is saved with each backup, snapshot of config is attached to data snapshot with parent - self.BackupConfig(SnapShotID) + #self.BackupConfig(SnapShotID) except BaseException as msg: self.UpdateStatus(f'Backup failed as no snapshot id found, error: {str(msg)}', CPBackupsV2.FAILED) @@ -530,6 +538,9 @@ pass = {ObsecurePassword} command = f'rustic init -r {self.repo} --password ""' ProcessUtilities.executioner(command, self.website.externalApp) + command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' + ProcessUtilities.executioner(command) + source = f'/home/vmail/{self.website.domain}' @@ -537,7 +548,7 @@ pass = {ObsecurePassword} exclude = f' --exclude-if-present rusticbackup --exclude-if-present logs ' - command = f'rustic -r {self.repo} backup {source} --password "" {exclude} --json 2>/dev/null' + command = f'rustic -r {self.repo} backup {source} {self.FinalPathRuctic}/config.json --password "" {exclude} --json 2>/dev/null' result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) @@ -548,7 +559,7 @@ pass = {ObsecurePassword} ### Config is saved with each email backup, snapshot of config is attached to email snapshot with parent - self.BackupConfig(SnapShotID) + #self.BackupConfig(SnapShotID) except BaseException as msg: self.UpdateStatus(f'Backup failed as no snapshot id found, error: {str(msg)}', CPBackupsV2.FAILED) diff --git a/serverStatus/views.py b/serverStatus/views.py index 1e93cd190..39b0f0783 100755 --- a/serverStatus/views.py +++ b/serverStatus/views.py @@ -455,7 +455,7 @@ def refreshLicense(request): {'domain': 'cyberpanel.net', 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1, 'BackupEmails': 1, 'BackendName': 'testremote'}) RcloneData = {"name":'testremote', "host":"staging.cyberpanel.net", "user": "abcds2751", "port": "22", "password":"hosting",} - #cpbuv2.SetupRcloneBackend(CPBackupsV2.SFTP, RcloneData) + cpbuv2.SetupRcloneBackend(CPBackupsV2.SFTP, RcloneData) cpbuv2.InitiateBackup() From 1704edeac49ad97677e70081ba51648eeab1acbd Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Wed, 8 Mar 2023 11:39:36 +0500 Subject: [PATCH 17/21] add function to list repo snapshots --- plogical/Backupsv2.py | 11 ++++++++ plogical/mysqlUtilities.py | 52 +++++++++++++++++++++++++------------- 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 3854c0813..69f8f258f 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -44,6 +44,16 @@ class CPBackupsV2: self.repo = f"rclone:{self.data['BackendName']}:{self.data['domain']}" + + def FetchSnapShots(self): + try: + command = f'rustic -r {self.repo} snapshots --password "" --json 2>/dev/null' + result = json.loads( + ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) + return 1, result + except BaseException as msg: + return 0, str(msg) + def SetupRcloneBackend(self, type, config): self.LocalRclonePath = f'/home/{self.website.domain}/.config/rclone' self.ConfigFilePath = f'{self.LocalRclonePath}/rclone.conf' @@ -509,6 +519,7 @@ pass = {ObsecurePassword} command = f'rustic -r {self.repo} backup {source} {self.FinalPathRuctic}/config.json --password "" {exclude} --json 2>/dev/null' result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) + try: SnapShotID = result['id'] ## snapshot id that we need to store in db files_new = result['summary']['files_new'] ## basically new files in backup diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py index f09354c54..cda8ebb27 100755 --- a/plogical/mysqlUtilities.py +++ b/plogical/mysqlUtilities.py @@ -245,7 +245,7 @@ class mysqlUtilities: return str(msg) @staticmethod - def createDatabaseBackup(databaseName, tempStoragePath): + def createDatabaseBackup(databaseName, tempStoragePath, rustic=0, RusticRepoName = None, RusticConfigPath = None): try: passFile = "/etc/cyberpanel/mysqlPassword" @@ -284,26 +284,42 @@ password=%s os.chmod(cnfPath, 0o600) - command = 'mysqldump --defaults-extra-file=/home/cyberpanel/.my.cnf -u %s --host=%s --port %s %s' % (mysqluser, mysqlhost, mysqlport, databaseName) + SHELL = False + + if rustic == 0: + + command = 'mysqldump --defaults-extra-file=/home/cyberpanel/.my.cnf -u %s --host=%s --port %s %s' % (mysqluser, mysqlhost, mysqlport, databaseName) + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(command) + + cmd = shlex.split(command) + + try: + errorPath = '/home/cyberpanel/error-logs.txt' + errorLog = open(errorPath, 'a') + with open(tempStoragePath + "/" + databaseName + '.sql', 'w') as f: + res = subprocess.call(cmd, stdout=f, stderr=errorLog, shell=SHELL) + if res != 0: + logging.CyberCPLogFileWriter.writeToFile( + "Database: " + databaseName + "could not be backed! [createDatabaseBackup]") + return 0 + except subprocess.CalledProcessError as msg: + logging.CyberCPLogFileWriter.writeToFile( + "Database: " + databaseName + "could not be backed! Error: %s. [createDatabaseBackup]" % ( + str(msg))) + return 0 + + else: + SHELL = True + + command = f'mysqldump --defaults-extra-file=/home/cyberpanel/.my.cnf -u {mysqluser} --host={mysqlhost} --port {mysqlport} --add-drop-table --allow-keywords --complete-insert --quote-names --skip-comments {databaseName} | rustic -r {RusticRepoName} backup --stdin-filename {databaseName}.sql {RusticConfigPath} --password "" --json 2>/dev/null' + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(command) - if os.path.exists(ProcessUtilities.debugPath): - logging.CyberCPLogFileWriter.writeToFile(command) - cmd = shlex.split(command) - try: - errorPath = '/home/cyberpanel/error-logs.txt' - errorLog = open(errorPath, 'a') - with open(tempStoragePath+"/"+databaseName+'.sql', 'w') as f: - res = subprocess.call(cmd,stdout=f, stderr=errorLog) - if res != 0: - logging.CyberCPLogFileWriter.writeToFile( - "Database: " + databaseName + "could not be backed! [createDatabaseBackup]") - return 0 - except subprocess.CalledProcessError as msg: - logging.CyberCPLogFileWriter.writeToFile( - "Database: " + databaseName + "could not be backed! Error: %s. [createDatabaseBackup]" % (str(msg))) - return 0 return 1 except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[createDatabaseBackup]") From 2529414e81bab7984ebd86b20cd033e500c09623 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Wed, 8 Mar 2023 12:16:27 +0500 Subject: [PATCH 18/21] add function to list repo snapshots --- plogical/Backupsv2.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 69f8f258f..570d3ba8d 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -301,6 +301,9 @@ pass = {ObsecurePassword} #command = f"echo '{json.dumps(Config)}' > {self.FinalPath}/config.json" #ProcessUtilities.executioner(command, self.website.externalApp, True) + command = f'chown cyberpanel:cyberpanel {self.FinalPathRuctic}/config.json' + ProcessUtilities.executioner(command) + WriteToFile = open(f'{self.FinalPathRuctic}/config.json', 'w') WriteToFile.write(json.dumps(Config)) WriteToFile.close() From 70a13827cfa10db7c6f3b78cbe0eed2b1745cabf Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Thu, 9 Mar 2023 19:03:08 +0500 Subject: [PATCH 19/21] before changing for main db --- plogical/Backupsv2.py | 62 ++++++++++++++++++++++++++++++-------- plogical/mysqlUtilities.py | 17 +++++++++-- 2 files changed, 64 insertions(+), 15 deletions(-) diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 570d3ba8d..88e0990c1 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -43,6 +43,7 @@ class CPBackupsV2: ## Set up the repo name to be used self.repo = f"rclone:{self.data['BackendName']}:{self.data['domain']}" + self.snapshots = [] def FetchSnapShots(self): @@ -106,9 +107,8 @@ pass = {ObsecurePassword} self.buv2.website.BackupLock = 0 self.buv2.website.save() - ## parent is used to link this snapshot with master snapshot - def BackupConfig(self, parent): + def BackupConfig(self): ### Backup config file to rustic command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}' @@ -123,12 +123,38 @@ pass = {ObsecurePassword} command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' ProcessUtilities.executioner(command) - command = f'rustic -r {self.repo} backup {self.FinalPathRuctic}/config.json --password "" --tag {parent}' - ProcessUtilities.executioner(command, self.website.externalApp) + command = f'rustic -r {self.repo} backup {self.FinalPathRuctic}/config.json --password ""' + result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) + + try: + SnapShotID = result['id'] ## snapshot id that we need to store in db + files_new = result['summary']['files_new'] ## basically new files in backup + total_duration = result['summary']['total_duration'] ## time taken + + self.snapshots.append(SnapShotID) + + except BaseException as msg: + self.UpdateStatus(f'Backup failed as no snapshot id found, error: {str(msg)}', CPBackupsV2.FAILED) + return 0 command = f'chown cyberpanel:cyberpanel {self.FinalPathRuctic}/config.json' ProcessUtilities.executioner(command) + + def MergeSnapshots(self): + snapshots = '' + for snapshot in self.snapshots: + snapshots= f'{snapshots} {snapshot}' + + + + command = f'rustic -r {self.repo} merge {snapshots} --password ""' + result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) + + command = f'rustic -r {self.repo} forget {snapshots} --password ""' + result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) + + def InitiateBackup(self): from websiteFunctions.models import Websites, Backupsv2 @@ -311,6 +337,8 @@ pass = {ObsecurePassword} command = f"chmod 600 {self.FinalPathRuctic}/config.json" ProcessUtilities.executioner(command) + self.BackupConfig() + self.UpdateStatus('Backup config created,5', CPBackupsV2.RUNNING) except BaseException as msg: @@ -343,6 +371,8 @@ pass = {ObsecurePassword} command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}' ProcessUtilities.executioner(command) + self.MergeSnapshots() + self.UpdateStatus('Completed', CPBackupsV2.COMPLETED) print(self.FinalPath) @@ -432,10 +462,10 @@ pass = {ObsecurePassword} ## Now pack config into same thing - command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' - ProcessUtilities.executioner(command) + #command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' + #ProcessUtilities.executioner(command) - command = f'rustic -r {self.repo} backup {CurrentDBPath} {self.FinalPathRuctic}/config.json --password "" --json 2>/dev/null' + command = f'rustic -r {self.repo} backup {CurrentDBPath} --password "" --json 2>/dev/null' print(f'db command rustic: {command}') result = json.loads( ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) @@ -445,6 +475,8 @@ pass = {ObsecurePassword} files_new = result['summary']['files_new'] ## basically new files in backup total_duration = result['summary']['total_duration'] ## time taken + self.snapshots.append(SnapShotID) + ### Config is saved with each database, snapshot of config is attached to db snapshot with parent #self.BackupConfig(SnapShotID) @@ -512,14 +544,14 @@ pass = {ObsecurePassword} source = f'/home/{self.website.domain}' - command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' - ProcessUtilities.executioner(command) + #command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' + #ProcessUtilities.executioner(command) ## Pending add user provided folders in the exclude list exclude = f' --exclude-if-present rusticbackup --exclude-if-present logs ' - command = f'rustic -r {self.repo} backup {source} {self.FinalPathRuctic}/config.json --password "" {exclude} --json 2>/dev/null' + command = f'rustic -r {self.repo} backup {source} --password "" {exclude} --json 2>/dev/null' result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) @@ -528,6 +560,8 @@ pass = {ObsecurePassword} files_new = result['summary']['files_new'] ## basically new files in backup total_duration = result['summary']['total_duration'] ## time taken + self.snapshots.append(SnapShotID) + ### Config is saved with each backup, snapshot of config is attached to data snapshot with parent #self.BackupConfig(SnapShotID) @@ -552,8 +586,8 @@ pass = {ObsecurePassword} command = f'rustic init -r {self.repo} --password ""' ProcessUtilities.executioner(command, self.website.externalApp) - command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' - ProcessUtilities.executioner(command) + #command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' + #ProcessUtilities.executioner(command) source = f'/home/vmail/{self.website.domain}' @@ -562,7 +596,7 @@ pass = {ObsecurePassword} exclude = f' --exclude-if-present rusticbackup --exclude-if-present logs ' - command = f'rustic -r {self.repo} backup {source} {self.FinalPathRuctic}/config.json --password "" {exclude} --json 2>/dev/null' + command = f'rustic -r {self.repo} backup {source} --password "" {exclude} --json 2>/dev/null' result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) @@ -571,6 +605,8 @@ pass = {ObsecurePassword} files_new = result['summary']['files_new'] ## basically new files in backup total_duration = result['summary']['total_duration'] ## time taken + self.snapshots.append(SnapShotID) + ### Config is saved with each email backup, snapshot of config is attached to email snapshot with parent #self.BackupConfig(SnapShotID) diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py index cda8ebb27..62efd3f1c 100755 --- a/plogical/mysqlUtilities.py +++ b/plogical/mysqlUtilities.py @@ -245,7 +245,7 @@ class mysqlUtilities: return str(msg) @staticmethod - def createDatabaseBackup(databaseName, tempStoragePath, rustic=0, RusticRepoName = None, RusticConfigPath = None): + def createDatabaseBackup(databaseName, tempStoragePath, rustic=0, RusticRepoName = None): try: passFile = "/etc/cyberpanel/mysqlPassword" @@ -313,11 +313,24 @@ password=%s else: SHELL = True - command = f'mysqldump --defaults-extra-file=/home/cyberpanel/.my.cnf -u {mysqluser} --host={mysqlhost} --port {mysqlport} --add-drop-table --allow-keywords --complete-insert --quote-names --skip-comments {databaseName} | rustic -r {RusticRepoName} backup --stdin-filename {databaseName}.sql {RusticConfigPath} --password "" --json 2>/dev/null' + command = f'mysqldump --defaults-extra-file=/home/cyberpanel/.my.cnf -u {mysqluser} --host={mysqlhost} --port {mysqlport} --add-drop-table --allow-keywords --complete-insert --quote-names --skip-comments {databaseName} | rustic -r {RusticRepoName} backup --stdin-filename {databaseName}.sql --password "" --json 2>/dev/null' if os.path.exists(ProcessUtilities.debugPath): logging.CyberCPLogFileWriter.writeToFile(command) + result = json.loads( + ProcessUtilities.outputExecutioner(command, None, True).rstrip('\n')) + + try: + SnapShotID = result['id'] ## snapshot id that we need to store in db + files_new = result['summary']['files_new'] ## basically new files in backup + total_duration = result['summary']['total_duration'] ## time taken + + return 1, SnapShotID + + except BaseException as msg: + return 0, str(msg) + return 1 From 53caf09e825647561eb6e165628df6a2da4c18e7 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Thu, 9 Mar 2023 21:09:13 +0500 Subject: [PATCH 20/21] use restic merge for combining backups from https://community.cyberpanel.net/t/cyberpanel-backups-v2-proposal/40370/95?u=usmannasir --- plogical/Backupsv2.py | 84 +++++++++++++++++++------------------- plogical/mysqlUtilities.py | 4 +- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 88e0990c1..1a80e6f12 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -123,7 +123,7 @@ pass = {ObsecurePassword} command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' ProcessUtilities.executioner(command) - command = f'rustic -r {self.repo} backup {self.FinalPathRuctic}/config.json --password ""' + command = f'rustic -r {self.repo} backup {self.FinalPathRuctic}/config.json --json --password "" 2>/dev/null' result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) try: @@ -147,12 +147,11 @@ pass = {ObsecurePassword} snapshots= f'{snapshots} {snapshot}' - - command = f'rustic -r {self.repo} merge {snapshots} --password ""' + command = f'rustic -r {self.repo} merge {snapshots} --password "" --json 2>/dev/null' result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) command = f'rustic -r {self.repo} forget {snapshots} --password ""' - result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) + result = ProcessUtilities.outputExecutioner(command, self.website.externalApp, True) def InitiateBackup(self): @@ -360,11 +359,11 @@ pass = {ObsecurePassword} return 0 self.UpdateStatus('Website data backup completed successfully..,70', CPBackupsV2.RUNNING) - if self.data['BackupEmails']: - self.UpdateStatus('Backing up emails..,75', CPBackupsV2.RUNNING) - if self.BackupEmailsRustic() == 0: - return 0 - self.UpdateStatus('Emails backup completed successfully..,85', CPBackupsV2.RUNNING) + # if self.data['BackupEmails']: + # self.UpdateStatus('Backing up emails..,75', CPBackupsV2.RUNNING) + # if self.BackupEmailsRustic() == 0: + # return 0 + # self.UpdateStatus('Emails backup completed successfully..,85', CPBackupsV2.RUNNING) ### Finally change the backup rustic folder to the website user owner @@ -452,49 +451,50 @@ pass = {ObsecurePassword} CurrentDBPath = f"{self.FinalPathRuctic}/{key}.sql" - DBResult = mysqlUtilities.createDatabaseBackup(key, self.FinalPathRuctic) + DBResult, SnapID = mysqlUtilities.createDatabaseBackup(key, self.FinalPathRuctic, 1, self.repo, self.website.externalApp) if DBResult == 1: + self.snapshots.append(SnapID) - command = f'chown {self.website.externalApp}:{self.website.externalApp} {CurrentDBPath}' - ProcessUtilities.executioner(command) + #command = f'chown {self.website.externalApp}:{self.website.externalApp} {CurrentDBPath}' + #ProcessUtilities.executioner(command) ## Now pack config into same thing #command = f'chown {self.website.externalApp}:{self.website.externalApp} {self.FinalPathRuctic}/config.json' #ProcessUtilities.executioner(command) - command = f'rustic -r {self.repo} backup {CurrentDBPath} --password "" --json 2>/dev/null' - print(f'db command rustic: {command}') - result = json.loads( - ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) - - try: - SnapShotID = result['id'] ## snapshot id that we need to store in db - files_new = result['summary']['files_new'] ## basically new files in backup - total_duration = result['summary']['total_duration'] ## time taken - - self.snapshots.append(SnapShotID) - - ### Config is saved with each database, snapshot of config is attached to db snapshot with parent - - #self.BackupConfig(SnapShotID) - - command = f'chown cyberpanel:cyberpanel {self.FinalPathRuctic}' - ProcessUtilities.executioner(command) - - except BaseException as msg: - self.UpdateStatus(f'Backup failed as no snapshot id found, error: {str(msg)}', - CPBackupsV2.FAILED) - return 0 - - - for dbUsers in value: - print(f'User: {dbUsers["user"]}, Host: {dbUsers["host"]}, Pass: {dbUsers["password"]}') - - command = f'rm -f {CurrentDBPath}' - ProcessUtilities.executioner(command) + # command = f'rustic -r {self.repo} backup {CurrentDBPath} --password "" --json 2>/dev/null' + # print(f'db command rustic: {command}') + # result = json.loads( + # ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) + # + # try: + # SnapShotID = result['id'] ## snapshot id that we need to store in db + # files_new = result['summary']['files_new'] ## basically new files in backup + # total_duration = result['summary']['total_duration'] ## time taken + # + # self.snapshots.append(SnapShotID) + # + # ### Config is saved with each database, snapshot of config is attached to db snapshot with parent + # + # #self.BackupConfig(SnapShotID) + # + # command = f'chown cyberpanel:cyberpanel {self.FinalPathRuctic}' + # ProcessUtilities.executioner(command) + # + # except BaseException as msg: + # self.UpdateStatus(f'Backup failed as no snapshot id found, error: {str(msg)}', + # CPBackupsV2.FAILED) + # return 0 + # + # + # for dbUsers in value: + # print(f'User: {dbUsers["user"]}, Host: {dbUsers["host"]}, Pass: {dbUsers["password"]}') + # + # command = f'rm -f {CurrentDBPath}' + # ProcessUtilities.executioner(command) else: command = f'rm -f {CurrentDBPath}' diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py index 62efd3f1c..2be4a3cec 100755 --- a/plogical/mysqlUtilities.py +++ b/plogical/mysqlUtilities.py @@ -245,7 +245,7 @@ class mysqlUtilities: return str(msg) @staticmethod - def createDatabaseBackup(databaseName, tempStoragePath, rustic=0, RusticRepoName = None): + def createDatabaseBackup(databaseName, tempStoragePath, rustic=0, RusticRepoName = None, externalApp = None): try: passFile = "/etc/cyberpanel/mysqlPassword" @@ -313,7 +313,7 @@ password=%s else: SHELL = True - command = f'mysqldump --defaults-extra-file=/home/cyberpanel/.my.cnf -u {mysqluser} --host={mysqlhost} --port {mysqlport} --add-drop-table --allow-keywords --complete-insert --quote-names --skip-comments {databaseName} | rustic -r {RusticRepoName} backup --stdin-filename {databaseName}.sql --password "" --json 2>/dev/null' + command = f'mysqldump --defaults-extra-file=/home/cyberpanel/.my.cnf -u {mysqluser} --host={mysqlhost} --port {mysqlport} --add-drop-table --allow-keywords --complete-insert --quote-names --skip-comments {databaseName} | sudo -u {externalApp} rustic -r {RusticRepoName} backup --stdin-filename {databaseName}.sql - --password "" --json 2>/dev/null' if os.path.exists(ProcessUtilities.debugPath): logging.CyberCPLogFileWriter.writeToFile(command) From 2fd47d7e40486c5f51caefa1d82b8bd2d38e5100 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Fri, 10 Mar 2023 14:37:03 +0500 Subject: [PATCH 21/21] prevent email backup for now --- plogical/Backupsv2.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 1a80e6f12..2ff3c33e4 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -140,7 +140,6 @@ pass = {ObsecurePassword} command = f'chown cyberpanel:cyberpanel {self.FinalPathRuctic}/config.json' ProcessUtilities.executioner(command) - def MergeSnapshots(self): snapshots = '' for snapshot in self.snapshots: @@ -153,7 +152,6 @@ pass = {ObsecurePassword} command = f'rustic -r {self.repo} forget {snapshots} --password ""' result = ProcessUtilities.outputExecutioner(command, self.website.externalApp, True) - def InitiateBackup(self): from websiteFunctions.models import Websites, Backupsv2 @@ -596,9 +594,9 @@ pass = {ObsecurePassword} exclude = f' --exclude-if-present rusticbackup --exclude-if-present logs ' - command = f'rustic -r {self.repo} backup {source} --password "" {exclude} --json 2>/dev/null' + command = f'rustic -P /home/{self.website.domain}/.config/rclone/rclone.conf -r {self.repo} backup {source} --password "" {exclude} --json 2>/dev/null' - result = json.loads(ProcessUtilities.outputExecutioner(command, self.website.externalApp, True).rstrip('\n')) + result = json.loads(ProcessUtilities.outputExecutioner(command, None, True).rstrip('\n')) try: SnapShotID = result['id'] ## snapshot id that we need to store in db