backups: add mount configuration and status

This commit is contained in:
Girish Ramakrishnan
2021-05-17 15:24:19 -07:00
parent a3ea2a32f1
commit a54a404dac
2 changed files with 74 additions and 17 deletions

View File

@@ -96,8 +96,10 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
{ name: 'Backblaze B2 (S3 API)', value: 'backblaze-b2' },
{ name: 'CIFS Mount', value: 'cifs' },
{ name: 'DigitalOcean Spaces', value: 'digitalocean-spaces' },
{ name: 'EXT4 Disk', value: 'ext4' },
{ name: 'Exoscale SOS', value: 'exoscale-sos' },
{ name: 'Filesystem', value: 'filesystem' },
{ name: 'Filesystem (Mountpoint)', value: 'mountpoint' }, // legacy
{ name: 'Google Cloud Storage', value: 'gcs' },
{ name: 'IONOS (Profitbricks)', value: 'ionos-objectstorage' },
{ name: 'Linode Object Storage', value: 'linode-objectstorage' },
@@ -287,7 +289,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
};
$scope.mountlike = function (provider) {
return provider === 'sshfs' || provider === 'cifs' || provider === 'nfs';
return provider === 'sshfs' || provider === 'cifs' || provider === 'nfs' || provider === 'mountpoint' || provider === 'ext4';
};
// https://stackoverflow.com/questions/3665115/how-to-create-a-file-in-memory-for-user-to-download-but-not-through-server#18197341
@@ -413,7 +415,6 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
mountPoint: '',
acceptSelfSignedCerts: false,
useHardlinks: true,
externalDisk: false,
format: 'tgz',
password: '',
passwordRepeat: '',
@@ -427,6 +428,14 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
downloadConcurrency: '',
syncConcurrency: '', // sort of similar to upload
mountOptions: {
host: '',
remoteDir: '',
username: '',
password: '',
diskPath: ''
},
clearProviderFields: function () {
$scope.configureBackup.bucket = '';
$scope.configureBackup.prefix = '';
@@ -440,7 +449,6 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.configureBackup.mountPoint = '';
$scope.configureBackup.acceptSelfSignedCerts = false;
$scope.configureBackup.useHardlinks = true;
$scope.configureBackup.externalDisk = false;
$scope.configureBackup.memoryLimit = 400 * 1024 * 1024;
// scaleway only supports 1000 parts per object (https://www.scaleway.com/en/docs/s3-multipart-upload/)
@@ -448,6 +456,8 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.configureBackup.downloadConcurrency = $scope.configureBackup.provider === 's3' ? 30 : 10;
$scope.configureBackup.syncConcurrency = $scope.configureBackup.provider === 's3' ? 20 : 10;
$scope.configureBackup.copyConcurrency = $scope.configureBackup.provider === 's3' ? 500 : 10;
$scope.configureBackup.mount = { host: '', remoteDir: '', username: '', password: '', diskPath: '' };
},
show: function () {
@@ -478,7 +488,6 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.configureBackup.format = $scope.backupConfig.format;
$scope.configureBackup.acceptSelfSignedCerts = !!$scope.backupConfig.acceptSelfSignedCerts;
$scope.configureBackup.useHardlinks = !$scope.backupConfig.noHardlinks;
$scope.configureBackup.externalDisk = !!$scope.backupConfig.externalDisk;
$scope.configureBackup.memoryLimit = $scope.backupConfig.memoryLimit;
@@ -498,6 +507,14 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.configureBackup.uploadPartSizeTicks.push(j * 1024 * 1024);
}
var mountOptions = $scope.backupConfig.mountOptions || {};
$scope.configureBackup.mount = {
host: mountOptions.host || '',
remoteDir: mountOptions.remoteDir || '',
username: mountOptions.username || '',
password: mountOptions.password || '',
diskPath: mountOptions.diskPath || ''
};
$('#configureBackupModal').modal('show');
},
@@ -573,14 +590,26 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.configureBackup.busy = false;
return;
}
} else if (backupConfig.provider === 'sshfs' || backupConfig.provider === 'cifs' || backupConfig.provider === 'nfs') {
} else if ($scope.mountlike(backupConfig.provider)) {
backupConfig.mountPoint = $scope.configureBackup.mountPoint;
backupConfig.prefix = $scope.configureBackup.prefix;
backupConfig.noHardlinks = !$scope.configureBackup.useHardlinks;
} else if (backupConfig.provider === 'filesystem') {
backupConfig.mountOptions = {};
if (backupConfig.provider === 'cifs' || backupConfig.provider === 'sshfs' || backupConfig.provider === 'nfs') {
backupConfig.mountOptions.host = $scope.configureBackup.mountOptions.host;
backupConfig.mountOptions.remoteDir = $scope.configureBackup.mountOptions.remoteDir;
if (backupConfig.provider === 'cifs') {
backupConfig.mountOptions.username = $scope.configureBackup.mountOptions.username;
backupConfig.mountOptions.password = $scope.configureBackup.mountOptions.password;
}
} else if (backupConfig.provider === 'ext4') {
backupConfig.mountOptions.diskPath = $scope.configureBackup.diskPath;
}
} else if (backupConfig.provider === 'filesystem' || backupConfig.provider === 'mountpoint') {
backupConfig.backupFolder = $scope.configureBackup.backupFolder;
backupConfig.noHardlinks = !$scope.configureBackup.useHardlinks;
backupConfig.externalDisk = $scope.configureBackup.externalDisk;
}
backupConfig.uploadPartSize = $scope.configureBackup.uploadPartSize;