From f2e2b5016c300d783d74b2d04651943817096666 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Fri, 25 Feb 2022 10:13:34 +0000 Subject: [PATCH 1/7] Update Contributing and remove unneeded descriptions --- CONTRIBUTING.md | 2 +- docs/references/functions/list-builds.md | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 docs/references/functions/list-builds.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c63466eedf..9c8005ba19 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -282,7 +282,7 @@ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 ``` **Build Functions Runtimes** -The Runtimes for all supported cloud functions (multicore builds) can be found at the [appwrite/runtimes](https://github.com/appwrite/runtimes) repository. +The Runtimes for all supported cloud functions (multicore builds) can be found at the [open-runtimes/open-runtimes](https://github.com/open-runtimes/open-runtimes) repository. ## Generate SDK diff --git a/docs/references/functions/list-builds.md b/docs/references/functions/list-builds.md deleted file mode 100644 index 45a88cb7ee..0000000000 --- a/docs/references/functions/list-builds.md +++ /dev/null @@ -1 +0,0 @@ -Get a list of all the current user build logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. [Learn more about different API modes](/docs/admin). \ No newline at end of file From 93efdbcae143db8a6ea3debb9bf50178f53052b4 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Fri, 25 Feb 2022 13:50:11 +0000 Subject: [PATCH 2/7] Remove duplicate appwrite-executor --- app/views/install/compose.phtml | 69 --------------------------------- 1 file changed, 69 deletions(-) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index f3327ac2c5..ee0d14a657 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -355,75 +355,6 @@ services: - _APP_EXECUTOR_SECRET - _APP_USAGE_STATS - appwrite-executor: - container_name: appwrite-executor - entrypoint: executor - stop_signal: SIGINT - image: /: - networks: - appwrite: - runtimes: - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - appwrite-functions:/storage/functions:rw - - /tmp:/tmp:rw - - ./app:/usr/src/code/app - - ./src:/usr/src/code/src - - ./dev:/usr/local/dev - depends_on: - - redis - - mariadb - environment: - - _APP_ENV - - _APP_OPENSSL_KEY_V1 - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - _APP_REDIS_USER - - _APP_REDIS_PASS - - _APP_DB_HOST - - _APP_DB_PORT - - _APP_DB_SCHEMA - - _APP_DB_USER - - _APP_DB_PASS - - _APP_FUNCTIONS_TIMEOUT - - _APP_FUNCTIONS_BUILD_TIMEOUT - - _APP_FUNCTIONS_CONTAINERS - - _APP_FUNCTIONS_RUNTIMES - - _APP_FUNCTIONS_CPUS - - _APP_FUNCTIONS_MEMORY - - _APP_FUNCTIONS_MEMORY_SWAP - - _APP_EXECUTOR_SECRET - - _APP_USAGE_STATS - - _APP_STATSD_HOST - - _APP_STATSD_PORT - - _APP_LOGGING_PROVIDER - - _APP_LOGGING_CONFIG - - DOCKERHUB_PULL_USERNAME - - DOCKERHUB_PULL_PASSWORD - - appwrite-worker-mails: - image: /: - entrypoint: worker-mails - container_name: appwrite-worker-mails - restart: unless-stopped - networks: - - appwrite - depends_on: - - redis - environment: - - _APP_ENV - - _APP_SYSTEM_EMAIL_NAME - - _APP_SYSTEM_EMAIL_ADDRESS - - _APP_REDIS_HOST - - _APP_REDIS_PORT - - _APP_REDIS_USER - - _APP_REDIS_PASS - - _APP_SMTP_HOST - - _APP_SMTP_PORT - - _APP_SMTP_SECURE - - _APP_SMTP_USERNAME - - _APP_SMTP_PASSWORD - appwrite-maintenance: image: /: entrypoint: maintenance From 1fa764d1f68b92173356a4b6c0ba8e2e3763ac5b Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Fri, 25 Feb 2022 14:03:08 +0000 Subject: [PATCH 3/7] rename OPENRUNTIMES_INACTIVE_THRESHOLD to _APP_RUNTIMES_INACTIVE_THRESHOLD --- .env | 2 +- app/executor.php | 2 +- app/views/install/compose.phtml | 2 +- docker-compose.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env b/.env index e1bcb541ec..f9b849bd0f 100644 --- a/.env +++ b/.env @@ -50,4 +50,4 @@ _APP_MAINTENANCE_RETENTION_AUDIT=1209600 _APP_USAGE_STATS=enabled _APP_LOGGING_PROVIDER= _APP_LOGGING_CONFIG= -OPENRUNTIMES_INACTIVE_THRESHOLD=60 \ No newline at end of file +_APP_RUNTIMES_INACTIVE_THRESHOLD=60 \ No newline at end of file diff --git a/app/executor.php b/app/executor.php index d9be75dca7..d9ec9f42f2 100644 --- a/app/executor.php +++ b/app/executor.php @@ -653,7 +653,7 @@ $http->on('start', function ($http) { Timer::tick(MAINTENANCE_INTERVAL * 1000, function () use ($orchestrationPool, $activeRuntimes) { Console::warning("Running maintenance task ..."); foreach ($activeRuntimes as $runtime) { - $inactiveThreshold = \time() - App::getEnv('OPENRUNTIMES_INACTIVE_THRESHOLD', 60); + $inactiveThreshold = \time() - App::getEnv('_APP_RUNTIMES_INACTIVE_THRESHOLD', 60); if ($runtime['updated'] < $inactiveThreshold) { go(function () use ($runtime, $orchestrationPool, $activeRuntimes) { try { diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index ee0d14a657..c269e26096 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -187,7 +187,7 @@ services: - _APP_LOGGING_CONFIG - DOCKERHUB_PULL_USERNAME - DOCKERHUB_PULL_PASSWORD - - OPENRUNTIMES_INACTIVE_THRESHOLD + - _APP_RUNTIMES_INACTIVE_THRESHOLD appwrite-worker-database: image: /: diff --git a/docker-compose.yml b/docker-compose.yml index 301e8fcb5b..afc0575f45 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -432,7 +432,7 @@ services: - _APP_LOGGING_CONFIG - DOCKERHUB_PULL_USERNAME - DOCKERHUB_PULL_PASSWORD - - OPENRUNTIMES_INACTIVE_THRESHOLD + - _APP_RUNTIMES_INACTIVE_THRESHOLD appwrite-worker-mails: entrypoint: worker-mails From 1db9a872d9803047960aeb80e14b92c6d0f45201 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Fri, 25 Feb 2022 14:26:55 +0000 Subject: [PATCH 4/7] Restore mail worker --- app/views/install/compose.phtml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index c269e26096..95ae065abc 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -355,6 +355,30 @@ services: - _APP_EXECUTOR_SECRET - _APP_USAGE_STATS + appwrite-worker-mails: + image: /: + entrypoint: worker-mails + container_name: appwrite-worker-mails + restart: unless-stopped + networks: + - appwrite + depends_on: + - redis + environment: + - _APP_ENV + - _APP_SYSTEM_EMAIL_NAME + - _APP_SYSTEM_EMAIL_ADDRESS + - _APP_REDIS_HOST + - _APP_REDIS_PORT + - _APP_REDIS_USER + - _APP_REDIS_PASS + - _APP_SMTP_HOST + - _APP_SMTP_PORT + - _APP_SMTP_SECURE + - _APP_SMTP_USERNAME + - _APP_SMTP_PASSWORD + + appwrite-maintenance: image: /: entrypoint: maintenance From 564596c1836f56e1bd19487b9edef06f98177d02 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Fri, 25 Feb 2022 14:34:43 +0000 Subject: [PATCH 5/7] Rename env var --- .env | 2 +- app/executor.php | 2 +- app/views/install/compose.phtml | 2 +- docker-compose.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env b/.env index f9b849bd0f..73928ff7a3 100644 --- a/.env +++ b/.env @@ -50,4 +50,4 @@ _APP_MAINTENANCE_RETENTION_AUDIT=1209600 _APP_USAGE_STATS=enabled _APP_LOGGING_PROVIDER= _APP_LOGGING_CONFIG= -_APP_RUNTIMES_INACTIVE_THRESHOLD=60 \ No newline at end of file +_APP_FUNCTIONS_INACTIVE_THRESHOLD=60 \ No newline at end of file diff --git a/app/executor.php b/app/executor.php index d9ec9f42f2..b8c58cc8c6 100644 --- a/app/executor.php +++ b/app/executor.php @@ -653,7 +653,7 @@ $http->on('start', function ($http) { Timer::tick(MAINTENANCE_INTERVAL * 1000, function () use ($orchestrationPool, $activeRuntimes) { Console::warning("Running maintenance task ..."); foreach ($activeRuntimes as $runtime) { - $inactiveThreshold = \time() - App::getEnv('_APP_RUNTIMES_INACTIVE_THRESHOLD', 60); + $inactiveThreshold = \time() - App::getEnv('_APP_FUNCTIONS_INACTIVE_THRESHOLD', 60); if ($runtime['updated'] < $inactiveThreshold) { go(function () use ($runtime, $orchestrationPool, $activeRuntimes) { try { diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 95ae065abc..9b81e3cf78 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -181,13 +181,13 @@ services: - _APP_FUNCTIONS_CPUS - _APP_FUNCTIONS_MEMORY - _APP_FUNCTIONS_MEMORY_SWAP + - _APP_FUNCTIONS_INACTIVE_THRESHOLD - _APP_EXECUTOR_SECRET - _APP_EXECUTOR_RUNTIME_NETWORK - _APP_LOGGING_PROVIDER - _APP_LOGGING_CONFIG - DOCKERHUB_PULL_USERNAME - DOCKERHUB_PULL_PASSWORD - - _APP_RUNTIMES_INACTIVE_THRESHOLD appwrite-worker-database: image: /: diff --git a/docker-compose.yml b/docker-compose.yml index afc0575f45..88f8937c26 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -426,13 +426,13 @@ services: - _APP_FUNCTIONS_CPUS - _APP_FUNCTIONS_MEMORY - _APP_FUNCTIONS_MEMORY_SWAP + - _APP_FUNCTIONS_INACTIVE_THRESHOLD - _APP_EXECUTOR_SECRET - _APP_EXECUTOR_RUNTIME_NETWORK - _APP_LOGGING_PROVIDER - _APP_LOGGING_CONFIG - DOCKERHUB_PULL_USERNAME - DOCKERHUB_PULL_PASSWORD - - _APP_RUNTIMES_INACTIVE_THRESHOLD appwrite-worker-mails: entrypoint: worker-mails From 411f66a82c641791f83d08a79d7a04e373ceb8fd Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Fri, 25 Feb 2022 14:38:42 +0000 Subject: [PATCH 6/7] Update .env --- .env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 73928ff7a3..572884d967 100644 --- a/.env +++ b/.env @@ -41,6 +41,7 @@ _APP_FUNCTIONS_CONTAINERS=10 _APP_FUNCTIONS_CPUS=4 _APP_FUNCTIONS_MEMORY=2000 _APP_FUNCTIONS_MEMORY_SWAP=2000 +_APP_FUNCTIONS_INACTIVE_THRESHOLD=60 _APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes _APP_EXECUTOR_SECRET=a-random-secret _APP_MAINTENANCE_INTERVAL=86400 @@ -49,5 +50,4 @@ _APP_MAINTENANCE_RETENTION_ABUSE=86400 _APP_MAINTENANCE_RETENTION_AUDIT=1209600 _APP_USAGE_STATS=enabled _APP_LOGGING_PROVIDER= -_APP_LOGGING_CONFIG= -_APP_FUNCTIONS_INACTIVE_THRESHOLD=60 \ No newline at end of file +_APP_LOGGING_CONFIG= \ No newline at end of file From 7e9a7e18472236b79c3372d3f7bb065c9cee87a0 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Fri, 25 Feb 2022 15:06:52 +0000 Subject: [PATCH 7/7] Update variables.php --- app/config/variables.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/config/variables.php b/app/config/variables.php index 5b30e1612e..4864a324b5 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -597,6 +597,15 @@ return [ 'question' => '', 'filter' => '' ], + [ + 'name' => '_APP_FUNCTIONS_INACTIVE_THRESHOLD', + 'description' => 'The minimum time a function can be inactive before it\'s container is shutdown and put to sleep. The default value is 60 seconds', + 'introduction' => '0.13.0', + 'default' => '60', + 'required' => false, + 'question' => '', + 'filter' => '' + ], [ 'name' => 'DOCKERHUB_PULL_USERNAME', 'description' => 'The username for hub.docker.com. This variable is used to pull images from hub.docker.com.',