Merge remote-tracking branch 'origin/db-pools-backups' into db-pools-backups

This commit is contained in:
shimon
2023-10-24 00:09:37 +03:00
2 changed files with 5 additions and 4 deletions
+2
View File
@@ -856,6 +856,8 @@ services:
environment:
- _APP_CONNECTIONS_DB_REPLICAS
- _APP_CONNECTIONS_BACKUPS_STORAGE
- _APP_LOGGING_PROVIDER
- _APP_LOGGING_CONFIG
appwrite-restore:
command: sleep infinity
+3 -4
View File
@@ -18,8 +18,8 @@ class Backup extends Action
public const BACKUPS_PATH = '/backups';
public const BACKUP_INTERVAL_SECONDS = 60 * 60 * 4; // 4 hours;
public const COMPRESS_ALGORITHM = 'zstd'; // https://www.percona.com/blog/get-your-backup-to-half-of-its-size-introducing-zstd-support-in-percona-xtrabackup/
public const CLEANUP_LOCAL_FILES_SECONDS = 60 * 60 * 24 * 30; // 2 days?
public const CLEANUP_CLOUD_FILES_SECONDS = 60 * 60 * 24 * 30; // 14 days?;
public const CLEANUP_LOCAL_FILES_SECONDS = 60 * 60 * 24 * 7;
public const CLEANUP_CLOUD_FILES_SECONDS = 60 * 60 * 24 * 7;
public const UPLOAD_CHUNK_SIZE = 5 * 1024 * 1024; // Must be greater than 5MB;
public const RETRY_BACKUP = 1;
public const RETRY_TAR = 1;
@@ -374,8 +374,7 @@ class Backup extends Action
self::log('Clean cloud start');
$start = microtime(true);
$files = $this->s3->getFiles($this->s3->getRoot());
if ($files['KeyCount'] > 0) {
if ($files['KeyCount'] > 1) { // Bug when is one returned it returns an object not an array!
foreach ($files['Contents'] as $file) {
$date = basename(basename($file['Key']), '.tar.gz');
if ($this->isDelete($date, self::CLEANUP_CLOUD_FILES_SECONDS)) {