From 4461c8c0f69e136031a31f543714aba56c4f0fef Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 20:26:06 +0530 Subject: [PATCH 1/8] feat: add new env vars for audit and abuse logs --- .env | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 5ce3837137..436098cbe3 100644 --- a/.env +++ b/.env @@ -30,4 +30,6 @@ _APP_FUNCTIONS_CONTAINERS=10 _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 -_APP_MAINTENANCE_INTERVAL=86400 +_APP_MAINTENANCE_EXECUTION_LOG_RETENTION=60 +_APP_MAINTENANCE_ABUSE_LOG_RETENTION=60 +_APP_MAINTENANCE_AUDIT_LOG_RETENTION=60 From e85fc0282eeb1e11a037d47955606c4cab15fa55 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 20:31:08 +0530 Subject: [PATCH 2/8] feat: add description of new env variables --- app/config/variables.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 6215b18f7c..a52f1950c5 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -357,13 +357,29 @@ return [ 'description' => '', 'variables' => [ [ - 'name' => '_APP_MAINTENANCE_INTERVAL', - 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before executing system cleanups and optimizations. The default value is 86400 seconds (1 day).', + 'name' => '_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the execution logs. The default value is 1209600 seconds (14 days).', + 'introduction' => '0.7.0', + 'default' => '1209600', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_MAINTENANCE_AUDIT_LOG_RETENTION', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the audit logs. The default value is 1209600 seconds (14 days).', + 'introduction' => '0.7.0', + 'default' => '1209600', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_MAINTENANCE_ABUSE_LOG_RETENTION', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the abuse logs. The default value is 86400 seconds (1 day).', 'introduction' => '0.7.0', 'default' => '86400', 'required' => false, 'question' => '', - ], + ] ], ], ], From 04f14816d78d98f97eee98d4b38d74fa1bc5b0a9 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 20:58:52 +0530 Subject: [PATCH 3/8] feat: add filter to delete execution logs older than --- Dockerfile | 5 ++++- app/tasks/maintenance.php | 44 ++++++++++++++++++++++++++------------- app/workers/deletes.php | 9 ++++---- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0017d68dcb..d8ab69bbb0 100755 --- a/Dockerfile +++ b/Dockerfile @@ -100,8 +100,11 @@ ENV _APP_SERVER=swoole \ _APP_SETUP=self-hosted \ _APP_VERSION=$VERSION \ _APP_USAGE_STATS=enabled \ + # 14 Days = 1209600 s + _APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 \ + _APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 \ # 1 Day = 86400 s - _APP_MAINTENANCE_INTERVAL=86400 + _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 \ #ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_USERNAME '' #ENV _APP_SMTP_PASSWORD '' diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index 34c34cfb83..cc15a4dced 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -12,26 +12,27 @@ Console::title('Maintenance V1'); Console::success(APP_NAME.' maintenance process v1 has started'); -function notifyDeleteExecutionLogs() +function notifyDeleteExecutionLogs(int $retention) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ - 'type' => DELETE_TYPE_EXECUTIONS + 'type' => DELETE_TYPE_EXECUTIONS, + 'timestamp' => time() - $retention ]); } -function notifyDeleteAbuseLogs(int $interval) +function notifyDeleteAbuseLogs(int $retention) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ 'type' => DELETE_TYPE_ABUSE, - 'timestamp' => time() - $interval + 'timestamp' => time() - $retention ]); } -function notifyDeleteAuditLogs(int $interval) +function notifyDeleteAuditLogs(int $retention) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ 'type' => DELETE_TYPE_AUDIT, - 'timestamp' => time() - $interval + 'timestamp' => time() - $retention ]); } @@ -40,15 +41,30 @@ $cli ->desc('Schedules maintenance tasks and publishes them to resque') ->action(function () { // # of days in seconds (1 day = 86400s) - $interval = (int) App::getEnv('_APP_MAINTENANCE_INTERVAL', '86400'); + // $executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', '60'); + $executionLogsRetention = 120; + $abuseLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_ABUSE_LOG_RETENTION', '60'); + $auditLogRetention = (int) App::getEnv('_APP_MAINTENANCE_AUDIT_LOG_RETENTION', '60'); - Console::loop(function() use ($interval){ + // Schedule delete execution logs + Console::loop(function() use ($executionLogsRetention){ $time = date('d-m-Y H:i:s', time()); - Console::info("[{$time}] Notifying deletes workers every {$interval} seconds"); - notifyDeleteExecutionLogs(); - notifyDeleteAbuseLogs($interval); - notifyDeleteAuditLogs($interval); - - }, $interval); + Console::info("[{$time}] Notifying deletes workers every {$executionLogsRetention} seconds"); + notifyDeleteExecutionLogs($executionLogsRetention); + }, $executionLogsRetention); + + // // Schedule delete abuse logs + // Console::loop(function() use ($abuseLogsRetention){ + // $time = date('d-m-Y H:i:s', time()); + // Console::info("[{$time}] Notifying deletes workers every {$abuseLogsRetention} seconds"); + // notifyDeleteAbuseLogs($abuseLogsRetention); + // }, $abuseLogsRetention); + + // // Schedule delete audit logs + // Console::loop(function() use ($auditLogRetention){ + // $time = date('d-m-Y H:i:s', time()); + // Console::info("[{$time}] Notifying deletes workers every {$auditLogRetention} seconds"); + // notifyDeleteAuditLogs($auditLogRetention); + // }, $auditLogRetention); }); \ No newline at end of file diff --git a/app/workers/deletes.php b/app/workers/deletes.php index cf9aa2c453..ac168d6bcb 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -59,7 +59,7 @@ class DeletesV1 break; case DELETE_TYPE_EXECUTIONS: - $this->deleteExecutionLogs(); + $this->deleteExecutionLogs($this->args['timestamp']); break; case DELETE_TYPE_AUDIT: @@ -121,16 +121,17 @@ class DeletesV1 ], $this->getProjectDB($projectId)); } - protected function deleteExecutionLogs() + protected function deleteExecutionLogs($timestamp) { - $this->deleteForProjectIds(function($projectId) { + $this->deleteForProjectIds(function($projectId) use ($timestamp) { if (!($projectDB = $this->getProjectDB($projectId))) { throw new Exception('Failed to get projectDB for project '.$projectId); } // Delete Executions $this->deleteByGroup([ - '$collection='.Database::SYSTEM_COLLECTION_EXECUTIONS + '$collection='.Database::SYSTEM_COLLECTION_EXECUTIONS, + 'dateCreated<'.$timestamp ], $projectDB); }); } From 395c3225b7172d43c2ee34e919d56f4bf221dd6f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 21:00:09 +0530 Subject: [PATCH 4/8] feat: added env variables to docker-compose --- docker-compose.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e9d82cbf0f..8d2de20462 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -328,7 +328,9 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_MAINTENANCE_INTERVAL + - _APP_MAINTENANCE_EXECUTION_LOG_RETENTION + - _APP_MAINTENANCE_ABUSE_LOG_RETENTION + - _APP_MAINTENANCE_AUDIT_LOG_RETENTION appwrite-schedule: entrypoint: schedule From 68b7e22b90e47b0cc3a3aa363509d1ff5917b52e Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 21:16:05 +0530 Subject: [PATCH 5/8] feat: update default env var values --- .env | 6 +++--- Dockerfile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 07fb4a7a60..92aaee3ae2 100644 --- a/.env +++ b/.env @@ -34,7 +34,7 @@ _APP_FUNCTIONS_CONTAINERS=10 _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 -_APP_MAINTENANCE_EXECUTION_LOG_RETENTION=60 -_APP_MAINTENANCE_ABUSE_LOG_RETENTION=60 -_APP_MAINTENANCE_AUDIT_LOG_RETENTION=60 +_APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 +_APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 +_APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 _APP_USAGE_STATS=enabled diff --git a/Dockerfile b/Dockerfile index d8ab69bbb0..c116e34fb2 100755 --- a/Dockerfile +++ b/Dockerfile @@ -104,7 +104,7 @@ ENV _APP_SERVER=swoole \ _APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 \ _APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 \ # 1 Day = 86400 s - _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 \ + _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 #ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_USERNAME '' #ENV _APP_SMTP_PASSWORD '' From 0156e00a9d8824eaf3939dc89b4b1f2221e393c5 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 23:27:49 +0530 Subject: [PATCH 6/8] feat: update default env var values --- .env | 1 + Dockerfile | 3 ++- app/config/variables.php | 10 ++++++++- app/tasks/maintenance.php | 44 +++++++++++++-------------------------- docker-compose.yml | 1 + 5 files changed, 28 insertions(+), 31 deletions(-) diff --git a/.env b/.env index 92aaee3ae2..d514529a91 100644 --- a/.env +++ b/.env @@ -34,6 +34,7 @@ _APP_FUNCTIONS_CONTAINERS=10 _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 +_APP_MAINTENANCE_INTERVAL=86400 _APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 _APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 diff --git a/Dockerfile b/Dockerfile index c116e34fb2..0f97e3ec48 100755 --- a/Dockerfile +++ b/Dockerfile @@ -104,7 +104,8 @@ ENV _APP_SERVER=swoole \ _APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 \ _APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 \ # 1 Day = 86400 s - _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 + _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 \ + _APP_MAINTENANCE_INTERVAL=86400 #ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_USERNAME '' #ENV _APP_SMTP_PASSWORD '' diff --git a/app/config/variables.php b/app/config/variables.php index a52f1950c5..f662d57689 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -356,9 +356,17 @@ return [ 'category' => 'Maintenance', 'description' => '', 'variables' => [ + [ + 'name' => '_APP_MAINTENANCE_INTERVAL', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before executing system cleanups and optimizations. The default value is 86400 seconds (1 day).', + 'introduction' => '0.7.0', + 'default' => '86400', + 'required' => false, + 'question' => '', + ], [ 'name' => '_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', - 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the execution logs. The default value is 1209600 seconds (14 days).', + 'description' => 'The maximum time period . The default value is 1209600 seconds (14 days).', 'introduction' => '0.7.0', 'default' => '1209600', 'required' => false, diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index cc15a4dced..df4005593d 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -12,27 +12,27 @@ Console::title('Maintenance V1'); Console::success(APP_NAME.' maintenance process v1 has started'); -function notifyDeleteExecutionLogs(int $retention) +function notifyDeleteExecutionLogs(int $interval) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ 'type' => DELETE_TYPE_EXECUTIONS, - 'timestamp' => time() - $retention + 'timestamp' => time() - $interval ]); } -function notifyDeleteAbuseLogs(int $retention) +function notifyDeleteAbuseLogs(int $interval) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ 'type' => DELETE_TYPE_ABUSE, - 'timestamp' => time() - $retention + 'timestamp' => time() - $interval ]); } -function notifyDeleteAuditLogs(int $retention) +function notifyDeleteAuditLogs(int $interval) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ 'type' => DELETE_TYPE_AUDIT, - 'timestamp' => time() - $retention + 'timestamp' => time() - $interval ]); } @@ -41,30 +41,16 @@ $cli ->desc('Schedules maintenance tasks and publishes them to resque') ->action(function () { // # of days in seconds (1 day = 86400s) - // $executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', '60'); - $executionLogsRetention = 120; - $abuseLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_ABUSE_LOG_RETENTION', '60'); - $auditLogRetention = (int) App::getEnv('_APP_MAINTENANCE_AUDIT_LOG_RETENTION', '60'); + $interval = (int) App::getEnv('_APP_MAINTENANCE_INTERVAL', '86400'); + $executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', '1209600'); + $auditLogRetention = (int) App::getEnv('_APP_MAINTENANCE_AUDIT_LOG_RETENTION', '1209600'); + $abuseLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_ABUSE_LOG_RETENTION', '86400'); - // Schedule delete execution logs - Console::loop(function() use ($executionLogsRetention){ + Console::loop(function() use ($interval, $executionLogsRetention, $abuseLogsRetention, $auditLogRetention){ $time = date('d-m-Y H:i:s', time()); - Console::info("[{$time}] Notifying deletes workers every {$executionLogsRetention} seconds"); + Console::info("[{$time}] Notifying deletes workers every {$interval} seconds"); notifyDeleteExecutionLogs($executionLogsRetention); - }, $executionLogsRetention); - - // // Schedule delete abuse logs - // Console::loop(function() use ($abuseLogsRetention){ - // $time = date('d-m-Y H:i:s', time()); - // Console::info("[{$time}] Notifying deletes workers every {$abuseLogsRetention} seconds"); - // notifyDeleteAbuseLogs($abuseLogsRetention); - // }, $abuseLogsRetention); - - // // Schedule delete audit logs - // Console::loop(function() use ($auditLogRetention){ - // $time = date('d-m-Y H:i:s', time()); - // Console::info("[{$time}] Notifying deletes workers every {$auditLogRetention} seconds"); - // notifyDeleteAuditLogs($auditLogRetention); - // }, $auditLogRetention); - + notifyDeleteAbuseLogs($abuseLogsRetention); + notifyDeleteAuditLogs($auditLogRetention); + }, $interval); }); \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8d2de20462..9d47f10245 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -328,6 +328,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_EXECUTION_LOG_RETENTION - _APP_MAINTENANCE_ABUSE_LOG_RETENTION - _APP_MAINTENANCE_AUDIT_LOG_RETENTION From f538c1d2bfe73f84a38a1d8e6ba76f7367cbd366 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 23:45:30 +0530 Subject: [PATCH 7/8] feat: update env var description --- app/config/variables.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index f662d57689..5b710ad3f0 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -366,7 +366,7 @@ return [ ], [ 'name' => '_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', - 'description' => 'The maximum time period . The default value is 1209600 seconds (14 days).', + 'description' => 'The maximum duration (in seconds) upto which to retain execution logs. The default value is 1209600 seconds (14 days).', 'introduction' => '0.7.0', 'default' => '1209600', 'required' => false, @@ -374,7 +374,7 @@ return [ ], [ 'name' => '_APP_MAINTENANCE_AUDIT_LOG_RETENTION', - 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the audit logs. The default value is 1209600 seconds (14 days).', + 'description' => 'IThe maximum duration (in seconds) upto which to retain audit logs. The default value is 1209600 seconds (14 days).', 'introduction' => '0.7.0', 'default' => '1209600', 'required' => false, @@ -382,7 +382,7 @@ return [ ], [ 'name' => '_APP_MAINTENANCE_ABUSE_LOG_RETENTION', - 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the abuse logs. The default value is 86400 seconds (1 day).', + 'description' => 'The maximum duration (in seconds) upto which to retain abuse logs. The default value is 86400 seconds (1 day).', 'introduction' => '0.7.0', 'default' => '86400', 'required' => false, From 2a29e10007a7d9bad68c9f9c9938c6c0a452dbf8 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 23:53:48 +0530 Subject: [PATCH 8/8] feat: review comments --- .env | 6 +++--- Dockerfile | 6 +++--- app/config/variables.php | 6 +++--- app/tasks/maintenance.php | 6 +++--- app/views/install/compose.phtml | 9 ++++----- docker-compose.yml | 6 +++--- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.env b/.env index d514529a91..3406ba1004 100644 --- a/.env +++ b/.env @@ -35,7 +35,7 @@ _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 _APP_MAINTENANCE_INTERVAL=86400 -_APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 -_APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 -_APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 +_APP_MAINTENANCE_RETENTION_EXECUTION=1209600 +_APP_MAINTENANCE_RETENTION_ABUSE=86400 +_APP_MAINTENANCE_RETENTION_AUDIT=1209600 _APP_USAGE_STATS=enabled diff --git a/Dockerfile b/Dockerfile index 0f97e3ec48..c7316bd1d4 100755 --- a/Dockerfile +++ b/Dockerfile @@ -101,10 +101,10 @@ ENV _APP_SERVER=swoole \ _APP_VERSION=$VERSION \ _APP_USAGE_STATS=enabled \ # 14 Days = 1209600 s - _APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 \ - _APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 \ + _APP_MAINTENANCE_RETENTION_EXECUTION=1209600 \ + _APP_MAINTENANCE_RETENTION_AUDIT=1209600 \ # 1 Day = 86400 s - _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 \ + _APP_MAINTENANCE_RETENTION_ABUSE=86400 \ _APP_MAINTENANCE_INTERVAL=86400 #ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_USERNAME '' diff --git a/app/config/variables.php b/app/config/variables.php index 5b710ad3f0..cd5d220f3f 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -365,7 +365,7 @@ return [ 'question' => '', ], [ - 'name' => '_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', + 'name' => '_APP_MAINTENANCE_RETENTION_EXECUTION', 'description' => 'The maximum duration (in seconds) upto which to retain execution logs. The default value is 1209600 seconds (14 days).', 'introduction' => '0.7.0', 'default' => '1209600', @@ -373,7 +373,7 @@ return [ 'question' => '', ], [ - 'name' => '_APP_MAINTENANCE_AUDIT_LOG_RETENTION', + 'name' => '_APP_MAINTENANCE_RETENTION_AUDIT', 'description' => 'IThe maximum duration (in seconds) upto which to retain audit logs. The default value is 1209600 seconds (14 days).', 'introduction' => '0.7.0', 'default' => '1209600', @@ -381,7 +381,7 @@ return [ 'question' => '', ], [ - 'name' => '_APP_MAINTENANCE_ABUSE_LOG_RETENTION', + 'name' => '_APP_MAINTENANCE_RETENTION_ABUSE', 'description' => 'The maximum duration (in seconds) upto which to retain abuse logs. The default value is 86400 seconds (1 day).', 'introduction' => '0.7.0', 'default' => '86400', diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index df4005593d..78a31e6dda 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -42,9 +42,9 @@ $cli ->action(function () { // # of days in seconds (1 day = 86400s) $interval = (int) App::getEnv('_APP_MAINTENANCE_INTERVAL', '86400'); - $executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', '1209600'); - $auditLogRetention = (int) App::getEnv('_APP_MAINTENANCE_AUDIT_LOG_RETENTION', '1209600'); - $abuseLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_ABUSE_LOG_RETENTION', '86400'); + $executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_EXECUTION', '1209600'); + $auditLogRetention = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_AUDIT', '1209600'); + $abuseLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_ABUSE', '86400'); Console::loop(function() use ($interval, $executionLogsRetention, $abuseLogsRetention, $auditLogRetention){ $time = date('d-m-Y H:i:s', time()); diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 098d4d4070..231d2f857b 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -279,11 +279,10 @@ services: - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_MAINTENANCE_INTERVAL - - _APP_DB_HOST - - _APP_DB_PORT - - _APP_DB_SCHEMA - - _APP_DB_USER - - _APP_DB_PASS + - _APP_MAINTENANCE_RETENTION_EXECUTION + - _APP_MAINTENANCE_RETENTION_ABUSE + - _APP_MAINTENANCE_RETENTION_AUDIT + appwrite-schedule: image: appwrite/appwrite: diff --git a/docker-compose.yml b/docker-compose.yml index 9d47f10245..e601ae7086 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -329,9 +329,9 @@ services: - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_MAINTENANCE_INTERVAL - - _APP_MAINTENANCE_EXECUTION_LOG_RETENTION - - _APP_MAINTENANCE_ABUSE_LOG_RETENTION - - _APP_MAINTENANCE_AUDIT_LOG_RETENTION + - _APP_MAINTENANCE_RETENTION_EXECUTION + - _APP_MAINTENANCE_RETENTION_ABUSE + - _APP_MAINTENANCE_RETENTION_AUDIT appwrite-schedule: entrypoint: schedule