From 98dddd487ca6042ce3a7015732a08c3eb9fad11d Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 29 Jan 2021 08:28:09 +0545 Subject: [PATCH 1/9] redis auth environment var --- app/config/variables.php | 8 ++++++++ app/init.php | 6 +++++- app/views/install/compose.phtml | 11 +++++++++++ docker-compose.yml | 11 +++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/config/variables.php b/app/config/variables.php index 011164db25..578e28a8ff 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -133,6 +133,14 @@ return [ 'required' => false, 'question' => '', ], + [ + 'name' => '_APP_REDIS_AUTH', + 'description' => 'Redis server auth.', + 'introduction' => '', + 'default' => '', + 'required' => false, + 'question' => '', + ], ], ], [ diff --git a/app/init.php b/app/init.php index 977efd94d6..5feb354fc2 100644 --- a/app/init.php +++ b/app/init.php @@ -91,7 +91,7 @@ Config::load('storage-inputs', __DIR__.'/config/storage/inputs.php'); Config::load('storage-outputs', __DIR__.'/config/storage/outputs.php'); Resque::setBackend(App::getEnv('_APP_REDIS_HOST', '') - .':'.App::getEnv('_APP_REDIS_PORT', '')); + .':'.App::getEnv('_APP_REDIS_PORT', ''), 0, App::getEnv('_APP_REDIS_AUTH',null)); /** * DB Filters @@ -175,6 +175,10 @@ $register->set('statsd', function () { // Register DB connection $register->set('cache', function () { // Register cache connection $redis = new Redis(); $redis->pconnect(App::getEnv('_APP_REDIS_HOST', ''), App::getEnv('_APP_REDIS_PORT', '')); + $auth = App::getEnv('_APP_REDIS_AUTH',null); + if($auth != null) { + $redis->auth($auth); + } $redis->setOption(Redis::OPT_READ_TIMEOUT, -1); return $redis; diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 9a182cc628..cbb2394f2b 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -66,6 +66,7 @@ services: - _APP_DOMAIN_TARGET - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -101,6 +102,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_STATSD_HOST - _APP_STATSD_PORT @@ -118,6 +120,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -139,6 +142,7 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -160,6 +164,7 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -183,6 +188,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -207,6 +213,7 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -231,6 +238,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -259,6 +267,7 @@ services: - _APP_SYSTEM_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE @@ -279,6 +288,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_RETENTION_EXECUTION - _APP_MAINTENANCE_RETENTION_ABUSE @@ -298,6 +308,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH mariadb: image: appwrite/mariadb:1.2.0 # fix issues when upgrading using: mysql_upgrade -u root -p diff --git a/docker-compose.yml b/docker-compose.yml index 6366e2ad25..b64310486f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,6 +86,7 @@ services: - _APP_DOMAIN_TARGET - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -127,6 +128,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_STATSD_HOST - _APP_STATSD_PORT @@ -147,6 +149,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -172,6 +175,7 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -196,6 +200,7 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -222,6 +227,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -248,6 +254,7 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -275,6 +282,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -307,6 +315,7 @@ services: - _APP_SYSTEM_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE @@ -329,6 +338,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_RETENTION_EXECUTION - _APP_MAINTENANCE_RETENTION_ABUSE @@ -350,6 +360,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_REDIS_AUTH mariadb: image: appwrite/mariadb:1.2.0 # fix issues when upgrading using: mysql_upgrade -u root -p From 4023e5efcac565c9479398087c48eb9fcf85b717 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 31 Jan 2021 11:09:38 +0545 Subject: [PATCH 2/9] supporting redis auth --- app/init.php | 16 ++++++++++++---- bin/schedule | 11 ++++++++++- bin/worker-audits | 12 +++++++++++- bin/worker-certificates | 12 +++++++++++- bin/worker-deletes | 12 +++++++++++- bin/worker-functions | 12 +++++++++++- bin/worker-mails | 12 +++++++++++- bin/worker-tasks | 12 +++++++++++- bin/worker-usage | 12 +++++++++++- bin/worker-webhooks | 12 +++++++++++- 10 files changed, 110 insertions(+), 13 deletions(-) diff --git a/app/init.php b/app/init.php index 5feb354fc2..6604256377 100644 --- a/app/init.php +++ b/app/init.php @@ -90,9 +90,12 @@ Config::load('storage-mimes', __DIR__.'/config/storage/mimes.php'); Config::load('storage-inputs', __DIR__.'/config/storage/inputs.php'); Config::load('storage-outputs', __DIR__.'/config/storage/outputs.php'); -Resque::setBackend(App::getEnv('_APP_REDIS_HOST', '') - .':'.App::getEnv('_APP_REDIS_PORT', ''), 0, App::getEnv('_APP_REDIS_AUTH',null)); - +$auth = App::getEnv('_APP_REDIS_AUTH',null); +if($auth != null) { + Resque::setBackend('redis://'.App::getEnv('_APP_REDIS_AUTH', '').'@'.App::getEnv('_APP_REDIS_HOST', '').':'.App::getEnv('_APP_REDIS_PORT', '')); +} else { + Resque::setBackend(App::getEnv('_APP_REDIS_HOST', '').':'.App::getEnv('_APP_REDIS_PORT', '')); +} /** * DB Filters */ @@ -177,7 +180,12 @@ $register->set('cache', function () { // Register cache connection $redis->pconnect(App::getEnv('_APP_REDIS_HOST', ''), App::getEnv('_APP_REDIS_PORT', '')); $auth = App::getEnv('_APP_REDIS_AUTH',null); if($auth != null) { - $redis->auth($auth); + $auth = explode(':',$auth); + if(!empty(trim($auth[0]))) { + $redis->auth($auth); + }else{ + $redis->auth([$auth[1]]); + } } $redis->setOption(Redis::OPT_READ_TIMEOUT, -1); diff --git a/bin/schedule b/bin/schedule index 74da3fe1e0..c3162bc542 100644 --- a/bin/schedule +++ b/bin/schedule @@ -1,3 +1,12 @@ #!/bin/sh -REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" RESQUE_PHP='/usr/src/code/vendor/autoload.php' php /usr/src/code/vendor/bin/resque-scheduler \ No newline at end of file +if [ -z "$_APP_REDIS_AUTH" ] +then + REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +else + REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +fi + +RESQUE_PHP='/usr/src/code/vendor/autoload.php' + +php /usr/src/code/vendor/bin/resque-scheduler \ No newline at end of file diff --git a/bin/worker-audits b/bin/worker-audits index 99b3eac2e7..4ee658a6b1 100644 --- a/bin/worker-audits +++ b/bin/worker-audits @@ -1,3 +1,13 @@ #!/bin/sh -QUEUE='v1-audits' APP_INCLUDE='/usr/src/code/app/workers/audits.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +if [ -z "$_APP_REDIS_AUTH" ] +then + REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +else + REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +fi + +QUEUE='v1-audits' +APP_INCLUDE='/usr/src/code/app/workers/audits.php' + +php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-certificates b/bin/worker-certificates index 6d360aff35..354da4d4bd 100644 --- a/bin/worker-certificates +++ b/bin/worker-certificates @@ -1,3 +1,13 @@ #!/bin/sh -QUEUE='v1-certificates' APP_INCLUDE='/usr/src/code/app/workers/certificates.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +if [ -z "$_APP_REDIS_AUTH" ] +then + REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +else + REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +fi + +QUEUE='v1-certificates' +APP_INCLUDE='/usr/src/code/app/workers/certificates.php' + +php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-deletes b/bin/worker-deletes index d053381db7..283b0058fc 100644 --- a/bin/worker-deletes +++ b/bin/worker-deletes @@ -1,3 +1,13 @@ #!/bin/sh -QUEUE='v1-deletes' APP_INCLUDE='/usr/src/code/app/workers/deletes.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +if [ -z "$_APP_REDIS_AUTH" ] +then + REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +else + REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +fi + +QUEUE='v1-deletes' +APP_INCLUDE='/usr/src/code/app/workers/deletes.php' + +php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-functions b/bin/worker-functions index 787addab0a..e62dd41ce1 100644 --- a/bin/worker-functions +++ b/bin/worker-functions @@ -1,3 +1,13 @@ #!/bin/sh -QUEUE='v1-functions' APP_INCLUDE='/usr/src/code/app/workers/functions.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +if [ -z "$_APP_REDIS_AUTH" ] +then + REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +else + REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +fi + +QUEUE='v1-functions' +APP_INCLUDE='/usr/src/code/app/workers/functions.php' + +php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-mails b/bin/worker-mails index 8a1a9de977..53e907bb33 100644 --- a/bin/worker-mails +++ b/bin/worker-mails @@ -1,3 +1,13 @@ #!/bin/sh -QUEUE='v1-mails' APP_INCLUDE='/usr/src/code/app/workers/mails.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +if [ -z "$_APP_REDIS_AUTH" ] +then + REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +else + REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +fi + +QUEUE='v1-mails' +APP_INCLUDE='/usr/src/code/app/workers/mails.php' + +php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-tasks b/bin/worker-tasks index 236b34cb75..d3c7b01237 100644 --- a/bin/worker-tasks +++ b/bin/worker-tasks @@ -1,3 +1,13 @@ #!/bin/sh -QUEUE='v1-tasks' APP_INCLUDE='/usr/src/code/app/workers/tasks.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +if [ -z "$_APP_REDIS_AUTH" ] +then + REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +else + REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +fi + +QUEUE='v1-tasks' +APP_INCLUDE='/usr/src/code/app/workers/tasks.php' + +php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-usage b/bin/worker-usage index 2b967f8f08..6e07542e32 100644 --- a/bin/worker-usage +++ b/bin/worker-usage @@ -1,3 +1,13 @@ #!/bin/sh -QUEUE='v1-usage' APP_INCLUDE='/usr/src/code/app/workers/usage.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +if [ -z "$_APP_REDIS_AUTH" ] +then + REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +else + REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +fi + +QUEUE='v1-usage' +APP_INCLUDE='/usr/src/code/app/workers/usage.php' + +php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-webhooks b/bin/worker-webhooks index d09a4a39ac..ecd34c3cbd 100644 --- a/bin/worker-webhooks +++ b/bin/worker-webhooks @@ -1,3 +1,13 @@ #!/bin/sh -QUEUE='v1-webhooks' APP_INCLUDE='/usr/src/code/app/workers/webhooks.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +if [ -z "$_APP_REDIS_AUTH" ] +then + REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +else + REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" +fi + +QUEUE='v1-webhooks' +APP_INCLUDE='/usr/src/code/app/workers/webhooks.php' + +php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file From 26500f82efd667c9fc9a3a6038bcb9335feb51b8 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 31 Jan 2021 20:41:06 +0545 Subject: [PATCH 3/9] updating redis auth environment --- app/config/variables.php | 14 +++++++++++--- app/init.php | 19 ++++++++++--------- app/views/install/compose.phtml | 33 ++++++++++++++++++++++----------- bin/schedule | 4 ++-- bin/worker-audits | 4 ++-- bin/worker-certificates | 4 ++-- bin/worker-deletes | 4 ++-- bin/worker-functions | 4 ++-- bin/worker-mails | 4 ++-- bin/worker-tasks | 4 ++-- bin/worker-usage | 4 ++-- bin/worker-webhooks | 4 ++-- docker-compose.yml | 33 ++++++++++++++++++++++----------- 13 files changed, 83 insertions(+), 52 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 578e28a8ff..db0a66f653 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -134,9 +134,17 @@ return [ 'question' => '', ], [ - 'name' => '_APP_REDIS_AUTH', - 'description' => 'Redis server auth.', - 'introduction' => '', + 'name' => '_APP_REDIS_USER', + 'description' => 'Redis server user.', + 'introduction' => '0.7', + 'default' => '', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_REDIS_PASS', + 'description' => 'Redis server password.', + 'introduction' => '0.7', 'default' => '', 'required' => false, 'question' => '', diff --git a/app/init.php b/app/init.php index 6604256377..e9a81f8fec 100644 --- a/app/init.php +++ b/app/init.php @@ -90,9 +90,10 @@ Config::load('storage-mimes', __DIR__.'/config/storage/mimes.php'); Config::load('storage-inputs', __DIR__.'/config/storage/inputs.php'); Config::load('storage-outputs', __DIR__.'/config/storage/outputs.php'); -$auth = App::getEnv('_APP_REDIS_AUTH',null); -if($auth != null) { - Resque::setBackend('redis://'.App::getEnv('_APP_REDIS_AUTH', '').'@'.App::getEnv('_APP_REDIS_HOST', '').':'.App::getEnv('_APP_REDIS_PORT', '')); +$user = App::getEnv('_APP_REDIS_USER',''); +$pass = App::getEnv('_APP_REDIS_PASS',''); +if(!empty($pass)) { + Resque::setBackend('redis://'.$user.':'.$pass.'@'.App::getEnv('_APP_REDIS_HOST', '').':'.App::getEnv('_APP_REDIS_PORT', '')); } else { Resque::setBackend(App::getEnv('_APP_REDIS_HOST', '').':'.App::getEnv('_APP_REDIS_PORT', '')); } @@ -178,13 +179,13 @@ $register->set('statsd', function () { // Register DB connection $register->set('cache', function () { // Register cache connection $redis = new Redis(); $redis->pconnect(App::getEnv('_APP_REDIS_HOST', ''), App::getEnv('_APP_REDIS_PORT', '')); - $auth = App::getEnv('_APP_REDIS_AUTH',null); - if($auth != null) { - $auth = explode(':',$auth); - if(!empty(trim($auth[0]))) { - $redis->auth($auth); + $user = App::getEnv('_APP_REDIS_USER','') ?? ''; + $pass = App::getEnv('_APP_REDIS_PASS','') ?? ''; + if(!empty($pass)) { + if(!empty(trim($user))) { + $redis->auth([$user,$pass]); }else{ - $redis->auth([$auth[1]]); + $redis->auth([$pass]); } } $redis->setOption(Redis::OPT_READ_TIMEOUT, -1); diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index cbb2394f2b..e74f222741 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -66,7 +66,8 @@ services: - _APP_DOMAIN_TARGET - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -102,7 +103,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_STATSD_HOST - _APP_STATSD_PORT @@ -120,7 +122,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -142,7 +145,8 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -164,7 +168,8 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -188,7 +193,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -213,7 +219,8 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -238,7 +245,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -267,7 +275,8 @@ services: - _APP_SYSTEM_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE @@ -288,7 +297,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_RETENTION_EXECUTION - _APP_MAINTENANCE_RETENTION_ABUSE @@ -308,7 +318,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS mariadb: image: appwrite/mariadb:1.2.0 # fix issues when upgrading using: mysql_upgrade -u root -p diff --git a/bin/schedule b/bin/schedule index c3162bc542..c7a63c33b4 100644 --- a/bin/schedule +++ b/bin/schedule @@ -1,10 +1,10 @@ #!/bin/sh -if [ -z "$_APP_REDIS_AUTH" ] +if [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else - REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" + REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi RESQUE_PHP='/usr/src/code/vendor/autoload.php' diff --git a/bin/worker-audits b/bin/worker-audits index 4ee658a6b1..f5df252078 100644 --- a/bin/worker-audits +++ b/bin/worker-audits @@ -1,10 +1,10 @@ #!/bin/sh -if [ -z "$_APP_REDIS_AUTH" ] +if [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else - REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" + REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi QUEUE='v1-audits' diff --git a/bin/worker-certificates b/bin/worker-certificates index 354da4d4bd..435895e7b6 100644 --- a/bin/worker-certificates +++ b/bin/worker-certificates @@ -1,10 +1,10 @@ #!/bin/sh -if [ -z "$_APP_REDIS_AUTH" ] +if [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else - REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" + REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi QUEUE='v1-certificates' diff --git a/bin/worker-deletes b/bin/worker-deletes index 283b0058fc..ec8f598183 100644 --- a/bin/worker-deletes +++ b/bin/worker-deletes @@ -1,10 +1,10 @@ #!/bin/sh -if [ -z "$_APP_REDIS_AUTH" ] +if [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else - REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" + REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi QUEUE='v1-deletes' diff --git a/bin/worker-functions b/bin/worker-functions index e62dd41ce1..c27f2191a0 100644 --- a/bin/worker-functions +++ b/bin/worker-functions @@ -1,10 +1,10 @@ #!/bin/sh -if [ -z "$_APP_REDIS_AUTH" ] +if [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else - REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" + REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi QUEUE='v1-functions' diff --git a/bin/worker-mails b/bin/worker-mails index 53e907bb33..e9396afd48 100644 --- a/bin/worker-mails +++ b/bin/worker-mails @@ -1,10 +1,10 @@ #!/bin/sh -if [ -z "$_APP_REDIS_AUTH" ] +if [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else - REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" + REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi QUEUE='v1-mails' diff --git a/bin/worker-tasks b/bin/worker-tasks index d3c7b01237..c6f87200d1 100644 --- a/bin/worker-tasks +++ b/bin/worker-tasks @@ -1,10 +1,10 @@ #!/bin/sh -if [ -z "$_APP_REDIS_AUTH" ] +if [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else - REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" + REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi QUEUE='v1-tasks' diff --git a/bin/worker-usage b/bin/worker-usage index 6e07542e32..5f86bc3b1b 100644 --- a/bin/worker-usage +++ b/bin/worker-usage @@ -1,10 +1,10 @@ #!/bin/sh -if [ -z "$_APP_REDIS_AUTH" ] +if [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else - REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" + REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi QUEUE='v1-usage' diff --git a/bin/worker-webhooks b/bin/worker-webhooks index ecd34c3cbd..8a51947dbf 100644 --- a/bin/worker-webhooks +++ b/bin/worker-webhooks @@ -1,10 +1,10 @@ #!/bin/sh -if [ -z "$_APP_REDIS_AUTH" ] +if [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else - REDIS_BACKEND="redis://${_APP_REDIS_AUTH}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" + REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi QUEUE='v1-webhooks' diff --git a/docker-compose.yml b/docker-compose.yml index b64310486f..347a894753 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,7 +86,8 @@ services: - _APP_DOMAIN_TARGET - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -128,7 +129,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_STATSD_HOST - _APP_STATSD_PORT @@ -149,7 +151,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -175,7 +178,8 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -200,7 +204,8 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -227,7 +232,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -254,7 +260,8 @@ services: - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -282,7 +289,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_DB_HOST - _APP_DB_PORT - _APP_DB_SCHEMA @@ -315,7 +323,8 @@ services: - _APP_SYSTEM_EMAIL_ADDRESS - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE @@ -338,7 +347,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_RETENTION_EXECUTION - _APP_MAINTENANCE_RETENTION_ABUSE @@ -360,7 +370,8 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_REDIS_AUTH + - _APP_REDIS_USER + - _APP_REDIS_PASS mariadb: image: appwrite/mariadb:1.2.0 # fix issues when upgrading using: mysql_upgrade -u root -p From 7ac826b355fdf54c62f2687850ef98edef0d9f19 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 1 Feb 2021 12:06:42 +0545 Subject: [PATCH 4/9] updating checks for both user and pass --- app/init.php | 19 +++++++++++-------- bin/schedule | 2 +- bin/worker-audits | 2 +- bin/worker-certificates | 2 +- bin/worker-deletes | 2 +- bin/worker-functions | 2 +- bin/worker-mails | 2 +- bin/worker-tasks | 2 +- bin/worker-usage | 2 +- bin/worker-webhooks | 2 +- 10 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/init.php b/app/init.php index e9a81f8fec..ad41f3cfe1 100644 --- a/app/init.php +++ b/app/init.php @@ -92,7 +92,7 @@ Config::load('storage-outputs', __DIR__.'/config/storage/outputs.php'); $user = App::getEnv('_APP_REDIS_USER',''); $pass = App::getEnv('_APP_REDIS_PASS',''); -if(!empty($pass)) { +if(!empty($user) || !empty($pass)) { Resque::setBackend('redis://'.$user.':'.$pass.'@'.App::getEnv('_APP_REDIS_HOST', '').':'.App::getEnv('_APP_REDIS_PORT', '')); } else { Resque::setBackend(App::getEnv('_APP_REDIS_HOST', '').':'.App::getEnv('_APP_REDIS_PORT', '')); @@ -179,14 +179,17 @@ $register->set('statsd', function () { // Register DB connection $register->set('cache', function () { // Register cache connection $redis = new Redis(); $redis->pconnect(App::getEnv('_APP_REDIS_HOST', ''), App::getEnv('_APP_REDIS_PORT', '')); - $user = App::getEnv('_APP_REDIS_USER','') ?? ''; - $pass = App::getEnv('_APP_REDIS_PASS','') ?? ''; + $user = App::getEnv('_APP_REDIS_USER',''); + $pass = App::getEnv('_APP_REDIS_PASS',''); + $auth = []; + if(!empty($user)) { + $auth["user"] = $user; + } if(!empty($pass)) { - if(!empty(trim($user))) { - $redis->auth([$user,$pass]); - }else{ - $redis->auth([$pass]); - } + $auth["pass"] = $pass; + } + if(!empty($auth)) { + $redis->auth($auth); } $redis->setOption(Redis::OPT_READ_TIMEOUT, -1); diff --git a/bin/schedule b/bin/schedule index c7a63c33b4..ed76c3e5b8 100644 --- a/bin/schedule +++ b/bin/schedule @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-audits b/bin/worker-audits index f5df252078..57cad26853 100644 --- a/bin/worker-audits +++ b/bin/worker-audits @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-certificates b/bin/worker-certificates index 435895e7b6..018a96e21e 100644 --- a/bin/worker-certificates +++ b/bin/worker-certificates @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-deletes b/bin/worker-deletes index ec8f598183..61b95c7780 100644 --- a/bin/worker-deletes +++ b/bin/worker-deletes @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-functions b/bin/worker-functions index c27f2191a0..4c28ad119b 100644 --- a/bin/worker-functions +++ b/bin/worker-functions @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-mails b/bin/worker-mails index e9396afd48..71e41012ce 100644 --- a/bin/worker-mails +++ b/bin/worker-mails @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-tasks b/bin/worker-tasks index c6f87200d1..9d990efe1f 100644 --- a/bin/worker-tasks +++ b/bin/worker-tasks @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-usage b/bin/worker-usage index 5f86bc3b1b..92e9e576b8 100644 --- a/bin/worker-usage +++ b/bin/worker-usage @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-webhooks b/bin/worker-webhooks index 8a51947dbf..495a1b6809 100644 --- a/bin/worker-webhooks +++ b/bin/worker-webhooks @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else From 19c870b2aa951cfaf1714723785d6500f373e211 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 1 Feb 2021 18:09:25 +0545 Subject: [PATCH 5/9] fix issue with QUEUE not being set --- bin/schedule | 4 +--- bin/worker-audits | 5 +---- bin/worker-certificates | 5 +---- bin/worker-deletes | 5 +---- bin/worker-functions | 5 +---- bin/worker-mails | 5 +---- bin/worker-tasks | 5 +---- bin/worker-usage | 5 +---- bin/worker-webhooks | 5 +---- 9 files changed, 9 insertions(+), 35 deletions(-) mode change 100644 => 100755 bin/worker-certificates diff --git a/bin/schedule b/bin/schedule index ed76c3e5b8..08a9e9a086 100644 --- a/bin/schedule +++ b/bin/schedule @@ -7,6 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -RESQUE_PHP='/usr/src/code/vendor/autoload.php' - -php /usr/src/code/vendor/bin/resque-scheduler \ No newline at end of file +RESQUE_PHP='/usr/src/code/vendor/autoload.php' php /usr/src/code/vendor/bin/resque-scheduler \ No newline at end of file diff --git a/bin/worker-audits b/bin/worker-audits index 57cad26853..e411aa386f 100644 --- a/bin/worker-audits +++ b/bin/worker-audits @@ -7,7 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -QUEUE='v1-audits' -APP_INCLUDE='/usr/src/code/app/workers/audits.php' - -php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +QUEUE='v1-audits' APP_INCLUDE='/usr/src/code/app/workers/audits.php' php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-certificates b/bin/worker-certificates old mode 100644 new mode 100755 index 018a96e21e..7d474e1ead --- a/bin/worker-certificates +++ b/bin/worker-certificates @@ -7,7 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -QUEUE='v1-certificates' -APP_INCLUDE='/usr/src/code/app/workers/certificates.php' - -php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +QUEUE='v1-certificates' APP_INCLUDE='/usr/src/code/app/workers/certificates.php' php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-deletes b/bin/worker-deletes index 61b95c7780..9c2fb3118e 100644 --- a/bin/worker-deletes +++ b/bin/worker-deletes @@ -7,7 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -QUEUE='v1-deletes' -APP_INCLUDE='/usr/src/code/app/workers/deletes.php' - -php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +QUEUE='v1-deletes' APP_INCLUDE='/usr/src/code/app/workers/deletes.php' php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-functions b/bin/worker-functions index 4c28ad119b..b41c019942 100644 --- a/bin/worker-functions +++ b/bin/worker-functions @@ -7,7 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -QUEUE='v1-functions' -APP_INCLUDE='/usr/src/code/app/workers/functions.php' - -php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +QUEUE='v1-functions' APP_INCLUDE='/usr/src/code/app/workers/functions.php' php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-mails b/bin/worker-mails index 71e41012ce..b29eacdabc 100644 --- a/bin/worker-mails +++ b/bin/worker-mails @@ -7,7 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -QUEUE='v1-mails' -APP_INCLUDE='/usr/src/code/app/workers/mails.php' - -php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +QUEUE='v1-mails' APP_INCLUDE='/usr/src/code/app/workers/mails.php' _APP_REDIS_USERphp /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-tasks b/bin/worker-tasks index 9d990efe1f..fc395b34ab 100644 --- a/bin/worker-tasks +++ b/bin/worker-tasks @@ -7,7 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -QUEUE='v1-tasks' -APP_INCLUDE='/usr/src/code/app/workers/tasks.php' - -php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +QUEUE='v1-tasks' APP_INCLUDE='/usr/src/code/app/workers/tasks.php' php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-usage b/bin/worker-usage index 92e9e576b8..4176f54b86 100644 --- a/bin/worker-usage +++ b/bin/worker-usage @@ -7,7 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -QUEUE='v1-usage' -APP_INCLUDE='/usr/src/code/app/workers/usage.php' - -php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +QUEUE='v1-usage' APP_INCLUDE='/usr/src/code/app/workers/usage.php' php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file diff --git a/bin/worker-webhooks b/bin/worker-webhooks index 495a1b6809..13029ecbd9 100644 --- a/bin/worker-webhooks +++ b/bin/worker-webhooks @@ -7,7 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -QUEUE='v1-webhooks' -APP_INCLUDE='/usr/src/code/app/workers/webhooks.php' - -php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +QUEUE='v1-webhooks' APP_INCLUDE='/usr/src/code/app/workers/webhooks.php' php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file From 3a7285a8454ebe81b9c14c2a5ce564eef5654b3a Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 7 Feb 2021 13:42:15 +0545 Subject: [PATCH 6/9] fix worker schedule not starting issue --- bin/schedule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/schedule b/bin/schedule index 08a9e9a086..857ec9f6ff 100644 --- a/bin/schedule +++ b/bin/schedule @@ -7,4 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -RESQUE_PHP='/usr/src/code/vendor/autoload.php' php /usr/src/code/vendor/bin/resque-scheduler \ No newline at end of file +REDIS_BACKEND=$REDIS_BACKEND RESQUE_PHP='/usr/src/code/vendor/autoload.php' php /usr/src/code/vendor/bin/resque-scheduler From 0475d87a7297f3c56d62976cce0d94c8154e4bf9 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 15 Feb 2021 13:22:13 +0545 Subject: [PATCH 7/9] fix issue with mails worker --- bin/worker-mails | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/worker-mails b/bin/worker-mails index b29eacdabc..64d10f6099 100644 --- a/bin/worker-mails +++ b/bin/worker-mails @@ -7,4 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -QUEUE='v1-mails' APP_INCLUDE='/usr/src/code/app/workers/mails.php' _APP_REDIS_USERphp /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file +QUEUE='v1-mails' APP_INCLUDE='/usr/src/code/app/workers/mails.php' php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php \ No newline at end of file From 92d35cff1841cc533fdda5ab39855a8cd1843b18 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 18 Feb 2021 17:42:30 +0545 Subject: [PATCH 8/9] fix missing port information in URL in console --- app/controllers/shared/web.php | 19 ++++++++++++------- app/views/console/database/collection.phtml | 2 +- .../console/database/search/documents.phtml | 2 +- app/views/console/database/search/files.phtml | 2 +- app/views/console/settings/index.phtml | 6 +++--- app/views/console/storage/index.phtml | 8 ++++---- app/views/console/users/index.phtml | 2 +- app/views/console/users/team.phtml | 2 +- app/views/home/auth/recovery.phtml | 2 +- app/views/layouts/default.phtml | 4 +++- 10 files changed, 28 insertions(+), 21 deletions(-) diff --git a/app/controllers/shared/web.php b/app/controllers/shared/web.php index 43eaf74d09..526a4dbb62 100644 --- a/app/controllers/shared/web.php +++ b/app/controllers/shared/web.php @@ -11,13 +11,18 @@ App::init(function ($utopia, $request, $response, $layout) { /* AJAX check */ if (!empty($request->getQuery('version', ''))) { - $layout->setPath(__DIR__.'/../../views/layouts/empty.phtml'); + $layout->setPath(__DIR__ . '/../../views/layouts/empty.phtml'); } - + + $port = $request->getPort(); + $protocol = $request->getProtocol(); + $domain = $request->getHostname(); + $layout ->setParam('title', APP_NAME) - ->setParam('protocol', $request->getProtocol()) - ->setParam('domain', $request->getHostname()) + ->setParam('protocol', $protocol) + ->setParam('domain', $domain) + ->setParam('endpoint', $protocol . '://' . $domain . ($port != 80 && $port != 443 ? ':' . $port : '')) ->setParam('home', App::getEnv('_APP_HOME')) ->setParam('setup', App::getEnv('_APP_SETUP')) ->setParam('class', 'unknown') @@ -34,10 +39,10 @@ App::init(function ($utopia, $request, $response, $layout) { $time = (60 * 60 * 24 * 45); // 45 days cache $response - ->addHeader('Cache-Control', 'public, max-age='.$time) - ->addHeader('Expires', \date('D, d M Y H:i:s', \time() + $time).' GMT') // 45 days cache + ->addHeader('Cache-Control', 'public, max-age=' . $time) + ->addHeader('Expires', \date('D, d M Y H:i:s', \time() + $time) . ' GMT') // 45 days cache ->addHeader('X-Frame-Options', 'SAMEORIGIN') // Avoid console and homepage from showing in iframes - ->addHeader('X-XSS-Protection', '1; mode=block; report=/v1/xss?url='.\urlencode($request->getURI())) + ->addHeader('X-XSS-Protection', '1; mode=block; report=/v1/xss?url=' . \urlencode($request->getURI())) ->addHeader('X-UA-Compatible', 'IE=Edge') // Deny IE browsers from going into quirks mode ; diff --git a/app/views/console/database/collection.phtml b/app/views/console/database/collection.phtml index afe0365ee8..45d3287cf5 100644 --- a/app/views/console/database/collection.phtml +++ b/app/views/console/database/collection.phtml @@ -114,7 +114,7 @@ $maxCells = 10; - + {...} diff --git a/app/views/console/database/search/documents.phtml b/app/views/console/database/search/documents.phtml index 1b656dc4e4..6fb67feab1 100644 --- a/app/views/console/database/search/documents.phtml +++ b/app/views/console/database/search/documents.phtml @@ -72,7 +72,7 @@ $rules = $collection->getAttribute('rules', []); - + {...} diff --git a/app/views/console/database/search/files.phtml b/app/views/console/database/search/files.phtml index f8c39f4a87..ac9f76e0ea 100644 --- a/app/views/console/database/search/files.phtml +++ b/app/views/console/database/search/files.phtml @@ -54,7 +54,7 @@ - + diff --git a/app/views/console/settings/index.phtml b/app/views/console/settings/index.phtml index 5eedb6388a..45f039d383 100644 --- a/app/views/console/settings/index.phtml +++ b/app/views/console/settings/index.phtml @@ -135,7 +135,7 @@ $customDomainsTarget = $this->getParam('customDomainsTarget', false);
- +
    @@ -453,7 +453,7 @@ $customDomainsTarget = $this->getParam('customDomainsTarget', false); data-failure-param-alert-classname="error"> - + @@ -493,7 +493,7 @@ $customDomainsTarget = $this->getParam('customDomainsTarget', false); data-failure-param-alert-classname="error"> - + diff --git a/app/views/console/storage/index.phtml b/app/views/console/storage/index.phtml index 934189f93c..bd39699592 100644 --- a/app/views/console/storage/index.phtml +++ b/app/views/console/storage/index.phtml @@ -113,7 +113,7 @@ $fileLimitHuman = $this->getParam('fileLimitHuman', 0); - + diff --git a/app/views/console/users/index.phtml b/app/views/console/users/index.phtml index 8debcd9b4c..b41730baf9 100644 --- a/app/views/console/users/index.phtml +++ b/app/views/console/users/index.phtml @@ -361,7 +361,7 @@ $providers = $this->getParam('providers', []);

    To complete set up, add this OAuth2 redirect URI to your escape(ucfirst($provider)); ?> app configuration.

    - +
    diff --git a/app/views/console/users/team.phtml b/app/views/console/users/team.phtml index 659fe3bd5a..ad6d263fac 100644 --- a/app/views/console/users/team.phtml +++ b/app/views/console/users/team.phtml @@ -145,7 +145,7 @@ data-failure-param-alert-classname="error"> - + diff --git a/app/views/home/auth/recovery.phtml b/app/views/home/auth/recovery.phtml index 575227a158..6f633b9a0c 100644 --- a/app/views/home/auth/recovery.phtml +++ b/app/views/home/auth/recovery.phtml @@ -23,7 +23,7 @@ - + diff --git a/app/views/layouts/default.phtml b/app/views/layouts/default.phtml index 1f0c686494..8c2641f182 100644 --- a/app/views/layouts/default.phtml +++ b/app/views/layouts/default.phtml @@ -2,6 +2,7 @@ $protocol = $this->getParam('protocol', ''); $domain = $this->getParam('domain', ''); +$endpoint = $this->getParam('endpoint', ''); $platforms = $this->getParam('platforms', []); $version = $this->getParam('version', '0.0.0'); $isDev = $this->getParam('isDev', false); @@ -56,7 +57,7 @@ if(!empty($platforms)) { - +