diff --git a/Dockerfile b/Dockerfile index 7041d47da..59f51caca 100755 --- a/Dockerfile +++ b/Dockerfile @@ -101,7 +101,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN \ apt-get update && \ - apt-get install -y --no-install-recommends --no-install-suggests webp certbot htop \ + apt-get install -y --no-install-recommends --no-install-suggests webp certbot htop procps \ libonig-dev libcurl4-gnutls-dev libmagickwand-dev libyaml-dev libbrotli-dev libz-dev && \ pecl install imagick yaml && \ docker-php-ext-enable imagick yaml diff --git a/app/workers/audits.php b/app/workers/audits.php index 9ffb85e57..0ce48aad1 100644 --- a/app/workers/audits.php +++ b/app/workers/audits.php @@ -4,7 +4,7 @@ require_once __DIR__.'/../init.php'; \cli_set_process_title('Audits V1 Worker'); -echo APP_NAME.' audits worker v1 has started'; +echo APP_NAME.' audits worker v1 has started'."\n"; use Utopia\Audit\Audit; use Utopia\Audit\Adapters\MySQL as AuditAdapter; @@ -28,9 +28,9 @@ class AuditsV1 $userAgent = $this->args['userAgent']; $ip = $this->args['ip']; $data = $this->args['data']; - $pdo = $register->get('db', true); + $db = $register->get('db', true); - $adapter = new AuditAdapter($pdo); + $adapter = new AuditAdapter($db); $adapter->setNamespace('app_'.$projectId); $audit = new Audit($adapter); diff --git a/app/workers/certificates.php b/app/workers/certificates.php index d091b548b..949a76cdc 100644 --- a/app/workers/certificates.php +++ b/app/workers/certificates.php @@ -10,7 +10,7 @@ require_once __DIR__.'/../init.php'; \cli_set_process_title('Certificates V1 Worker'); -echo APP_NAME.' certificates worker v1 has started'; +echo APP_NAME.' certificates worker v1 has started'."\n"; class CertificatesV1 { diff --git a/app/workers/deletes.php b/app/workers/deletes.php index 1ff72d3e0..b8ba9845a 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -4,7 +4,7 @@ require_once __DIR__.'/../init.php'; \cli_set_process_title('Deletes V1 Worker'); -echo APP_NAME.' deletes worker v1 has started'; +echo APP_NAME.' deletes worker v1 has started'."\n"; use Appwrite\Database\Database; use Appwrite\Database\Document; diff --git a/app/workers/mails.php b/app/workers/mails.php index 6835f3071..45f2c6609 100644 --- a/app/workers/mails.php +++ b/app/workers/mails.php @@ -4,7 +4,7 @@ require_once __DIR__.'/../init.php'; \cli_set_process_title('Mails V1 Worker'); -echo APP_NAME.' mails worker v1 has started'; +echo APP_NAME.' mails worker v1 has started'."\n"; class MailsV1 { diff --git a/app/workers/tasks.php b/app/workers/tasks.php index 724163612..38ef5c8f9 100644 --- a/app/workers/tasks.php +++ b/app/workers/tasks.php @@ -9,7 +9,7 @@ use Cron\CronExpression; \cli_set_process_title('Tasks V1 Worker'); -echo APP_NAME.' tasks worker v1 has started'; +echo APP_NAME.' tasks worker v1 has started'."\n"; class TasksV1 { diff --git a/app/workers/usage.php b/app/workers/usage.php index a53b26113..be19efacf 100644 --- a/app/workers/usage.php +++ b/app/workers/usage.php @@ -6,7 +6,7 @@ require_once __DIR__.'/../init.php'; \cli_set_process_title('Usage V1 Worker'); -echo APP_NAME.' usage worker v1 has started'; +echo APP_NAME.' usage worker v1 has started'."\n"; class UsageV1 { diff --git a/app/workers/webhooks.php b/app/workers/webhooks.php index 2bbe98a96..0c6d886ea 100644 --- a/app/workers/webhooks.php +++ b/app/workers/webhooks.php @@ -4,7 +4,7 @@ require_once __DIR__.'/../init.php'; \cli_set_process_title('Webhooks V1 Worker'); -echo APP_NAME.' webhooks worker v1 has started'; +echo APP_NAME.' webhooks worker v1 has started'."\n"; use Appwrite\Database\Database; use Appwrite\Database\Validator\Authorization; diff --git a/bin/worker-audits b/bin/worker-audits index 481ef3c13..3ec78c92d 100644 --- a/bin/worker-audits +++ b/bin/worker-audits @@ -1,3 +1,3 @@ #!/bin/bash -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 \ No newline at end of file +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 diff --git a/bin/worker-certificates b/bin/worker-certificates index ddd8bb088..b974b65f1 100644 --- a/bin/worker-certificates +++ b/bin/worker-certificates @@ -1,3 +1,3 @@ #!/bin/bash -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 \ No newline at end of file +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 diff --git a/bin/worker-deletes b/bin/worker-deletes index f02878de9..fedfaa2c5 100644 --- a/bin/worker-deletes +++ b/bin/worker-deletes @@ -1,3 +1,3 @@ #!/bin/bash -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 \ No newline at end of file +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 diff --git a/bin/worker-mails b/bin/worker-mails index 18c9f725b..d0748acbf 100644 --- a/bin/worker-mails +++ b/bin/worker-mails @@ -1,3 +1,3 @@ #!/bin/bash -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 \ No newline at end of file +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 diff --git a/bin/worker-tasks b/bin/worker-tasks index f32607930..e5ee8caae 100644 --- a/bin/worker-tasks +++ b/bin/worker-tasks @@ -1,3 +1,3 @@ #!/bin/bash -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 \ No newline at end of file +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 diff --git a/bin/worker-usage b/bin/worker-usage index f32607930..e5ee8caae 100644 --- a/bin/worker-usage +++ b/bin/worker-usage @@ -1,3 +1,3 @@ #!/bin/bash -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 \ No newline at end of file +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 diff --git a/bin/worker-webhooks b/bin/worker-webhooks index 22e685823..920e9fb14 100644 --- a/bin/worker-webhooks +++ b/bin/worker-webhooks @@ -1,3 +1,3 @@ #!/bin/bash -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 \ No newline at end of file +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 diff --git a/docker-compose.yml b/docker-compose.yml index 81e043f08..d8371012a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -92,6 +92,7 @@ services: - appwrite depends_on: - redis + - telegraf environment: - _APP_REDIS_HOST - _APP_REDIS_PORT @@ -108,6 +109,27 @@ services: - appwrite depends_on: - redis + - mariadb + environment: + - _APP_REDIS_HOST + - _APP_REDIS_PORT + - _APP_DB_HOST + - _APP_DB_PORT + - _APP_DB_SCHEMA + - _APP_DB_USER + - _APP_DB_PASS + + appwrite-worker-audits: + entrypoint: worker-audits + container_name: appwrite-worker-audits + build: + context: . + restart: unless-stopped + networks: + - appwrite + depends_on: + - redis + - mariadb environment: - _APP_REDIS_HOST - _APP_REDIS_PORT