feat: update default env var values
This commit is contained in:
parent
68b7e22b90
commit
0156e00a9d
1
.env
1
.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
|
||||
|
|
|
@ -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 ''
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
});
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue