Merge pull request #9463 from appwrite/feat-reuse-node

Feat: Reuse Node runtime
This commit is contained in:
Matej Bačo 2025-03-07 16:03:56 +01:00 committed by GitHub
commit dade177af2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 77 additions and 75 deletions

2
.env
View file

@ -81,7 +81,7 @@ _APP_COMPUTE_RUNTIMES_NETWORK=runtimes
_APP_EXECUTOR_SECRET=your-secret-key
_APP_EXECUTOR_HOST=http://exc1/v1
_APP_FUNCTIONS_RUNTIMES=php-8.0,node-18.0,python-3.9,ruby-3.1
_APP_SITES_RUNTIMES=static-1,ssr-22,flutter-3.24
_APP_SITES_RUNTIMES=static-1,node-22,flutter-3.24
_APP_SITES_FRAMEWORKS=sveltekit,nextjs,nuxt,astro,remix,flutter,other,react,vue # TODO: Angular
_APP_MAINTENANCE_INTERVAL=86400
_APP_MAINTENANCE_DELAY=

View file

@ -21,7 +21,7 @@ return [
'nextjs' => [
'key' => 'nextjs',
'name' => 'Next.js',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'ssr' => [
@ -47,7 +47,7 @@ return [
'react' => [
'key' => 'react',
'name' => 'React',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'static' => [
@ -65,7 +65,7 @@ return [
'nuxt' => [
'key' => 'nuxt',
'name' => 'Nuxt',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'ssr' => [
@ -91,7 +91,7 @@ return [
'vue' => [
'key' => 'vue',
'name' => 'Vue.js',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'static' => [
@ -109,7 +109,7 @@ return [
'sveltekit' => [
'key' => 'sveltekit',
'name' => 'SvelteKit',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'ssr' => [
@ -135,7 +135,7 @@ return [
'astro' => [
'key' => 'astro',
'name' => 'Astro',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'ssr' => [
@ -161,7 +161,7 @@ return [
'remix' => [
'key' => 'remix',
'name' => 'Remix',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'ssr' => [
@ -204,7 +204,7 @@ return [
'other' => [
'key' => 'other',
'name' => 'Other',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'adapters' => [
'static' => [

View file

@ -25,7 +25,7 @@ const TEMPLATE_FRAMEWORKS = [
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'outputDirectory' => './build',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'adapter' => 'ssr',
'fallbackFile' => null,
],
@ -35,7 +35,7 @@ const TEMPLATE_FRAMEWORKS = [
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'outputDirectory' => './.next',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'adapter' => 'ssr',
'fallbackFile' => null,
],
@ -45,7 +45,7 @@ const TEMPLATE_FRAMEWORKS = [
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'outputDirectory' => './.output',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'adapter' => 'ssr',
'fallbackFile' => null,
],
@ -55,7 +55,7 @@ const TEMPLATE_FRAMEWORKS = [
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'outputDirectory' => './build',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'adapter' => 'ssr',
'fallbackFile' => null,
],
@ -65,7 +65,7 @@ const TEMPLATE_FRAMEWORKS = [
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'outputDirectory' => './dist',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'adapter' => 'ssr',
'fallbackFile' => null,
],
@ -84,7 +84,7 @@ const TEMPLATE_FRAMEWORKS = [
'name' => 'Other',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'adapter' => 'static',
'fallbackFile' => 'index.html',
],
@ -93,7 +93,7 @@ const TEMPLATE_FRAMEWORKS = [
'name' => 'React',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'adapter' => 'static',
'outputDirectory' => './dist',
'fallbackFile' => 'index.html',
@ -103,7 +103,7 @@ const TEMPLATE_FRAMEWORKS = [
'name' => 'Vue.js',
'installCommand' => 'npm install',
'buildCommand' => 'npm run build',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'adapter' => 'static',
'outputDirectory' => './dist',
'fallbackFile' => 'index.html',

View file

@ -44,7 +44,7 @@
"ext-openssl": "*",
"ext-zlib": "*",
"ext-sockets": "*",
"appwrite/php-runtimes": "0.17.*",
"appwrite/php-runtimes": "0.18.*",
"appwrite/php-clamav": "2.0.*",
"utopia-php/abuse": "0.50.*",
"utopia-php/analytics": "0.10.*",

62
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6883b3e81cfb0c5355997def668d5df2",
"content-hash": "3b6171de8c624cfbcd723f1cc76a9560",
"packages": [
{
"name": "adhocore/jwt",
@ -157,16 +157,16 @@
},
{
"name": "appwrite/php-runtimes",
"version": "0.17.0",
"version": "0.18.0",
"source": {
"type": "git",
"url": "https://github.com/appwrite/runtimes.git",
"reference": "9a9e20d1f5c28caf539ad4cb52164dc283f99797"
"reference": "f1ddcc567325659ad79506bc9684a4fc2009dc42"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/runtimes/zipball/9a9e20d1f5c28caf539ad4cb52164dc283f99797",
"reference": "9a9e20d1f5c28caf539ad4cb52164dc283f99797",
"url": "https://api.github.com/repos/appwrite/runtimes/zipball/f1ddcc567325659ad79506bc9684a4fc2009dc42",
"reference": "f1ddcc567325659ad79506bc9684a4fc2009dc42",
"shasum": ""
},
"require": {
@ -206,9 +206,9 @@
],
"support": {
"issues": "https://github.com/appwrite/runtimes/issues",
"source": "https://github.com/appwrite/runtimes/tree/0.17.0"
"source": "https://github.com/appwrite/runtimes/tree/0.18.0"
},
"time": "2025-01-10T13:36:30+00:00"
"time": "2025-03-07T14:30:31+00:00"
},
{
"name": "beberlei/assert",
@ -1366,16 +1366,16 @@
},
{
"name": "open-telemetry/exporter-otlp",
"version": "1.2.0",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/opentelemetry-php/exporter-otlp.git",
"reference": "243d9657c44a06f740cf384f486afe954c2b725f"
"reference": "b7580440b7481a98da97aceabeb46e1b276c8747"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/243d9657c44a06f740cf384f486afe954c2b725f",
"reference": "243d9657c44a06f740cf384f486afe954c2b725f",
"url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/b7580440b7481a98da97aceabeb46e1b276c8747",
"reference": "b7580440b7481a98da97aceabeb46e1b276c8747",
"shasum": ""
},
"require": {
@ -1426,7 +1426,7 @@
"issues": "https://github.com/open-telemetry/opentelemetry-php/issues",
"source": "https://github.com/open-telemetry/opentelemetry-php"
},
"time": "2025-01-08T23:50:03+00:00"
"time": "2025-03-06T23:21:56+00:00"
},
{
"name": "open-telemetry/gen-otlp-protobuf",
@ -3906,16 +3906,16 @@
},
{
"name": "utopia-php/framework",
"version": "0.33.18",
"version": "0.33.19",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/http.git",
"reference": "00b3743264973a7e6e7bfef0c61ecb15b855036b"
"reference": "64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/http/zipball/00b3743264973a7e6e7bfef0c61ecb15b855036b",
"reference": "00b3743264973a7e6e7bfef0c61ecb15b855036b",
"url": "https://api.github.com/repos/utopia-php/http/zipball/64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0",
"reference": "64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0",
"shasum": ""
},
"require": {
@ -3947,9 +3947,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/http/issues",
"source": "https://github.com/utopia-php/http/tree/0.33.18"
"source": "https://github.com/utopia-php/http/tree/0.33.19"
},
"time": "2025-03-06T08:30:11+00:00"
"time": "2025-03-06T11:37:49+00:00"
},
{
"name": "utopia-php/image",
@ -4594,22 +4594,24 @@
},
{
"name": "utopia-php/storage",
"version": "0.18.9",
"version": "0.18.10",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/storage.git",
"reference": "1cf455404e8700b3093fd73d74a38d41cdced90c"
"reference": "76f31158f4251abb207f7a9b16f7cb0bfdb3b39e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/storage/zipball/1cf455404e8700b3093fd73d74a38d41cdced90c",
"reference": "1cf455404e8700b3093fd73d74a38d41cdced90c",
"url": "https://api.github.com/repos/utopia-php/storage/zipball/76f31158f4251abb207f7a9b16f7cb0bfdb3b39e",
"reference": "76f31158f4251abb207f7a9b16f7cb0bfdb3b39e",
"shasum": ""
},
"require": {
"ext-brotli": "*",
"ext-curl": "*",
"ext-fileinfo": "*",
"ext-lz4": "*",
"ext-simplexml": "*",
"ext-snappy": "*",
"ext-xz": "*",
"ext-zlib": "*",
@ -4643,9 +4645,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/storage/issues",
"source": "https://github.com/utopia-php/storage/tree/0.18.9"
"source": "https://github.com/utopia-php/storage/tree/0.18.10"
},
"time": "2025-02-11T13:10:40+00:00"
"time": "2025-03-03T10:47:54+00:00"
},
{
"name": "utopia-php/swoole",
@ -5038,16 +5040,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "0.40.1",
"version": "0.40.2",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "df180676b6fbde7832ae1495af3e2f3e8f700837"
"reference": "56f09482d9e2f223911277ab887f197402708049"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/df180676b6fbde7832ae1495af3e2f3e8f700837",
"reference": "df180676b6fbde7832ae1495af3e2f3e8f700837",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/56f09482d9e2f223911277ab887f197402708049",
"reference": "56f09482d9e2f223911277ab887f197402708049",
"shasum": ""
},
"require": {
@ -5083,9 +5085,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.40.1"
"source": "https://github.com/appwrite/sdk-generator/tree/0.40.2"
},
"time": "2025-02-26T07:07:10+00:00"
"time": "2025-03-06T16:31:03+00:00"
},
{
"name": "doctrine/annotations",

View file

@ -962,7 +962,7 @@ services:
hostname: exc1
<<: *x-logging
stop_signal: SIGINT
image: openruntimes/executor:0.7.7
image: openruntimes/executor:0.7.8
restart: unless-stopped
networks:
- appwrite

View file

@ -26,7 +26,7 @@ class SitesCustomServerTest extends Scope
* Test for SUCCESS
*/
$site = $this->createSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -43,7 +43,7 @@ class SitesCustomServerTest extends Scope
$this->assertEquals('other', $site['body']['framework']);
$this->assertEquals(true, $dateValidator->isValid($site['body']['$createdAt']));
$this->assertEquals(true, $dateValidator->isValid($site['body']['$updatedAt']));
$this->assertEquals('ssr-22', $site['body']['buildRuntime']);
$this->assertEquals('node-22', $site['body']['buildRuntime']);
$this->assertEquals(null, $site['body']['fallbackFile']);
$this->assertEquals('./', $site['body']['outputDirectory']);
@ -73,7 +73,7 @@ class SitesCustomServerTest extends Scope
'siteId' => ID::unique(),
'name' => 'Test Site',
'framework' => 'other',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'outputDirectory' => './',
'fallbackFile' => null,
]);
@ -140,7 +140,7 @@ class SitesCustomServerTest extends Scope
public function testVariables(): void
{
$site = $this->createSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -283,7 +283,7 @@ class SitesCustomServerTest extends Scope
'name' => 'Astro site',
'framework' => 'astro',
'adapter' => 'ssr',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'outputDirectory' => './dist',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
@ -331,7 +331,7 @@ class SitesCustomServerTest extends Scope
* Test for SUCCESS
*/
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -411,7 +411,7 @@ class SitesCustomServerTest extends Scope
* Test pagination
*/
$siteId2 = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site 2',
@ -467,7 +467,7 @@ class SitesCustomServerTest extends Scope
public function testGetSite(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -500,7 +500,7 @@ class SitesCustomServerTest extends Scope
public function testUpdateSite(): void
{
$site = $this->createSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -517,7 +517,7 @@ class SitesCustomServerTest extends Scope
$this->assertEquals('Test Site', $site['body']['name']);
$site = $this->updateSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site Updated',
@ -618,7 +618,7 @@ class SitesCustomServerTest extends Scope
public function testCreateDeployment()
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -679,7 +679,7 @@ class SitesCustomServerTest extends Scope
public function testCancelDeploymentBuild(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -731,7 +731,7 @@ class SitesCustomServerTest extends Scope
public function testUpdateDeployment(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -776,7 +776,7 @@ class SitesCustomServerTest extends Scope
public function testListDeployments(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -955,7 +955,7 @@ class SitesCustomServerTest extends Scope
public function testGetDeployment(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -1006,7 +1006,7 @@ class SitesCustomServerTest extends Scope
public function testUpdateSpecs(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -1023,7 +1023,7 @@ class SitesCustomServerTest extends Scope
*/
// Change the function specs
$site = $this->updateSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -1040,7 +1040,7 @@ class SitesCustomServerTest extends Scope
// Change the specs to 1vcpu 512mb
$site = $this->updateSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -1060,7 +1060,7 @@ class SitesCustomServerTest extends Scope
*/
$site = $this->updateSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -1080,7 +1080,7 @@ class SitesCustomServerTest extends Scope
public function testDeleteDeployment(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -1124,7 +1124,7 @@ class SitesCustomServerTest extends Scope
public function testDeleteSite(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -1630,7 +1630,7 @@ class SitesCustomServerTest extends Scope
public function testSiteDownload(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'fallbackFile' => null,
'framework' => 'other',
'name' => 'Test Site',
@ -1676,7 +1676,7 @@ class SitesCustomServerTest extends Scope
'name' => 'SSR site',
'framework' => 'astro',
'adapter' => 'ssr',
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'outputDirectory' => './dist',
'buildCommand' => 'npm run build',
'installCommand' => 'npm install',
@ -1742,7 +1742,7 @@ class SitesCustomServerTest extends Scope
public function testDuplicateDeployment(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'framework' => 'other',
'name' => 'Duplicate deployment Site',
'adapter' => 'static',
@ -1767,7 +1767,7 @@ class SitesCustomServerTest extends Scope
$site = $this->updateSite([
'$id' => $siteId,
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'framework' => 'other',
'name' => 'Duplicate deployment Site',
'adapter' => 'static',
@ -1788,7 +1788,7 @@ class SitesCustomServerTest extends Scope
public function testUpdateDeploymentStatus(): void
{
$siteId = $this->setupSite([
'buildRuntime' => 'ssr-22',
'buildRuntime' => 'node-22',
'framework' => 'other',
'name' => 'Activate test Site',
'siteId' => ID::unique(),