From 67fa2c9e393f2f66ba3511ad8e3060f11e8f6431 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Mon, 15 Jul 2024 10:53:29 +0100 Subject: [PATCH 1/5] feat: max build size --- app/config/variables.php | 9 +++++++++ src/Appwrite/Platform/Workers/Builds.php | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/app/config/variables.php b/app/config/variables.php index b986ce4247..2b8fdb23a8 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -718,6 +718,15 @@ return [ 'question' => '', 'filter' => '' ], + [ + 'name' => '_APP_FUNCTIONS_SIZE_LIMIT', + 'description' => 'The maximum size deployment after build in bytes. The default value is 2GB.', + 'introduction' => '1.6.0', + 'default' => '2000000000', + 'required' => false, + 'question' => '', + 'filter' => '' + ], [ 'name' => '_APP_FUNCTIONS_TIMEOUT', 'description' => 'The maximum number of seconds allowed as a timeout value when creating a new function. The default value is 900 seconds. This is the global limit, timeout for individual functions are configured in the function\'s settings or in appwrite.json.', diff --git a/src/Appwrite/Platform/Workers/Builds.php b/src/Appwrite/Platform/Workers/Builds.php index 922498c3fa..139da96d45 100644 --- a/src/Appwrite/Platform/Workers/Builds.php +++ b/src/Appwrite/Platform/Workers/Builds.php @@ -491,6 +491,11 @@ class Builds extends Action $endTime = DateTime::now(); $durationEnd = \microtime(true); + $buildSizeLimit = (int) System::getEnv('_APP_FUNCTIONS_BUILD_SIZE_LIMIT', '2000000000'); + if ($response['size'] > $buildSizeLimit) { + throw new \Exception('Build size should be less than ' . number_format($buildSizeLimit / 1048576, 2) . ' MBs.'); + } + /** Update the build document */ $build->setAttribute('startTime', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime'])))); $build->setAttribute('endTime', $endTime); From 67778d5e961731d32a48df46a03e635e671b0be3 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:45:34 +0100 Subject: [PATCH 2/5] fix: typo --- app/config/variables.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/variables.php b/app/config/variables.php index 2b8fdb23a8..7dbec50423 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -719,7 +719,7 @@ return [ 'filter' => '' ], [ - 'name' => '_APP_FUNCTIONS_SIZE_LIMIT', + 'name' => '_APP_FUNCTIONS_BUILD_SIZE_LIMIT', 'description' => 'The maximum size deployment after build in bytes. The default value is 2GB.', 'introduction' => '1.6.0', 'default' => '2000000000', From 339a6153591d1b3af1b9eae86d068b6a6fe3c369 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:25:50 +0100 Subject: [PATCH 3/5] feat: improve description --- app/config/variables.php | 4 ++-- composer.lock | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 7dbec50423..4c0516b2c2 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -711,7 +711,7 @@ return [ 'variables' => [ [ 'name' => '_APP_FUNCTIONS_SIZE_LIMIT', - 'description' => 'The maximum size deployment in bytes. The default value is 30MB.', + 'description' => 'The maximum size of a function in bytes. The default value is 30MB.', 'introduction' => '0.13.0', 'default' => '30000000', 'required' => false, @@ -720,7 +720,7 @@ return [ ], [ 'name' => '_APP_FUNCTIONS_BUILD_SIZE_LIMIT', - 'description' => 'The maximum size deployment after build in bytes. The default value is 2GB.', + 'description' => 'The maximum size of a built deployment in bytes. The default value is 2GB.', 'introduction' => '1.6.0', 'default' => '2000000000', 'required' => false, diff --git a/composer.lock b/composer.lock index 8d307c5c99..3246466a41 100644 --- a/composer.lock +++ b/composer.lock @@ -2989,16 +2989,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.39.2", + "version": "0.39.3", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "550b56aa7ee3f98319b79a20d2478e68a1b5e9bd" + "reference": "16142d88270e368030d7956cadf2d7816413f8c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/550b56aa7ee3f98319b79a20d2478e68a1b5e9bd", - "reference": "550b56aa7ee3f98319b79a20d2478e68a1b5e9bd", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/16142d88270e368030d7956cadf2d7816413f8c4", + "reference": "16142d88270e368030d7956cadf2d7816413f8c4", "shasum": "" }, "require": { @@ -3034,9 +3034,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.39.2" + "source": "https://github.com/appwrite/sdk-generator/tree/0.39.3" }, - "time": "2024-07-10T11:23:54+00:00" + "time": "2024-07-12T15:29:48+00:00" }, { "name": "doctrine/deprecations", From 5eacde84ae29ad5a10e37f8859cff64626fef032 Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Wed, 7 Aug 2024 00:01:54 +0530 Subject: [PATCH 4/5] Add value to variables template --- .../Response/Model/TemplateFunction.php | 3 +- .../Utopia/Response/Model/TemplateRuntime.php | 3 +- .../Response/Model/TemplateVariable.php | 67 ++++++++++--------- 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Model/TemplateFunction.php b/src/Appwrite/Utopia/Response/Model/TemplateFunction.php index 7a3a4cfbd5..f5df10986f 100644 --- a/src/Appwrite/Utopia/Response/Model/TemplateFunction.php +++ b/src/Appwrite/Utopia/Response/Model/TemplateFunction.php @@ -110,8 +110,7 @@ class TemplateFunction extends Model 'default' => [], 'example' => [], 'array' => true - ]) - ; + ]); } /** diff --git a/src/Appwrite/Utopia/Response/Model/TemplateRuntime.php b/src/Appwrite/Utopia/Response/Model/TemplateRuntime.php index c08ea9b32a..c98a59789d 100644 --- a/src/Appwrite/Utopia/Response/Model/TemplateRuntime.php +++ b/src/Appwrite/Utopia/Response/Model/TemplateRuntime.php @@ -33,8 +33,7 @@ class TemplateRuntime extends Model 'description' => 'Path to function in VCS (Version Control System) repository', 'default' => '', 'example' => 'node/starter', - ]) - ; + ]); } /** diff --git a/src/Appwrite/Utopia/Response/Model/TemplateVariable.php b/src/Appwrite/Utopia/Response/Model/TemplateVariable.php index b0fd919dbf..c992083a87 100644 --- a/src/Appwrite/Utopia/Response/Model/TemplateVariable.php +++ b/src/Appwrite/Utopia/Response/Model/TemplateVariable.php @@ -10,37 +10,42 @@ class TemplateVariable extends Model public function __construct() { $this - ->addRule('name', [ - 'type' => self::TYPE_STRING, - 'description' => 'Variable Name.', - 'default' => '', - 'example' => 'APPWRITE_DATABASE_ID', - ]) - ->addRule('description', [ - 'type' => self::TYPE_STRING, - 'description' => 'Variable Description.', - 'default' => '', - 'example' => 'The ID of the Appwrite database that contains the collection to sync.', - ]) - ->addRule('placeholder', [ - 'type' => self::TYPE_STRING, - 'description' => 'Variable Placeholder.', - 'default' => '', - 'example' => '64a55...7b912', - ]) - ->addRule('required', [ - 'type' => self::TYPE_BOOLEAN, - 'description' => 'Is the variable required?', - 'default' => false, - 'example' => false, - ]) - ->addRule('type', [ - 'type' => self::TYPE_STRING, - 'description' => 'Variable Type.', - 'default' => '', - 'example' => 'password', - ]) - ; + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'Variable Name.', + 'default' => '', + 'example' => 'APPWRITE_DATABASE_ID', + ]) + ->addRule('description', [ + 'type' => self::TYPE_STRING, + 'description' => 'Variable Description.', + 'default' => '', + 'example' => 'The ID of the Appwrite database that contains the collection to sync.', + ]) + ->addRule('value', [ + 'type' => self::TYPE_STRING, + 'description' => 'Variable Value.', + 'default' => '', + 'example' => '512', + ]) + ->addRule('placeholder', [ + 'type' => self::TYPE_STRING, + 'description' => 'Variable Placeholder.', + 'default' => '', + 'example' => '64a55...7b912', + ]) + ->addRule('required', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Is the variable required?', + 'default' => false, + 'example' => false, + ]) + ->addRule('type', [ + 'type' => self::TYPE_STRING, + 'description' => 'Variable Type.', + 'default' => '', + 'example' => 'password', + ]); } /** From da2c2e6f1de8a7a34a5536e58edf2da5bffae2bb Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:30:56 +0100 Subject: [PATCH 5/5] chore: update desc --- app/config/variables.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/variables.php b/app/config/variables.php index 4c0516b2c2..eced52d80a 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -720,7 +720,7 @@ return [ ], [ 'name' => '_APP_FUNCTIONS_BUILD_SIZE_LIMIT', - 'description' => 'The maximum size of a built deployment in bytes. The default value is 2GB.', + 'description' => 'The maximum size of a built deployment in bytes. The default value is 2,000,000,000 (2GB), and the maximum value is 4,294,967,295 (4.2GB).', 'introduction' => '1.6.0', 'default' => '2000000000', 'required' => false,