diff --git a/app/config/environments.php b/app/config/environments.php index 9ae81db5b0..cd312555a5 100644 --- a/app/config/environments.php +++ b/app/config/environments.php @@ -29,6 +29,13 @@ return [ 'image' => 'appwrite/env-python:3.8', 'logo' => 'python.png', ], + 'deno-1.2' => [ + 'name' => 'Deno', + 'version' => '1.2', + 'base' => 'hayd/deno:alpine-1.2.0', + 'image' => 'appwrite/env-deno:1.2', + 'logo' => 'deno.png', + ], // 'dart-2.8' => [ // 'name' => 'Dart', // 'version' => '2.8', diff --git a/app/workers/functions.php b/app/workers/functions.php index 6730068676..b3d57fac58 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -7,6 +7,7 @@ use Appwrite\Database\Database; use Appwrite\Database\Adapter\MySQL as MySQLAdapter; use Appwrite\Database\Adapter\Redis as RedisAdapter; use Appwrite\Database\Validator\Authorization; +use Utopia\App; use Utopia\CLI\Console; use Utopia\Config\Config; @@ -265,6 +266,7 @@ class FunctionsV1 $exitCode = Console::execute("docker run \ -d \ + --entrypoint=\"\" \ --cpus=4 \ --memory=128m \ --memory-swap=128m \ @@ -278,7 +280,7 @@ class FunctionsV1 {$environment['image']} \ sh -c 'mv /tmp/code.tar.gz /usr/local/src/code.tar.gz && tar -zxf /usr/local/src/code.tar.gz --strip 1 && rm /usr/local/src/code.tar.gz && tail -f /dev/null'" , null, $stdout, $stderr, 30); - + $executionEnd = \microtime(true); if($exitCode !== 0) { @@ -297,7 +299,7 @@ class FunctionsV1 $executionStart = \microtime(true); $exitCode = Console::execute("docker exec {$container} {$command}" - , null, $stdout, $stderr, $function->getAttribute('timeout', 900)); // TODO add app env for max timeout + , null, $stdout, $stderr, $function->getAttribute('timeout', (int) App::getEnv('_APP_FUNCTIONS_TIMEOUT', 900))); // TODO add app env for max timeout $executionEnd = \microtime(true); @@ -322,7 +324,7 @@ class FunctionsV1 Console::success(count($list).' running containers counted'); - $max = 10; + $max = (int) App::getEnv('_APP_FUNCTIONS_CONTAINERS'); if(count($list) > $max) { Console::info('Starting containers cleanup'); diff --git a/docker/environments/deno-1.2/Dockerfile b/docker/environments/deno-1.2/Dockerfile new file mode 100644 index 0000000000..b6877da806 --- /dev/null +++ b/docker/environments/deno-1.2/Dockerfile @@ -0,0 +1,11 @@ +FROM hayd/deno:alpine-1.2.0 + +LABEL maintainer="team@appwrite.io" + +RUN apk add tar + +RUN mkdir /usr/local/src + +WORKDIR /usr/local/src/ + +ENV DENO_DIR=/usr/local/src/.appwrite \ No newline at end of file diff --git a/docker/environments/deno-1.2/build.sh b/docker/environments/deno-1.2/build.sh new file mode 100644 index 0000000000..5eaaffb491 --- /dev/null +++ b/docker/environments/deno-1.2/build.sh @@ -0,0 +1,7 @@ +echo 'Starting Deno 1.2 build...' + +docker build --tag appwrite/env-deno:1.2 . + +echo 'Pushing Deno 1.2 build to registry...' + +docker push appwrite/env-deno:1.2 \ No newline at end of file diff --git a/public/images/environments/deno.png b/public/images/environments/deno.png new file mode 100644 index 0000000000..5ff1b53cef Binary files /dev/null and b/public/images/environments/deno.png differ