diff --git a/app/config/collections/projects.php b/app/config/collections/projects.php index b209a7ec32..806b6cf088 100644 --- a/app/config/collections/projects.php +++ b/app/config/collections/projects.php @@ -971,16 +971,16 @@ return [ 'default' => false, 'array' => false, ], - // [ - // '$id' => ID::custom('logging'), - // 'type' => Database::VAR_BOOLEAN, - // 'signed' => true, - // 'size' => 0, - // 'format' => '', - // 'filters' => [], - // 'required' => true, - // 'array' => false, - // ], + [ + '$id' => ID::custom('logging'), + 'type' => Database::VAR_BOOLEAN, + 'signed' => true, + 'size' => 0, + 'format' => '', + 'filters' => [], + 'required' => true, + 'array' => false, + ], [ '$id' => ID::custom('framework'), 'type' => Database::VAR_STRING, @@ -1725,6 +1725,28 @@ return [ 'default' => '', 'array' => false, 'filters' => [], + ], + [ + '$id' => ID::custom('adapter'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('fallbackFile'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], ] ], 'indexes' => [ diff --git a/app/config/frameworks.php b/app/config/frameworks.php index cc9e913523..82fd70bf5b 100644 --- a/app/config/frameworks.php +++ b/app/config/frameworks.php @@ -22,7 +22,7 @@ return [ 'screenshotSleep' => 3000, 'buildRuntime' => 'node-22', 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), - 'bundleCommand' => 'sh /usr/local/server/helpers/analog/bundle.sh', + 'bundleCommand' => 'bash /usr/local/server/helpers/analog/bundle.sh', 'envCommand' => 'source /usr/local/server/helpers/analog/env.sh', 'adapters' => [ 'ssr' => [ @@ -30,14 +30,14 @@ return [ 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './dist/analog', - 'startCommand' => 'sh helpers/analog/server.sh', + 'startCommand' => 'bash helpers/analog/server.sh', ], 'static' => [ 'key' => 'static', 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './dist/analog/public', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', 'fallbackFile' => 'index.html' ] ] @@ -48,7 +48,7 @@ return [ 'screenshotSleep' => 3000, 'buildRuntime' => 'node-22', 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), - 'bundleCommand' => 'sh /usr/local/server/helpers/angular/bundle.sh', + 'bundleCommand' => 'bash /usr/local/server/helpers/angular/bundle.sh', 'envCommand' => 'source /usr/local/server/helpers/angular/env.sh', 'adapters' => [ 'ssr' => [ @@ -56,14 +56,14 @@ return [ 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './dist/angular', - 'startCommand' => 'sh helpers/angular/server.sh', + 'startCommand' => 'bash helpers/angular/server.sh', ], 'static' => [ 'key' => 'static', 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './dist/angular/browser', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', 'fallbackFile' => 'index.csr.html' ] ] @@ -74,7 +74,7 @@ return [ 'screenshotSleep' => 3000, 'buildRuntime' => 'node-22', 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), - 'bundleCommand' => 'sh /usr/local/server/helpers/next-js/bundle.sh', + 'bundleCommand' => 'bash /usr/local/server/helpers/next-js/bundle.sh', 'envCommand' => 'source /usr/local/server/helpers/next-js/env.sh', 'adapters' => [ 'ssr' => [ @@ -82,14 +82,14 @@ return [ 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './.next', - 'startCommand' => 'sh helpers/next-js/server.sh', + 'startCommand' => 'bash helpers/next-js/server.sh', ], 'static' => [ 'key' => 'static', 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './out', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', ] ] ], @@ -105,7 +105,7 @@ return [ 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './dist', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', 'fallbackFile' => 'index.html' ] ] @@ -116,7 +116,7 @@ return [ 'screenshotSleep' => 3000, 'buildRuntime' => 'node-22', 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), - 'bundleCommand' => 'sh /usr/local/server/helpers/nuxt/bundle.sh', + 'bundleCommand' => 'bash /usr/local/server/helpers/nuxt/bundle.sh', 'envCommand' => 'source /usr/local/server/helpers/nuxt/env.sh', 'adapters' => [ 'ssr' => [ @@ -124,14 +124,14 @@ return [ 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './.output', - 'startCommand' => 'sh helpers/nuxt/server.sh', + 'startCommand' => 'bash helpers/nuxt/server.sh', ], 'static' => [ 'key' => 'static', 'buildCommand' => 'npm run generate', 'installCommand' => 'npm install', 'outputDirectory' => './output/public', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', ] ] ], @@ -147,7 +147,7 @@ return [ 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './dist', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', 'fallbackFile' => 'index.html' ] ] @@ -158,7 +158,7 @@ return [ 'screenshotSleep' => 3000, 'buildRuntime' => 'node-22', 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), - 'bundleCommand' => 'sh /usr/local/server/helpers/sveltekit/bundle.sh', + 'bundleCommand' => 'bash /usr/local/server/helpers/sveltekit/bundle.sh', 'envCommand' => 'source /usr/local/server/helpers/sveltekit/env.sh', 'adapters' => [ 'ssr' => [ @@ -166,14 +166,14 @@ return [ 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './build', - 'startCommand' => 'sh helpers/sveltekit/server.sh', + 'startCommand' => 'bash helpers/sveltekit/server.sh', ], 'static' => [ 'key' => 'static', 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './build', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', ] ] ], @@ -183,7 +183,7 @@ return [ 'screenshotSleep' => 3000, 'buildRuntime' => 'node-22', 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), - 'bundleCommand' => 'sh /usr/local/server/helpers/astro/bundle.sh', + 'bundleCommand' => 'bash /usr/local/server/helpers/astro/bundle.sh', 'envCommand' => 'source /usr/local/server/helpers/astro/env.sh', 'adapters' => [ 'ssr' => [ @@ -191,14 +191,14 @@ return [ 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './dist', - 'startCommand' => 'sh helpers/astro/server.sh', + 'startCommand' => 'bash helpers/astro/server.sh', ], 'static' => [ 'key' => 'static', 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './dist', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', ] ] ], @@ -208,7 +208,7 @@ return [ 'screenshotSleep' => 3000, 'buildRuntime' => 'node-22', 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), - 'bundleCommand' => 'sh /usr/local/server/helpers/remix/bundle.sh', + 'bundleCommand' => 'bash /usr/local/server/helpers/remix/bundle.sh', 'envCommand' => 'source /usr/local/server/helpers/remix/env.sh', 'adapters' => [ 'ssr' => [ @@ -216,14 +216,14 @@ return [ 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './build', - 'startCommand' => 'sh helpers/remix/server.sh', + 'startCommand' => 'bash helpers/remix/server.sh', ], 'static' => [ 'key' => 'static', 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './build/client', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', ] ] ], @@ -239,7 +239,7 @@ return [ 'buildCommand' => 'flutter build web', 'installCommand' => '', 'outputDirectory' => './build/web', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', ], ], ], @@ -255,7 +255,7 @@ return [ 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './dist', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', ], ] ], @@ -271,7 +271,7 @@ return [ 'buildCommand' => '', 'installCommand' => '', 'outputDirectory' => './', - 'startCommand' => 'sh helpers/server.sh', + 'startCommand' => 'bash helpers/server.sh', ], ] ], diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 9e9f99db63..cc8a611416 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -9268,7 +9268,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "x-example": false }, "entrypoint": { @@ -9889,7 +9889,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "x-example": false }, "entrypoint": { @@ -24730,6 +24730,11 @@ "description": "Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.", "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "x-example": false + }, "timeout": { "type": "integer", "description": "Maximum request time in seconds.", @@ -25360,6 +25365,11 @@ "description": "Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.", "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "x-example": false + }, "timeout": { "type": "integer", "description": "Maximum request time in seconds.", @@ -36864,6 +36874,11 @@ "description": "Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration.", "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "x-example": false + }, "framework": { "type": "string", "description": "Site framework.", @@ -36986,6 +37001,7 @@ "name", "enabled", "live", + "logging", "framework", "deploymentId", "deploymentCreatedAt", @@ -37205,7 +37221,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "x-example": false }, "runtime": { diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 287ce791c3..ecda53b77b 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -8355,7 +8355,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "x-example": false }, "entrypoint": { @@ -8751,7 +8751,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "x-example": false }, "entrypoint": { @@ -16828,6 +16828,11 @@ "description": "Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.", "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "x-example": false + }, "timeout": { "type": "integer", "description": "Maximum request time in seconds.", @@ -17233,6 +17238,11 @@ "description": "Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.", "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "x-example": false + }, "timeout": { "type": "integer", "description": "Maximum request time in seconds.", @@ -27413,6 +27423,11 @@ "description": "Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration.", "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "x-example": false + }, "framework": { "type": "string", "description": "Site framework.", @@ -27535,6 +27550,7 @@ "name", "enabled", "live", + "logging", "framework", "deploymentId", "deploymentCreatedAt", @@ -27603,7 +27619,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "x-example": false }, "runtime": { diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index 05acf4a551..4d3ab5bce8 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -9425,7 +9425,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "default": true, "x-example": false }, @@ -10061,7 +10061,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "default": true, "x-example": false }, @@ -25234,6 +25234,12 @@ "default": true, "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "default": true, + "x-example": false + }, "timeout": { "type": "integer", "description": "Maximum request time in seconds.", @@ -25878,6 +25884,12 @@ "default": true, "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "default": true, + "x-example": false + }, "timeout": { "type": "integer", "description": "Maximum request time in seconds.", @@ -37444,6 +37456,11 @@ "description": "Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration.", "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "x-example": false + }, "framework": { "type": "string", "description": "Site framework.", @@ -37567,6 +37584,7 @@ "name", "enabled", "live", + "logging", "framework", "deploymentId", "deploymentCreatedAt", @@ -37788,7 +37806,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "x-example": false }, "runtime": { diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index b7371b1bbd..c2d3b06ebc 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -8509,7 +8509,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "default": true, "x-example": false }, @@ -8924,7 +8924,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "default": true, "x-example": false }, @@ -17298,6 +17298,12 @@ "default": true, "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "default": true, + "x-example": false + }, "timeout": { "type": "integer", "description": "Maximum request time in seconds.", @@ -17721,6 +17727,12 @@ "default": true, "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "default": true, + "x-example": false + }, "timeout": { "type": "integer", "description": "Maximum request time in seconds.", @@ -27964,6 +27976,11 @@ "description": "Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration.", "x-example": false }, + "logging": { + "type": "boolean", + "description": "When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.", + "x-example": false + }, "framework": { "type": "string", "description": "Site framework.", @@ -28087,6 +28104,7 @@ "name", "enabled", "live", + "logging", "framework", "deploymentId", "deploymentCreatedAt", @@ -28155,7 +28173,7 @@ }, "logging": { "type": "boolean", - "description": "Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.", + "description": "When disabled, executions will exclude logs and errors, and will be slightly faster.", "x-example": false }, "runtime": { diff --git a/app/config/templates/site.php b/app/config/templates/site.php index e90b27d97e..ba58940969 100644 --- a/app/config/templates/site.php +++ b/app/config/templates/site.php @@ -16,6 +16,16 @@ if (System::getEnv('_APP_ENV') === 'development') { $url = $protocol . '://' . $hostname; +class UseCases +{ + public const PORTFOLIO = 'portfolio'; + public const STARTER = 'starter'; + public const EVENTS = 'events'; + public const ECOMMERCE = 'ecommerce'; + public const DOCUMENTATION = 'documentation'; + public const BLOG = 'blog'; +} + const TEMPLATE_FRAMEWORKS = [ 'SVELTEKIT' => [ 'key' => 'sveltekit', @@ -125,6 +135,15 @@ const TEMPLATE_FRAMEWORKS = [ 'outputDirectory' => './dist', 'fallbackFile' => 'index.html', ], + 'OTHER' => [ + 'key' => 'other', + 'name' => 'Other', + 'installCommand' => '', + 'buildCommand' => '', + 'buildRuntime' => 'node-22', + 'adapter' => 'static', + 'outputDirectory' => './', + ], ]; function getFramework(string $frameworkEnum, array $overrides) @@ -135,14 +154,128 @@ function getFramework(string $frameworkEnum, array $overrides) return [ [ - 'key' => 'template-for-onelink', - 'name' => 'Onelink template', - 'useCases' => ['starter'], - 'screenshotDark' => $url . '/images/sites/templates/template-for-onelink-dark.png', - 'screenshotLight' => $url . '/images/sites/templates/template-for-onelink-light.png', + 'key' => 'vitepress', + 'name' => 'Vitepress', + 'useCases' => [UseCases::DOCUMENTATION], + 'screenshotDark' => $url . '/images/sites/templates/vitepress-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/vitepress-light.png', + 'frameworks' => [ + getFramework('VITE', [ + 'providerRootDirectory' => './vite/vitepress', + 'outputDirectory' => '404.html', + 'installCommand' => 'npm i vitepress && npm install', + 'buildCommand' => 'npm run docs:build', + 'outputDirectory' => './.vitepress/dist', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'vuepress', + 'name' => 'Vuepress', + 'useCases' => [UseCases::DOCUMENTATION], + 'screenshotDark' => $url . '/images/sites/templates/vuepress-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/vuepress-light.png', + 'frameworks' => [ + getFramework('VUE', [ + 'providerRootDirectory' => './vue/vuepress', + 'outputDirectory' => '404.html', + 'installCommand' => 'npm install', + 'buildCommand' => 'npm run build', + 'outputDirectory' => './src/.vuepress/dist', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'docusaurus', + 'name' => 'Docusaurus', + 'useCases' => [UseCases::DOCUMENTATION], + 'screenshotDark' => $url . '/images/sites/templates/docusaurus-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/docusaurus-light.png', + 'frameworks' => [ + getFramework('REACT', [ + 'providerRootDirectory' => './react/docusaurus', + 'outputDirectory' => '404.html', + 'installCommand' => 'npm install', + 'buildCommand' => 'npm run build', + 'outputDirectory' => './build', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'nxt-lnk', + 'name' => 'Nxt Lnk', + 'useCases' => [UseCases::PORTFOLIO], + 'screenshotDark' => $url . '/images/sites/templates/nxt-lnk-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/nxt-lnk-light.png', + 'frameworks' => [ + getFramework('NEXTJS', [ + 'providerRootDirectory' => './nextjs/nxtlnk', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'magic-portfolio', + 'name' => 'Magic Portfolio', + 'useCases' => [UseCases::PORTFOLIO], + 'screenshotDark' => $url . '/images/sites/templates/magic-portfolio-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/magic-portfolio-light.png', + 'frameworks' => [ + getFramework('NEXTJS', [ + 'providerRootDirectory' => './nextjs/magic-portfolio', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'littlelink', + 'name' => 'LittleLink', + 'useCases' => [UseCases::PORTFOLIO], + 'screenshotDark' => $url . '/images/sites/templates/littlelink-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/littlelink-light.png', + 'frameworks' => [ + getFramework('OTHER', [ + 'providerRootDirectory' => './other/littlelink', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'logspot', + 'name' => 'Logspot', + 'useCases' => [UseCases::BLOG], + 'screenshotDark' => $url . '/images/sites/templates/logspot-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/logspot-light.png', 'frameworks' => [ getFramework('NUXT', [ - 'providerRootDirectory' => './onelink', + 'providerRootDirectory' => './nuxt/logspot', 'buildCommand' => 'npm run generate', 'outputDirectory' => './dist', 'adapter' => 'static', @@ -150,20 +283,116 @@ return [ ], 'vcsProvider' => 'github', 'providerRepositoryId' => 'templates-for-sites', - 'providerOwner' => 'Meldiron', - 'providerVersion' => '0.1.*', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'astro-nano', + 'name' => 'Astro Nano', + 'useCases' => [UseCases::PORTFOLIO], + 'screenshotDark' => $url . '/images/sites/templates/astro-nano-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/astro-nano-light.png', + 'frameworks' => [ + getFramework('ASTRO', [ + 'providerRootDirectory' => './astro/nano', + 'outputDirectory' => './dist', + 'adapter' => 'static', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'astro-starlight', + 'name' => 'Astro Starlight', + 'useCases' => [UseCases::DOCUMENTATION], + 'screenshotDark' => $url . '/images/sites/templates/astro-starlight-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/astro-starlight-light.png', + 'frameworks' => [ + getFramework('ASTRO', [ + 'providerRootDirectory' => './astro/starlight', + 'outputDirectory' => './dist', + 'adapter' => 'static', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'astro-sphere', + 'name' => 'Astro Sphere', + 'useCases' => [UseCases::PORTFOLIO], + 'screenshotDark' => $url . '/images/sites/templates/astro-sphere-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/astro-sphere-light.png', + 'frameworks' => [ + getFramework('ASTRO', [ + 'providerRootDirectory' => './astro/sphere', + 'outputDirectory' => './dist', + 'adapter' => 'static', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'astro-starlog', + 'name' => 'Astro Starlog', + 'useCases' => [UseCases::BLOG], + 'screenshotDark' => $url . '/images/sites/templates/astro-starlog-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/astro-starlog-light.png', + 'frameworks' => [ + getFramework('ASTRO', [ + 'providerRootDirectory' => './astro/starlog', + 'outputDirectory' => './dist', + 'adapter' => 'static', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', + 'variables' => [] + ], + [ + 'key' => 'onelink', + 'name' => 'Onelink', + 'useCases' => [UseCases::PORTFOLIO], + 'screenshotDark' => $url . '/images/sites/templates/onelink-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/onelink-light.png', + 'frameworks' => [ + getFramework('NUXT', [ + 'providerRootDirectory' => './nuxt/onelink', + 'buildCommand' => 'npm run generate', + 'outputDirectory' => './dist', + 'adapter' => 'static', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'templates-for-sites', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.3.*', 'variables' => [] ], [ 'key' => 'starter-for-flutter', 'name' => 'Flutter starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/starter-for-flutter-dark.png', 'screenshotLight' => $url . '/images/sites/templates/starter-for-flutter-light.png', 'frameworks' => [ getFramework('FLUTTER', [ 'providerRootDirectory' => './', - 'buildCommand' => 'sh build.sh', + 'buildCommand' => 'bash build.sh', ]), ], 'vcsProvider' => 'github', @@ -200,7 +429,7 @@ return [ [ 'key' => 'starter-for-js', 'name' => 'JavaScript starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/starter-for-js-dark.png', 'screenshotLight' => $url . '/images/sites/templates/starter-for-js-light.png', 'frameworks' => [ @@ -242,14 +471,14 @@ return [ [ 'key' => 'starter-for-angular', 'name' => 'Angular starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/starter-for-angular-dark.png', 'screenshotLight' => $url . '/images/sites/templates/starter-for-angular-light.png', 'frameworks' => [ getFramework('ANGULAR', [ 'providerRootDirectory' => './', 'outputDirectory' => './dist/angular-starter-kit-for-appwrite/browser', - 'buildCommand' => 'sh prepare-env.sh && npm run build' + 'buildCommand' => 'bash prepare-env.sh && npm run build' ]), ], 'vcsProvider' => 'github', @@ -286,7 +515,7 @@ return [ [ 'key' => 'starter-for-svelte', 'name' => 'Svelte starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/starter-for-svelte-dark.png', 'screenshotLight' => $url . '/images/sites/templates/starter-for-svelte-light.png', 'frameworks' => [ @@ -328,7 +557,7 @@ return [ [ 'key' => 'starter-for-react', 'name' => 'React starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/starter-for-react-dark.png', 'screenshotLight' => $url . '/images/sites/templates/starter-for-react-light.png', 'frameworks' => [ @@ -370,7 +599,7 @@ return [ [ 'key' => 'starter-for-vue', 'name' => 'Vue starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/starter-for-vue-dark.png', 'screenshotLight' => $url . '/images/sites/templates/starter-for-vue-light.png', 'frameworks' => [ @@ -412,7 +641,7 @@ return [ [ 'key' => 'starter-for-react-native', 'name' => 'React Native starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/starter-for-react-native-dark.png', 'screenshotLight' => $url . '/images/sites/templates/starter-for-react-native-light.png', 'frameworks' => [ @@ -455,7 +684,7 @@ return [ [ 'key' => 'starter-for-nextjs', 'name' => 'Next.js starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/starter-for-nextjs-dark.png', 'screenshotLight' => $url . '/images/sites/templates/starter-for-nextjs-light.png', 'frameworks' => [ @@ -497,7 +726,7 @@ return [ [ 'key' => 'starter-for-nuxt', 'name' => 'Nuxt starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/starter-for-nuxt-dark.png', 'screenshotLight' => $url . '/images/sites/templates/starter-for-nuxt-light.png', 'frameworks' => [ @@ -539,7 +768,7 @@ return [ [ 'key' => 'template-for-event', 'name' => 'Event template', - 'useCases' => ['starter'], + 'useCases' => [UseCases::EVENTS], 'screenshotDark' => $url . '/images/sites/templates/template-for-event-dark.png', 'screenshotLight' => $url . '/images/sites/templates/template-for-event-light.png', 'frameworks' => [ @@ -575,7 +804,7 @@ return [ [ 'key' => 'template-for-portfolio', 'name' => 'Portfolio template', - 'useCases' => ['starter'], + 'useCases' => [UseCases::PORTFOLIO], 'screenshotDark' => $url . '/images/sites/templates/template-for-portfolio-dark.png', 'screenshotLight' => $url . '/images/sites/templates/template-for-portfolio-light.png', 'frameworks' => [ @@ -592,7 +821,7 @@ return [ [ 'key' => 'template-for-store', 'name' => 'Store template', - 'useCases' => ['starter'], + 'useCases' => [UseCases::ECOMMERCE], 'screenshotDark' => $url . '/images/sites/templates/template-for-store-dark.png', 'screenshotLight' => $url . '/images/sites/templates/template-for-store-light.png', 'frameworks' => [ @@ -634,7 +863,7 @@ return [ [ 'key' => 'template-for-blog', 'name' => 'Blog template', - 'useCases' => ['starter'], + 'useCases' => [UseCases::BLOG], 'screenshotDark' => $url . '/images/sites/templates/template-for-blog-dark.png', 'screenshotLight' => $url . '/images/sites/templates/template-for-blog-light.png', 'frameworks' => [ @@ -651,7 +880,7 @@ return [ [ 'key' => 'astro-starter', 'name' => 'Astro starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/astro-starter-dark.png', 'screenshotLight' => $url . '/images/sites/templates/astro-starter-light.png', 'frameworks' => [ @@ -668,7 +897,7 @@ return [ [ 'key' => 'remix-starter', 'name' => 'Remix starter', - 'useCases' => ['starter'], + 'useCases' => [UseCases::STARTER], 'screenshotDark' => $url . '/images/sites/templates/remix-starter-dark.png', 'screenshotLight' => $url . '/images/sites/templates/remix-starter-light.png', 'frameworks' => [ @@ -682,72 +911,4 @@ return [ 'providerVersion' => '0.2.*', 'variables' => [], ], - [ - 'key' => 'flutter-starter', - 'name' => 'Flutter starter', - 'useCases' => ['starter'], - 'screenshotDark' => $url . '/images/sites/templates/flutter-starter-dark.png', - 'screenshotLight' => $url . '/images/sites/templates/flutter-starter-light.png', - 'frameworks' => [ - getFramework('FLUTTER', [ - 'providerRootDirectory' => './flutter/starter', - ]), - ], - 'vcsProvider' => 'github', - 'providerRepositoryId' => 'templates-for-sites', - 'providerOwner' => 'appwrite', - 'providerVersion' => '0.2.*', - 'variables' => [], - ], - [ - 'key' => 'nextjs-starter', - 'name' => 'Next.js starter website', - 'useCases' => ['starter'], - 'screenshotDark' => $url . '/images/sites/templates/nextjs-starter-dark.png', - 'screenshotLight' => $url . '/images/sites/templates/nextjs-starter-light.png', - 'frameworks' => [ - getFramework('NEXTJS', [ - 'providerRootDirectory' => './nextjs/starter', - ]), - ], - 'vcsProvider' => 'github', - 'providerRepositoryId' => 'templates-for-sites', - 'providerOwner' => 'appwrite', - 'providerVersion' => '0.2.*', - 'variables' => [], - ], - [ - 'key' => 'nuxt-starter', - 'name' => 'Nuxt starter website', - 'useCases' => ['starter'], - 'screenshotDark' => $url . '/images/sites/templates/nuxt-starter-dark.png', - 'screenshotLight' => $url . '/images/sites/templates/nuxt-starter-light.png', - 'frameworks' => [ - getFramework('NUXT', [ - 'providerRootDirectory' => './nuxt/starter', - ]), - ], - 'vcsProvider' => 'github', - 'providerRepositoryId' => 'templates-for-sites', - 'providerOwner' => 'appwrite', - 'providerVersion' => '0.2.*', - 'variables' => [], - ], - [ - 'key' => 'sveltekit-starter', - 'name' => 'SvelteKit starter website', - 'useCases' => ['starter'], - 'screenshotDark' => $url . '/images/sites/templates/sveltekit-starter-dark.png', - 'screenshotLight' => $url . '/images/sites/templates/sveltekit-starter-light.png', - 'frameworks' => [ - getFramework('SVELTEKIT', [ - 'providerRootDirectory' => './sveltekit/starter', - ]), - ], - 'vcsProvider' => 'github', - 'providerRepositoryId' => 'templates-for-sites', - 'providerOwner' => 'appwrite', - 'providerVersion' => '0.2.*', - 'variables' => [], - ], ]; diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index 107be3d888..5b2cabdab2 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -232,6 +232,8 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId 'entrypoint' => $resource->getAttribute('entrypoint', ''), 'buildCommands' => \implode(' && ', $commands), 'buildOutput' => $resource->getAttribute('outputDirectory', ''), + 'adapter' => $resource->getAttribute('adapter', ''), + 'fallbackFile' => $resource->getAttribute('fallbackFile', ''), 'type' => 'vcs', 'installationId' => $installationId, 'installationInternalId' => $installationInternalId, diff --git a/app/controllers/general.php b/app/controllers/general.php index 3afe1d8a3d..3f105484e1 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -261,7 +261,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw }; // Static site enforced runtime - if ($resource->getAttribute('adapter', '') === 'static') { + if ($deployment->getAttribute('adapter', '') === 'static') { $runtime = $runtimes['static-1'] ?? null; } @@ -410,8 +410,8 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw ]); // SPA fallbackFile override - if ($resource->getAttribute('adapter', '') === 'static' && $resource->getAttribute('fallbackFile', '') !== '') { - $vars['OPEN_RUNTIMES_STATIC_FALLBACK'] = $resource->getAttribute('fallbackFile', ''); + if ($deployment->getAttribute('adapter', '') === 'static' && $deployment->getAttribute('fallbackFile', '') !== '') { + $vars['OPEN_RUNTIMES_STATIC_FALLBACK'] = $deployment->getAttribute('fallbackFile', ''); } /** Execute function */ @@ -438,7 +438,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw $startCommand = $runtime['startCommand']; if (!is_null($framework)) { - $adapter = ($framework['adapters'] ?? [])[$resource->getAttribute('adapter', '')] ?? null; + $adapter = ($framework['adapters'] ?? [])[$deployment->getAttribute('adapter', '')] ?? null; if (!is_null($adapter) && isset($adapter['startCommand'])) { $startCommand = $adapter['startCommand']; } @@ -473,7 +473,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw ); // Branded 404 override - if ($executionResponse['statusCode'] === 404 && $resource->getAttribute('adapter', '') === 'static') { + if ($executionResponse['statusCode'] === 404 && $deployment->getAttribute('adapter', '') === 'static') { $layout = new View(__DIR__ . '/../views/general/404.phtml'); $executionResponse['body'] = $layout->render(); $executionResponse['headers']['content-length'] = \strlen($executionResponse['body']); diff --git a/composer.json b/composer.json index 66b18c7a7b..8650a8b387 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "ext-openssl": "*", "ext-zlib": "*", "ext-sockets": "*", - "appwrite/php-runtimes": "0.18.*", + "appwrite/php-runtimes": "0.19.*", "appwrite/php-clamav": "2.0.*", "utopia-php/abuse": "0.52.*", "utopia-php/analytics": "0.10.*", diff --git a/composer.lock b/composer.lock index aa9598eb05..ee5f16f7c9 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "eeb306ee6d2576e466ceea5e927664d0", + "content-hash": "e4281c45c1b60dade2ec8df58e6926d5", "packages": [ { "name": "adhocore/jwt", @@ -157,16 +157,16 @@ }, { "name": "appwrite/php-runtimes", - "version": "0.18.1", + "version": "0.19.0", "source": { "type": "git", "url": "https://github.com/appwrite/runtimes.git", - "reference": "97b5d97ae2c0fc9a2a374769eadff024f95783aa" + "reference": "8d21483efc19b9d977e323188989ee67a188464b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/runtimes/zipball/97b5d97ae2c0fc9a2a374769eadff024f95783aa", - "reference": "97b5d97ae2c0fc9a2a374769eadff024f95783aa", + "url": "https://api.github.com/repos/appwrite/runtimes/zipball/8d21483efc19b9d977e323188989ee67a188464b", + "reference": "8d21483efc19b9d977e323188989ee67a188464b", "shasum": "" }, "require": { @@ -206,9 +206,9 @@ ], "support": { "issues": "https://github.com/appwrite/runtimes/issues", - "source": "https://github.com/appwrite/runtimes/tree/0.18.1" + "source": "https://github.com/appwrite/runtimes/tree/0.19.0" }, - "time": "2025-03-11T14:05:46+00:00" + "time": "2025-03-25T22:37:51+00:00" }, { "name": "beberlei/assert", @@ -2372,16 +2372,16 @@ }, { "name": "ramsey/collection", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109" + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109", - "reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109", + "url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2", + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2", "shasum": "" }, "require": { @@ -2442,9 +2442,9 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/2.1.0" + "source": "https://github.com/ramsey/collection/tree/2.1.1" }, - "time": "2025-03-02T04:48:29+00:00" + "time": "2025-03-22T05:38:12+00:00" }, { "name": "ramsey/uuid", @@ -5089,16 +5089,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.40.9", + "version": "0.40.10", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "dbb45a5db22cdc3368fe2573c07ba6088f188fa4" + "reference": "054ac96285caf4f77879087b2416a5ddb8263051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/dbb45a5db22cdc3368fe2573c07ba6088f188fa4", - "reference": "dbb45a5db22cdc3368fe2573c07ba6088f188fa4", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/054ac96285caf4f77879087b2416a5ddb8263051", + "reference": "054ac96285caf4f77879087b2416a5ddb8263051", "shasum": "" }, "require": { @@ -5134,9 +5134,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.9" + "source": "https://github.com/appwrite/sdk-generator/tree/0.40.10" }, - "time": "2025-03-17T18:39:14+00:00" + "time": "2025-03-25T13:44:16+00:00" }, { "name": "doctrine/annotations", diff --git a/docker-compose.yml b/docker-compose.yml index 64aee1c2b4..4bd32189dc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -205,7 +205,7 @@ services: appwrite-console: <<: *x-logging container_name: appwrite-console - image: appwrite/console:5.3.0-sites-rc.27 + image: appwrite/console:5.3.0-sites-rc.31 restart: unless-stopped networks: - appwrite @@ -961,7 +961,7 @@ services: hostname: exc1 <<: *x-logging stop_signal: SIGINT - image: openruntimes/executor:0.7.10 + image: openruntimes/executor:0.7.13 restart: unless-stopped networks: - appwrite diff --git a/public/images/sites/templates/astro-nano-dark.png b/public/images/sites/templates/astro-nano-dark.png new file mode 100644 index 0000000000..dec79ae9b2 Binary files /dev/null and b/public/images/sites/templates/astro-nano-dark.png differ diff --git a/public/images/sites/templates/astro-nano-light.png b/public/images/sites/templates/astro-nano-light.png new file mode 100644 index 0000000000..3a846c94d9 Binary files /dev/null and b/public/images/sites/templates/astro-nano-light.png differ diff --git a/public/images/sites/templates/astro-sphere-dark.png b/public/images/sites/templates/astro-sphere-dark.png new file mode 100644 index 0000000000..ba12a3bcb7 Binary files /dev/null and b/public/images/sites/templates/astro-sphere-dark.png differ diff --git a/public/images/sites/templates/astro-sphere-light.png b/public/images/sites/templates/astro-sphere-light.png new file mode 100644 index 0000000000..0a24d533d8 Binary files /dev/null and b/public/images/sites/templates/astro-sphere-light.png differ diff --git a/public/images/sites/templates/astro-starlight-dark.png b/public/images/sites/templates/astro-starlight-dark.png new file mode 100644 index 0000000000..0c8f722e7e Binary files /dev/null and b/public/images/sites/templates/astro-starlight-dark.png differ diff --git a/public/images/sites/templates/astro-starlight-light.png b/public/images/sites/templates/astro-starlight-light.png new file mode 100644 index 0000000000..bade7a585a Binary files /dev/null and b/public/images/sites/templates/astro-starlight-light.png differ diff --git a/public/images/sites/templates/astro-starlog-dark.png b/public/images/sites/templates/astro-starlog-dark.png new file mode 100644 index 0000000000..00354471c3 Binary files /dev/null and b/public/images/sites/templates/astro-starlog-dark.png differ diff --git a/public/images/sites/templates/astro-starlog-light.png b/public/images/sites/templates/astro-starlog-light.png new file mode 100644 index 0000000000..4eb8cd7b19 Binary files /dev/null and b/public/images/sites/templates/astro-starlog-light.png differ diff --git a/public/images/sites/templates/docusaurus-dark.png b/public/images/sites/templates/docusaurus-dark.png new file mode 100644 index 0000000000..916ce071ec Binary files /dev/null and b/public/images/sites/templates/docusaurus-dark.png differ diff --git a/public/images/sites/templates/docusaurus-light.png b/public/images/sites/templates/docusaurus-light.png new file mode 100644 index 0000000000..916ce071ec Binary files /dev/null and b/public/images/sites/templates/docusaurus-light.png differ diff --git a/public/images/sites/templates/flutter-starter-dark.png b/public/images/sites/templates/flutter-starter-dark.png deleted file mode 100644 index 9b239ff767..0000000000 Binary files a/public/images/sites/templates/flutter-starter-dark.png and /dev/null differ diff --git a/public/images/sites/templates/flutter-starter-light.png b/public/images/sites/templates/flutter-starter-light.png deleted file mode 100644 index 9b239ff767..0000000000 Binary files a/public/images/sites/templates/flutter-starter-light.png and /dev/null differ diff --git a/public/images/sites/templates/littlelink-dark.png b/public/images/sites/templates/littlelink-dark.png new file mode 100644 index 0000000000..fe94d21b53 Binary files /dev/null and b/public/images/sites/templates/littlelink-dark.png differ diff --git a/public/images/sites/templates/littlelink-light.png b/public/images/sites/templates/littlelink-light.png new file mode 100644 index 0000000000..79392906c3 Binary files /dev/null and b/public/images/sites/templates/littlelink-light.png differ diff --git a/public/images/sites/templates/logspot-dark.png b/public/images/sites/templates/logspot-dark.png new file mode 100644 index 0000000000..236ca177c6 Binary files /dev/null and b/public/images/sites/templates/logspot-dark.png differ diff --git a/public/images/sites/templates/logspot-light.png b/public/images/sites/templates/logspot-light.png new file mode 100644 index 0000000000..236ca177c6 Binary files /dev/null and b/public/images/sites/templates/logspot-light.png differ diff --git a/public/images/sites/templates/magic-portfolio-dark.png b/public/images/sites/templates/magic-portfolio-dark.png new file mode 100644 index 0000000000..5fbe91977d Binary files /dev/null and b/public/images/sites/templates/magic-portfolio-dark.png differ diff --git a/public/images/sites/templates/magic-portfolio-light.png b/public/images/sites/templates/magic-portfolio-light.png new file mode 100644 index 0000000000..233c3bb046 Binary files /dev/null and b/public/images/sites/templates/magic-portfolio-light.png differ diff --git a/public/images/sites/templates/nextjs-starter-dark.png b/public/images/sites/templates/nextjs-starter-dark.png deleted file mode 100644 index 022e981d08..0000000000 Binary files a/public/images/sites/templates/nextjs-starter-dark.png and /dev/null differ diff --git a/public/images/sites/templates/nextjs-starter-light.png b/public/images/sites/templates/nextjs-starter-light.png deleted file mode 100644 index 0e19bf5d37..0000000000 Binary files a/public/images/sites/templates/nextjs-starter-light.png and /dev/null differ diff --git a/public/images/sites/templates/nuxt-starter-dark.png b/public/images/sites/templates/nuxt-starter-dark.png deleted file mode 100644 index bea04f1cf9..0000000000 Binary files a/public/images/sites/templates/nuxt-starter-dark.png and /dev/null differ diff --git a/public/images/sites/templates/nuxt-starter-light.png b/public/images/sites/templates/nuxt-starter-light.png deleted file mode 100644 index 006e366a9f..0000000000 Binary files a/public/images/sites/templates/nuxt-starter-light.png and /dev/null differ diff --git a/public/images/sites/templates/nxt-lnk-dark.png b/public/images/sites/templates/nxt-lnk-dark.png new file mode 100644 index 0000000000..004a5a487e Binary files /dev/null and b/public/images/sites/templates/nxt-lnk-dark.png differ diff --git a/public/images/sites/templates/nxt-lnk-light.png b/public/images/sites/templates/nxt-lnk-light.png new file mode 100644 index 0000000000..43a93ed3f7 Binary files /dev/null and b/public/images/sites/templates/nxt-lnk-light.png differ diff --git a/public/images/sites/templates/onelink-dark.png b/public/images/sites/templates/onelink-dark.png new file mode 100644 index 0000000000..691214e861 Binary files /dev/null and b/public/images/sites/templates/onelink-dark.png differ diff --git a/public/images/sites/templates/onelink-light.png b/public/images/sites/templates/onelink-light.png new file mode 100644 index 0000000000..63f4a506f5 Binary files /dev/null and b/public/images/sites/templates/onelink-light.png differ diff --git a/public/images/sites/templates/sveltekit-starter-dark.png b/public/images/sites/templates/sveltekit-starter-dark.png deleted file mode 100644 index 90ac7f96aa..0000000000 Binary files a/public/images/sites/templates/sveltekit-starter-dark.png and /dev/null differ diff --git a/public/images/sites/templates/sveltekit-starter-light.png b/public/images/sites/templates/sveltekit-starter-light.png deleted file mode 100644 index 90ac7f96aa..0000000000 Binary files a/public/images/sites/templates/sveltekit-starter-light.png and /dev/null differ diff --git a/public/images/sites/templates/template-for-onelink-dark.png b/public/images/sites/templates/template-for-onelink-dark.png deleted file mode 100644 index 4680399672..0000000000 Binary files a/public/images/sites/templates/template-for-onelink-dark.png and /dev/null differ diff --git a/public/images/sites/templates/template-for-onelink-light.png b/public/images/sites/templates/template-for-onelink-light.png deleted file mode 100644 index 7a040b5d8d..0000000000 Binary files a/public/images/sites/templates/template-for-onelink-light.png and /dev/null differ diff --git a/public/images/sites/templates/vitepress-dark.png b/public/images/sites/templates/vitepress-dark.png new file mode 100644 index 0000000000..0c68d27461 Binary files /dev/null and b/public/images/sites/templates/vitepress-dark.png differ diff --git a/public/images/sites/templates/vitepress-light.png b/public/images/sites/templates/vitepress-light.png new file mode 100644 index 0000000000..0f93de1c10 Binary files /dev/null and b/public/images/sites/templates/vitepress-light.png differ diff --git a/public/images/sites/templates/vuepress-dark.png b/public/images/sites/templates/vuepress-dark.png new file mode 100644 index 0000000000..52896878be Binary files /dev/null and b/public/images/sites/templates/vuepress-dark.png differ diff --git a/public/images/sites/templates/vuepress-light.png b/public/images/sites/templates/vuepress-light.png new file mode 100644 index 0000000000..52896878be Binary files /dev/null and b/public/images/sites/templates/vuepress-light.png differ diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index 6d44be239d..542b29bcd5 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -171,6 +171,8 @@ class Base extends Action 'resourceType' => 'sites', 'buildCommands' => implode(' && ', $commands), 'buildOutput' => $site->getAttribute('outputDirectory', ''), + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), 'type' => 'vcs', 'installationId' => $installation->getId(), 'installationInternalId' => $installation->getInternalId(), diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index 28f2c3cd1f..cf31d3d7d2 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -76,7 +76,7 @@ class Create extends Base ->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true) ->param('timeout', 15, new Range(1, (int) System::getEnv('_APP_COMPUTE_TIMEOUT', 900)), 'Function maximum execution time in seconds.', true) ->param('enabled', true, new Boolean(), 'Is function enabled? When set to \'disabled\', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.', true) - ->param('logging', true, new Boolean(), 'Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.', true) + ->param('logging', true, new Boolean(), 'When disabled, executions will exclude logs and errors, and will be slightly faster.', true) ->param('entrypoint', '', new Text(1028, 0), 'Entrypoint File. This path is relative to the "providerRootDirectory".', true) ->param('commands', '', new Text(8192, 0), 'Build Commands.', true) ->param('scopes', [], new ArrayList(new WhiteList(array_keys(Config::getParam('scopes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of scopes allowed for API key auto-generated for every execution. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' scopes are allowed.', true) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index d1714685d8..3c876ed91e 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -80,7 +80,7 @@ class Update extends Base ->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true) ->param('timeout', 15, new Range(1, (int) System::getEnv('_APP_COMPUTE_TIMEOUT', 900)), 'Maximum execution time in seconds.', true) ->param('enabled', true, new Boolean(), 'Is function enabled? When set to \'disabled\', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.', true) - ->param('logging', true, new Boolean(), 'Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.', true) + ->param('logging', true, new Boolean(), 'When disabled, executions will exclude logs and errors, and will be slightly faster.', true) ->param('entrypoint', '', new Text(1028, 0), 'Entrypoint File. This path is relative to the "providerRootDirectory".', true) ->param('commands', '', new Text(8192, 0), 'Build Commands.', true) ->param('scopes', [], new ArrayList(new WhiteList(array_keys(Config::getParam('scopes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of scopes allowed for API Key auto-generated for every execution. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' scopes are allowed.', true) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 9ea5638ac3..3f28e7a7ce 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -768,6 +768,10 @@ class Builds extends Action $resource->setAttribute('adapter', $detection->getName()); $resource->setAttribute('fallbackFile', $detection->getFallbackFile() ?? ''); $resource = $dbForProject->updateDocument('sites', $resource->getId(), $resource); + + $deployment->setAttribute('adapter', $detection->getName()); + $deployment->setAttribute('fallbackFile', $detection->getFallbackFile() ?? ''); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); } elseif ($adapter === 'ssr' && $detection->getName() === 'static') { throw new \Exception('Adapter mismatch. Detected: ' . $detection->getName() . ' does not match with the set adapter: ' . $adapter); } diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index ab2d9282ac..0b45c42e4b 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -241,13 +241,15 @@ class Create extends Action 'resourceType' => 'sites', 'buildCommands' => \implode(' && ', $commands), 'buildOutput' => $outputDirectory, + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), 'sourcePath' => $path, 'sourceSize' => $fileSize, 'totalSize' => $fileSize, 'search' => implode(' ', [$deploymentId]), 'activate' => $activate, 'sourceMetadata' => $metadata, - 'type' => $type + 'type' => $type, ])); $site = $site @@ -306,6 +308,8 @@ class Create extends Action 'resourceType' => 'sites', 'buildCommands' => \implode(' && ', $commands), 'buildOutput' => $outputDirectory, + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), 'sourcePath' => $path, 'sourceSize' => $fileSize, 'totalSize' => $fileSize, @@ -314,7 +318,7 @@ class Create extends Action 'search' => implode(' ', [$deploymentId]), 'activate' => $activate, 'sourceMetadata' => $metadata, - 'type' => $type + 'type' => $type, ])); $site = $site diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php index 9e33a6b839..1b3b08b7e3 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -114,6 +114,8 @@ class Create extends Action 'totalSize' => $deployment->getAttribute('sourceSize', 0), 'buildCommands' => \implode(' && ', $commands), 'buildOutput' => $site->getAttribute('outputDirectory', ''), + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), 'search' => implode(' ', [$deploymentId]), 'screenshotLight' => '', 'screenshotDark' => '', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php index c3a4b3ca96..a27ce4b2ba 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php @@ -156,6 +156,8 @@ class Create extends Base 'resourceType' => 'sites', 'buildCommands' => \implode(' && ', $commands), 'buildOutput' => $site->getAttribute('outputDirectory', ''), + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), 'type' => 'manual', 'search' => implode(' ', [$deploymentId]), 'activate' => $activate, diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php index ada665267a..1a39edea46 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php @@ -64,7 +64,8 @@ class Create extends Base ->param('siteId', '', new CustomId(), 'Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', '', new Text(128), 'Site name. Max length: 128 chars.') ->param('framework', '', new WhiteList(\array_keys(Config::getParam('frameworks')), true), 'Sites framework.') - ->param('enabled', true, new Boolean(), 'Is site enabled? When set to \'disabled\', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.', true) // TODO: Add logging param later + ->param('enabled', true, new Boolean(), 'Is site enabled? When set to \'disabled\', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.', true) + ->param('logging', true, new Boolean(), 'When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.', true) ->param('timeout', 15, new Range(1, (int) System::getEnv('_APP_COMPUTE_TIMEOUT', 900)), 'Maximum request time in seconds.', true) ->param('installCommand', '', new Text(8192, 0), 'Install Command.', true) ->param('buildCommand', '', new Text(8192, 0), 'Build Command.', true) @@ -96,6 +97,7 @@ class Create extends Base string $name, string $framework, bool $enabled, + bool $logging, int $timeout, string $installCommand, string $buildCommand, @@ -140,6 +142,7 @@ class Create extends Base '$id' => $siteId, 'enabled' => $enabled, 'live' => true, + 'logging' => $logging, 'name' => $name, 'framework' => $framework, 'deploymentInternalId' => '', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index b971c4c4f3..416062862a 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -68,7 +68,8 @@ class Update extends Base ->param('siteId', '', new UID(), 'Site ID.') ->param('name', '', new Text(128), 'Site name. Max length: 128 chars.') ->param('framework', '', new WhiteList(\array_keys(Config::getParam('frameworks')), true), 'Sites framework.') - ->param('enabled', true, new Boolean(), 'Is site enabled? When set to \'disabled\', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.', true) // TODO: Add logging param later + ->param('enabled', true, new Boolean(), 'Is site enabled? When set to \'disabled\', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.', true) + ->param('logging', true, new Boolean(), 'When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.', true) ->param('timeout', 15, new Range(1, (int) System::getEnv('_APP_COMPUTE_TIMEOUT', 900)), 'Maximum request time in seconds.', true) ->param('installCommand', '', new Text(8192, 0), 'Install Command.', true) ->param('buildCommand', '', new Text(8192, 0), 'Build Command.', true) @@ -103,6 +104,7 @@ class Update extends Base string $name, string $framework, bool $enabled, + bool $logging, int $timeout, string $installCommand, string $buildCommand, @@ -246,6 +248,7 @@ class Update extends Base 'name' => $name, 'framework' => $framework, 'enabled' => $enabled, + 'logging' => $logging, 'live' => $live, 'timeout' => $timeout, 'installCommand' => $installCommand, diff --git a/src/Appwrite/Platform/Tasks/Screenshot.php b/src/Appwrite/Platform/Tasks/Screenshot.php index 29a3d7647e..918ce60e11 100644 --- a/src/Appwrite/Platform/Tasks/Screenshot.php +++ b/src/Appwrite/Platform/Tasks/Screenshot.php @@ -37,8 +37,6 @@ class Screenshot extends Action throw new \Exception("Template {$templateId} not found. Find correct ID in app/config/templates/site.php"); } - Console::warning('Make sure to override $config[\'sleep\'] in Builds.php worker to high number, like 10000 (10 seconds)'); - Console::info("Found: " . $template['name']); $client = new Client(); diff --git a/src/Appwrite/Utopia/Response/Model/Func.php b/src/Appwrite/Utopia/Response/Model/Func.php index e0929684fb..e33d7663fd 100644 --- a/src/Appwrite/Utopia/Response/Model/Func.php +++ b/src/Appwrite/Utopia/Response/Model/Func.php @@ -55,7 +55,7 @@ class Func extends Model ]) ->addRule('logging', [ 'type' => self::TYPE_BOOLEAN, - 'description' => 'Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.', + 'description' => 'When disabled, executions will exclude logs and errors, and will be slightly faster.', 'default' => true, 'example' => false, ]) diff --git a/src/Appwrite/Utopia/Response/Model/Site.php b/src/Appwrite/Utopia/Response/Model/Site.php index 478b7881b3..e6e205909b 100644 --- a/src/Appwrite/Utopia/Response/Model/Site.php +++ b/src/Appwrite/Utopia/Response/Model/Site.php @@ -46,6 +46,12 @@ class Site extends Model 'default' => true, 'example' => false, ]) + ->addRule('logging', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.', + 'default' => true, + 'example' => false, + ]) ->addRule('framework', [ 'type' => self::TYPE_STRING, 'description' => 'Site framework.', diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 40d9ea5dba..c9a94987c9 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -1590,7 +1590,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test PHP Scopes executions', - 'commands' => 'sh setup.sh && composer install', + 'commands' => 'bash setup.sh && composer install', 'runtime' => 'php-8.0', 'entrypoint' => 'index.php', 'scopes' => ['users.read'], diff --git a/tests/e2e/Services/Sites/SitesCustomClientTest.php b/tests/e2e/Services/Sites/SitesCustomClientTest.php index 76d8a666d4..256c753d74 100644 --- a/tests/e2e/Services/Sites/SitesCustomClientTest.php +++ b/tests/e2e/Services/Sites/SitesCustomClientTest.php @@ -60,10 +60,10 @@ class SitesCustomClientTest extends Scope 'frameworks' => ['nuxt'] ]); $this->assertEquals(200, $templates['headers']['status-code']); - $this->assertGreaterThanOrEqual(3, $templates['body']['total']); + $this->assertGreaterThan(0, $templates['body']['total']); $this->assertIsArray($templates['body']['templates']); foreach ($templates['body']['templates'] as $template) { - $this->assertContains($template['useCases'][0], ['starter', 'ai']); + $this->assertContains($template['useCases'][0], ['starter']); } $this->assertArrayHasKey('frameworks', $templates['body']['templates'][0]); $this->assertContains('Nuxt', array_column($templates['body']['templates'][0]['frameworks'], 'name')); @@ -74,13 +74,13 @@ class SitesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ 'limit' => 5, - 'offset' => 1, + 'offset' => 0, 'useCases' => ['starter'], 'frameworks' => ['nextjs'] ]); $this->assertEquals(200, $templates['headers']['status-code']); - $this->assertEquals(3, $templates['body']['total']); + $this->assertGreaterThan(0, $templates['body']['total']); $this->assertIsArray($templates['body']['templates']); $this->assertArrayHasKey('frameworks', $templates['body']['templates'][0]); diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index cc2e1f9bbb..99a1c47f42 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -539,6 +539,88 @@ class SitesCustomServerTest extends Scope $this->cleanupSite($siteId); } + public function testSettingsForRollback(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Static site', + 'framework' => 'astro', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + ]); + $this->assertNotEmpty($siteId); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEmpty($site['body']['adapter']); + $this->assertEmpty($site['body']['fallbackFile']); + + $domain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($domain); + + $deploymentId1 = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('astro-static'), + 'activate' => 'true' + ]); + $this->assertNotEmpty($deploymentId1); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEquals('static', $site['body']['adapter']); + $this->assertEquals('index.html', $site['body']['fallbackFile']); + + $site = $this->updateSite([ + 'name' => 'SSR site', + 'framework' => 'astro', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'adapter' => 'ssr', + 'fallbackFile' => '', + '$id' => $siteId, + ]); + + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEquals('ssr', $site['body']['adapter']); + $this->assertEmpty($site['body']['fallbackFile']); + + $deploymentId2 = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('astro'), + 'activate' => 'true' + ]); + $this->assertNotEmpty($deploymentId2); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEquals('ssr', $site['body']['adapter']); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Astro SSR", $response['body']); + $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); + $this->assertEquals(404, $response['headers']['status-code']); + + $response = $this->updateSiteDeployment($siteId, $deploymentId1); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$id']); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Astro static", $response['body']); + $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Astro static", $response['body']); + + $this->cleanupSite($siteId); + } + public function testListSites(): void { /** @@ -758,77 +840,6 @@ class SitesCustomServerTest extends Scope // // TODO: Implement testCreateDeploymentFromCLI() later // } - public function testCreateSiteAndDeploymentFromTemplate() - { - $starterTemplate = $this->getTemplate('nextjs-starter'); - $this->assertEquals(200, $starterTemplate['headers']['status-code']); - - $nextjsFramework = array_values(array_filter($starterTemplate['body']['frameworks'], function ($framework) { - return $framework['key'] === 'nextjs'; - }))[0]; - - // If this fails, the template has variables, and this test needs to be updated - $this->assertEmpty($starterTemplate['body']['variables']); - - $site = $this->createSite( - [ - 'siteId' => ID::unique(), - 'name' => $starterTemplate['body']['name'], - 'framework' => $nextjsFramework['key'], - 'adapter' => $nextjsFramework['adapter'], - 'buildCommand' => $nextjsFramework['buildCommand'], - 'buildRuntime' => $nextjsFramework['buildRuntime'], - 'fallbackFile' => $nextjsFramework['fallbackFile'], - 'installCommand' => $nextjsFramework['installCommand'], - 'outputDirectory' => $nextjsFramework['outputDirectory'], - 'providerRootDirectory' => $nextjsFramework['providerRootDirectory'], - ] - ); - - $this->assertEquals(201, $site['headers']['status-code']); - $this->assertNotEmpty($site['body']['$id']); - - $siteId = $site['body']['$id'] ?? ''; - - $deployment = $this->createTemplateDeployment( - $siteId, - [ - 'owner' => $starterTemplate['body']['providerOwner'], - 'repository' => $starterTemplate['body']['providerRepositoryId'], - 'rootDirectory' => $nextjsFramework['providerRootDirectory'], - 'version' => $starterTemplate['body']['providerVersion'], - 'activate' => true, - ] - ); - - $this->assertEquals(202, $deployment['headers']['status-code']); - $this->assertNotEmpty($deployment['body']['$id']); - - $deployments = $this->listDeployments($siteId); - - $this->assertEquals(200, $deployments['headers']['status-code']); - $this->assertEquals(1, $deployments['body']['total']); - - $lastDeployment = $deployments['body']['deployments'][0]; - - $this->assertNotEmpty($lastDeployment['$id']); - $this->assertEquals(0, $lastDeployment['sourceSize']); - - $deploymentId = $lastDeployment['$id']; - - $this->assertEventually(function () use ($siteId, $deploymentId) { - $deployment = $this->getDeployment($siteId, $deploymentId); - - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertEquals('ready', $deployment['body']['status']); - }, 300000, 1000); - - $site = $this->getSite($siteId); - $this->assertEquals(200, $site['headers']['status-code']); - - $this->cleanupSite($siteId); - } - public function testCreateDeployment() { $siteId = $this->setupSite([ @@ -1976,6 +1987,57 @@ class SitesCustomServerTest extends Scope $this->assertNotEquals($log1Id, $log2Id); + $site = $this->updateSite( + [ + '$id' => $siteId, + 'name' => 'SSR site', + 'framework' => 'astro', + 'adapter' => 'ssr', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'fallbackFile' => '', + 'logging' => false // set logging to false + ] + ); + $this->assertEquals(200, $site['headers']['status-code']); + $response = $proxyClient->call(Client::METHOD_GET, '/logs-inline'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Inline logs printed.", $response['body']); + + $logs = $this->listLogs($siteId, [ + Query::orderDesc('$createdAt')->toString(), + Query::limit(1)->toString(), + ]); + $this->assertEquals(200, $logs['headers']['status-code']); + $this->assertEquals("GET", $logs['body']['executions'][0]['requestMethod']); + $this->assertEquals("/logs-inline", $logs['body']['executions'][0]['requestPath']); + $this->assertEmpty($logs['body']['executions'][0]['logs']); + $this->assertEmpty($logs['body']['executions'][0]['logs']); + $this->assertEmpty($logs['body']['executions'][0]['errors']); + $this->assertEmpty($logs['body']['executions'][0]['errors']); + $log1Id = $logs['body']['executions'][0]['$id']; + $this->assertNotEmpty($log1Id); + + $response = $proxyClient->call(Client::METHOD_GET, '/logs-action'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Action logs printed.", $response['body']); + + $logs = $this->listLogs($siteId, [ + Query::orderDesc('$createdAt')->toString(), + Query::limit(1)->toString(), + ]); + $this->assertEquals(200, $logs['headers']['status-code']); + $this->assertEquals("GET", $logs['body']['executions'][0]['requestMethod']); + $this->assertEquals("/logs-action", $logs['body']['executions'][0]['requestPath']); + $this->assertEmpty($logs['body']['executions'][0]['logs']); + $this->assertEmpty($logs['body']['executions'][0]['logs']); + $this->assertEmpty($logs['body']['executions'][0]['errors']); + $this->assertEmpty($logs['body']['executions'][0]['errors']); + $log2Id = $logs['body']['executions'][0]['$id']; + $this->assertNotEmpty($log2Id); + $this->cleanupSite($siteId); }