From a0c841d13fe24b363a0004d39411c3b2a60ffb5e Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Mon, 22 Nov 2021 09:27:08 +0000 Subject: [PATCH] Rollback to Docker CLI --- Dockerfile | 2 +- app/executor.php | 16 +++++++++++----- docker-compose.yml | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index e925cf516f..1cca55fb92 100755 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ ENV DEBUG=$DEBUG ENV PHP_REDIS_VERSION=5.3.4 \ PHP_MONGODB_VERSION=1.9.1 \ - PHP_SWOOLE_VERSION=v4.8.1 \ + PHP_SWOOLE_VERSION=v4.8.2 \ PHP_IMAGICK_VERSION=3.5.1 \ PHP_YAML_VERSION=2.2.1 \ PHP_MAXMINDDB_VERSION=v1.10.1 diff --git a/app/executor.php b/app/executor.php index efe5d9e236..42336e1774 100644 --- a/app/executor.php +++ b/app/executor.php @@ -30,14 +30,14 @@ use Utopia\Storage\Storage; use Swoole\Coroutine as Co; use Utopia\Cache\Cache; use Utopia\Database\Query; -use Utopia\Orchestration\Adapter\DockerAPI; +use Utopia\Orchestration\Adapter\DockerCLI; require_once __DIR__ . '/init.php'; $dockerUser = App::getEnv('DOCKERHUB_PULL_USERNAME', null); $dockerPass = App::getEnv('DOCKERHUB_PULL_PASSWORD', null); $dockerEmail = App::getEnv('DOCKERHUB_PULL_EMAIL', null); -$orchestration = new Orchestration(new DockerAPI($dockerUser, $dockerPass)); +$orchestration = new Orchestration(new DockerCLI($dockerUser, $dockerPass)); $runtimes = Config::getParam('runtimes'); @@ -392,6 +392,10 @@ function runBuildStage(string $tagID, Document $function, string $projectID, Dat ] ); + if (empty($id)) { + throw new Exception('Failed to start build container'); + } + // Extract user code into build container $untarStdout = ''; $untarStderr = ''; @@ -519,8 +523,6 @@ function runBuildStage(string $tagID, Document $function, string $projectID, Dat // also remove the container if it exists if ($id) { $orchestration->remove($id, true); - } else { - $id = '' } } @@ -655,6 +657,10 @@ function createRuntimeServer(string $functionId, string $projectId, Document $ta mountFolder: $tagPathTargetDir, ); + if (empty($id)) { + throw new Exception('Failed to create container'); + } + // Add to network $orchestration->networkConnect($container, 'appwrite_runtimes'); @@ -861,7 +867,7 @@ function execute(string $trigger, string $projectId, string $executionId, string 'Content-Type: application/json', 'Content-Length: ' . \strlen($body), 'x-internal-challenge: ' . $key, - 'host: ' . null + 'host: null' ]); $executorResponse = \curl_exec($ch); diff --git a/docker-compose.yml b/docker-compose.yml index c9a24ebc5d..c26b459437 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,7 +39,7 @@ services: build: context: . args: - - DEBUG=true + - DEBUG=false - TESTING=true - VERSION=dev ports: @@ -352,7 +352,7 @@ services: build: context: . args: - - DEBUG=true + - DEBUG=false - TESTING=true - VERSION=dev networks: