Merge branch '0.7.x' of github.com:appwrite/appwrite into 0.7.x
This commit is contained in:
commit
febc81ce3d
8 changed files with 36 additions and 32 deletions
|
@ -165,7 +165,7 @@ return [
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => '_APP_DB_USER',
|
'name' => '_APP_DB_USER',
|
||||||
'description' => 'MariaDB server user name. Default value is: \'root\'.',
|
'description' => 'MariaDB server user name. Default value is: \'user\'.',
|
||||||
'introduction' => '',
|
'introduction' => '',
|
||||||
'default' => 'user',
|
'default' => 'user',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
@ -341,7 +341,7 @@ return [
|
||||||
'name' => '_APP_FUNCTIONS_MEMORY',
|
'name' => '_APP_FUNCTIONS_MEMORY',
|
||||||
'description' => 'The maximum amount of memory a single cloud function is allowed to use in megabytes. The default value is 128.',
|
'description' => 'The maximum amount of memory a single cloud function is allowed to use in megabytes. The default value is 128.',
|
||||||
'introduction' => '0.7.0',
|
'introduction' => '0.7.0',
|
||||||
'default' => '128',
|
'default' => '256',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'question' => '',
|
'question' => '',
|
||||||
],
|
],
|
||||||
|
|
|
@ -429,19 +429,19 @@ App::post('/v1/functions/:functionId/tags')
|
||||||
->label('sdk.namespace', 'functions')
|
->label('sdk.namespace', 'functions')
|
||||||
->label('sdk.method', 'createTag')
|
->label('sdk.method', 'createTag')
|
||||||
->label('sdk.description', '/docs/references/functions/create-tag.md')
|
->label('sdk.description', '/docs/references/functions/create-tag.md')
|
||||||
|
->label('sdk.packaging', true)
|
||||||
->label('sdk.request.type', 'multipart/form-data')
|
->label('sdk.request.type', 'multipart/form-data')
|
||||||
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
|
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
|
||||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||||
->label('sdk.response.model', Response::MODEL_TAG)
|
->label('sdk.response.model', Response::MODEL_TAG)
|
||||||
->param('functionId', '', new UID(), 'Function unique ID.')
|
->param('functionId', '', new UID(), 'Function unique ID.')
|
||||||
->param('command', '', new Text('1028'), 'Code execution command.')
|
->param('command', '', new Text('1028'), 'Code execution command.')
|
||||||
->param('code', [], new File(), 'Gzip file containing your code.', false)
|
->param('file', null, new File(), 'Gzip file with your code package.', false)
|
||||||
// ->param('code', '', new Text(128), 'Code package. Use the '.APP_NAME.' code packager to create a deployable package file.')
|
|
||||||
->inject('request')
|
->inject('request')
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('projectDB')
|
->inject('projectDB')
|
||||||
->inject('usage')
|
->inject('usage')
|
||||||
->action(function ($functionId, $command, $code, $request, $response, $projectDB, $usage) {
|
->action(function ($functionId, $command, $file, $request, $response, $projectDB, $usage) {
|
||||||
/** @var Utopia\Swoole\Request $request */
|
/** @var Utopia\Swoole\Request $request */
|
||||||
/** @var Appwrite\Utopia\Response $response */
|
/** @var Appwrite\Utopia\Response $response */
|
||||||
/** @var Appwrite\Database\Database $projectDB */
|
/** @var Appwrite\Database\Database $projectDB */
|
||||||
|
@ -453,7 +453,7 @@ App::post('/v1/functions/:functionId/tags')
|
||||||
throw new Exception('Function not found', 404);
|
throw new Exception('Function not found', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = $request->getFiles('code');
|
$file = $request->getFiles('file');
|
||||||
$device = Storage::getDevice('functions');
|
$device = Storage::getDevice('functions');
|
||||||
$fileExt = new FileExt([FileExt::TYPE_GZIP]);
|
$fileExt = new FileExt([FileExt::TYPE_GZIP]);
|
||||||
$fileSize = new FileSize(App::getEnv('_APP_STORAGE_LIMIT', 0));
|
$fileSize = new FileSize(App::getEnv('_APP_STORAGE_LIMIT', 0));
|
||||||
|
|
|
@ -6,14 +6,12 @@ use Appwrite\Docker\Compose;
|
||||||
use Appwrite\Docker\Env;
|
use Appwrite\Docker\Env;
|
||||||
use Utopia\CLI\Console;
|
use Utopia\CLI\Console;
|
||||||
use Utopia\Config\Config;
|
use Utopia\Config\Config;
|
||||||
use Utopia\Validator\Mock;
|
|
||||||
use Utopia\View;
|
use Utopia\View;
|
||||||
|
|
||||||
$cli
|
$cli
|
||||||
->task('install')
|
->task('install')
|
||||||
->desc('Install Appwrite')
|
->desc('Install Appwrite')
|
||||||
->param('version', APP_VERSION_STABLE, new Mock(), 'Appwrite version', true)
|
->action(function () {
|
||||||
->action(function ($version) {
|
|
||||||
/**
|
/**
|
||||||
* 1. Start - DONE
|
* 1. Start - DONE
|
||||||
* 2. Check for older setup and get older version - DONE
|
* 2. Check for older setup and get older version - DONE
|
||||||
|
@ -130,7 +128,7 @@ $cli
|
||||||
$templateForCompose
|
$templateForCompose
|
||||||
->setParam('httpPort', $httpPort)
|
->setParam('httpPort', $httpPort)
|
||||||
->setParam('httpsPort', $httpsPort)
|
->setParam('httpsPort', $httpsPort)
|
||||||
->setParam('version', $version)
|
->setParam('version', APP_VERSION_STABLE)
|
||||||
;
|
;
|
||||||
|
|
||||||
$templateForEnv
|
$templateForEnv
|
||||||
|
@ -147,12 +145,19 @@ $cli
|
||||||
Console::exit(1);
|
Console::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$env = '';
|
||||||
$stdout = '';
|
$stdout = '';
|
||||||
$stderr = '';
|
$stderr = '';
|
||||||
|
|
||||||
|
foreach ($input as $key => $value) {
|
||||||
|
if($value) {
|
||||||
|
$env .= $key.'='.$value.' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Console::log("Running \"docker-compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes\"");
|
Console::log("Running \"docker-compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes\"");
|
||||||
|
|
||||||
$exit = Console::execute("docker-compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes", '', $stdout, $stderr);
|
$exit = Console::execute("${env} docker-compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes", '', $stdout, $stderr);
|
||||||
|
|
||||||
if ($exit !== 0) {
|
if ($exit !== 0) {
|
||||||
Console::error("Failed to install Appwrite dockers");
|
Console::error("Failed to install Appwrite dockers");
|
||||||
|
|
|
@ -266,10 +266,9 @@ services:
|
||||||
- _APP_SMTP_PASSWORD
|
- _APP_SMTP_PASSWORD
|
||||||
|
|
||||||
appwrite-maintenance:
|
appwrite-maintenance:
|
||||||
|
image: appwrite/appwrite:<?php echo $version."\n"; ?>
|
||||||
entrypoint: maintenance
|
entrypoint: maintenance
|
||||||
container_name: appwrite-maintenance
|
container_name: appwrite-maintenance
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- appwrite
|
- appwrite
|
||||||
|
@ -307,8 +306,6 @@ services:
|
||||||
- appwrite
|
- appwrite
|
||||||
volumes:
|
volumes:
|
||||||
- appwrite-mariadb:/var/lib/mysql:rw
|
- appwrite-mariadb:/var/lib/mysql:rw
|
||||||
ports:
|
|
||||||
- "3306:3306"
|
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD=rootsecretpassword
|
- MYSQL_ROOT_PASSWORD=rootsecretpassword
|
||||||
- MYSQL_DATABASE=${_APP_DB_SCHEMA}
|
- MYSQL_DATABASE=${_APP_DB_SCHEMA}
|
||||||
|
|
|
@ -118,6 +118,7 @@ class OpenAPI3 extends Format
|
||||||
'rate-key' => $route->getLabel('abuse-key', 'url:{url},ip:{ip}'),
|
'rate-key' => $route->getLabel('abuse-key', 'url:{url},ip:{ip}'),
|
||||||
'scope' => $route->getLabel('scope', ''),
|
'scope' => $route->getLabel('scope', ''),
|
||||||
'platforms' => $route->getLabel('sdk.platform', []),
|
'platforms' => $route->getLabel('sdk.platform', []),
|
||||||
|
'packaging' => $route->getLabel('sdk.packaging', false),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,7 @@ class Swagger2 extends Format
|
||||||
'rate-key' => $route->getLabel('abuse-key', 'url:{url},ip:{ip}'),
|
'rate-key' => $route->getLabel('abuse-key', 'url:{url},ip:{ip}'),
|
||||||
'scope' => $route->getLabel('scope', ''),
|
'scope' => $route->getLabel('scope', ''),
|
||||||
'platforms' => $route->getLabel('sdk.platform', []),
|
'platforms' => $route->getLabel('sdk.platform', []),
|
||||||
|
'packaging' => $route->getLabel('sdk.packaging', false),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ class FunctionsCustomClientTest extends Scope
|
||||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||||
], [
|
], [
|
||||||
'command' => 'php function.php',
|
'command' => 'php function.php',
|
||||||
'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
|
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tagId = $tag['body']['$id'] ?? '';
|
$tagId = $tag['body']['$id'] ?? '';
|
||||||
|
|
|
@ -184,7 +184,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'x-appwrite-project' => $this->getProject()['$id'],
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
], $this->getHeaders()), [
|
], $this->getHeaders()), [
|
||||||
'command' => 'php function.php',
|
'command' => 'php function.php',
|
||||||
'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
|
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tagId = $tag['body']['$id'] ?? '';
|
$tagId = $tag['body']['$id'] ?? '';
|
||||||
|
@ -467,7 +467,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => 'PHP',
|
'language' => 'PHP',
|
||||||
'version' => '7.4',
|
'version' => '7.4',
|
||||||
'name' => 'php-7.4',
|
'name' => 'php-7.4',
|
||||||
'code' => $functions.'/php.tar.gz',
|
'file' => $functions.'/php.tar.gz',
|
||||||
'command' => 'php index.php',
|
'command' => 'php index.php',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -475,7 +475,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => 'PHP',
|
'language' => 'PHP',
|
||||||
'version' => '8.0',
|
'version' => '8.0',
|
||||||
'name' => 'php-8.0',
|
'name' => 'php-8.0',
|
||||||
'code' => $functions.'/php.tar.gz',
|
'file' => $functions.'/php.tar.gz',
|
||||||
'command' => 'php index.php',
|
'command' => 'php index.php',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -483,7 +483,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => 'Python',
|
'language' => 'Python',
|
||||||
'version' => '3.8',
|
'version' => '3.8',
|
||||||
'name' => 'python-3.8',
|
'name' => 'python-3.8',
|
||||||
'code' => $functions.'/python.tar.gz',
|
'file' => $functions.'/python.tar.gz',
|
||||||
'command' => 'python main.py',
|
'command' => 'python main.py',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -491,7 +491,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => 'Node.js',
|
'language' => 'Node.js',
|
||||||
'version' => '14.5',
|
'version' => '14.5',
|
||||||
'name' => 'node-14.5',
|
'name' => 'node-14.5',
|
||||||
'code' => $functions.'/node.tar.gz',
|
'file' => $functions.'/node.tar.gz',
|
||||||
'command' => 'node index.js',
|
'command' => 'node index.js',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -499,7 +499,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => 'Node.js',
|
'language' => 'Node.js',
|
||||||
'version' => '15.5',
|
'version' => '15.5',
|
||||||
'name' => 'node-15.5',
|
'name' => 'node-15.5',
|
||||||
'code' => $functions.'/node.tar.gz',
|
'file' => $functions.'/node.tar.gz',
|
||||||
'command' => 'node index.js',
|
'command' => 'node index.js',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -507,7 +507,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => 'Ruby',
|
'language' => 'Ruby',
|
||||||
'version' => '2.7',
|
'version' => '2.7',
|
||||||
'name' => 'ruby-2.7',
|
'name' => 'ruby-2.7',
|
||||||
'code' => $functions.'/ruby.tar.gz',
|
'file' => $functions.'/ruby.tar.gz',
|
||||||
'command' => 'ruby app.rb',
|
'command' => 'ruby app.rb',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -515,7 +515,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => 'Ruby',
|
'language' => 'Ruby',
|
||||||
'version' => '3.0',
|
'version' => '3.0',
|
||||||
'name' => 'ruby-3.0',
|
'name' => 'ruby-3.0',
|
||||||
'code' => $functions.'/ruby.tar.gz',
|
'file' => $functions.'/ruby.tar.gz',
|
||||||
'command' => 'ruby app.rb',
|
'command' => 'ruby app.rb',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -523,7 +523,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => 'Deno',
|
'language' => 'Deno',
|
||||||
'version' => '1.5',
|
'version' => '1.5',
|
||||||
'name' => 'deno-1.5',
|
'name' => 'deno-1.5',
|
||||||
'code' => $functions.'/deno.tar.gz',
|
'file' => $functions.'/deno.tar.gz',
|
||||||
'command' => 'deno run --allow-env index.ts',
|
'command' => 'deno run --allow-env index.ts',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -531,7 +531,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => 'Deno',
|
'language' => 'Deno',
|
||||||
'version' => '1.6',
|
'version' => '1.6',
|
||||||
'name' => 'deno-1.6',
|
'name' => 'deno-1.6',
|
||||||
'code' => $functions.'/deno.tar.gz',
|
'file' => $functions.'/deno.tar.gz',
|
||||||
'command' => 'deno run --allow-env index.ts',
|
'command' => 'deno run --allow-env index.ts',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -539,7 +539,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => 'Dart',
|
'language' => 'Dart',
|
||||||
'version' => '2.10',
|
'version' => '2.10',
|
||||||
'name' => 'dart-2.10',
|
'name' => 'dart-2.10',
|
||||||
'code' => $functions.'/dart.tar.gz',
|
'file' => $functions.'/dart.tar.gz',
|
||||||
'command' => 'dart main.dart',
|
'command' => 'dart main.dart',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -547,7 +547,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => '.NET',
|
'language' => '.NET',
|
||||||
'version' => '3.1',
|
'version' => '3.1',
|
||||||
'name' => 'dotnet-3.1',
|
'name' => 'dotnet-3.1',
|
||||||
'code' => $functions.'/dotnet-3.1.tar.gz',
|
'file' => $functions.'/dotnet-3.1.tar.gz',
|
||||||
'command' => 'dotnet dotnet.dll',
|
'command' => 'dotnet dotnet.dll',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -555,7 +555,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'language' => '.NET',
|
'language' => '.NET',
|
||||||
'version' => '5.0',
|
'version' => '5.0',
|
||||||
'name' => 'dotnet-5.0',
|
'name' => 'dotnet-5.0',
|
||||||
'code' => $functions.'/dotnet-5.0.tar.gz',
|
'file' => $functions.'/dotnet-5.0.tar.gz',
|
||||||
'command' => 'dotnet dotnet.dll',
|
'command' => 'dotnet dotnet.dll',
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
],
|
],
|
||||||
|
@ -586,7 +586,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
$language = $env['language'] ?? '';
|
$language = $env['language'] ?? '';
|
||||||
$version = $env['version'] ?? '';
|
$version = $env['version'] ?? '';
|
||||||
$name = $env['name'] ?? '';
|
$name = $env['name'] ?? '';
|
||||||
$code = $env['code'] ?? '';
|
$code = $env['file'] ?? '';
|
||||||
$command = $env['command'] ?? '';
|
$command = $env['command'] ?? '';
|
||||||
$timeout = $env['timeout'] ?? 15;
|
$timeout = $env['timeout'] ?? 15;
|
||||||
|
|
||||||
|
@ -618,7 +618,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'x-appwrite-project' => $this->getProject()['$id'],
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
], $this->getHeaders()), [
|
], $this->getHeaders()), [
|
||||||
'command' => $command,
|
'command' => $command,
|
||||||
'code' => new CURLFile($code, 'application/x-gzip', basename($code)),
|
'file' => new CURLFile($code, 'application/x-gzip', basename($code)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tagId = $tag['body']['$id'] ?? '';
|
$tagId = $tag['body']['$id'] ?? '';
|
||||||
|
@ -716,7 +716,7 @@ class FunctionsCustomServerTest extends Scope
|
||||||
'x-appwrite-project' => $this->getProject()['$id'],
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
], $this->getHeaders()), [
|
], $this->getHeaders()), [
|
||||||
'command' => $command,
|
'command' => $command,
|
||||||
'code' => new CURLFile($code, 'application/x-gzip', basename($code)),
|
'file' => new CURLFile($code, 'application/x-gzip', basename($code)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tagId = $tag['body']['$id'] ?? '';
|
$tagId = $tag['body']['$id'] ?? '';
|
||||||
|
|
Loading…
Reference in a new issue