diff --git a/docker-compose.yml b/docker-compose.yml index be732b302c..5de7c6b9e3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/src/Appwrite/Platform/Tasks/Backup.php b/src/Appwrite/Platform/Tasks/Backup.php index 3eeb6755fa..32bdbd7c9d 100644 --- a/src/Appwrite/Platform/Tasks/Backup.php +++ b/src/Appwrite/Platform/Tasks/Backup.php @@ -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)) {