From 4113644fba35c828061a7a9e4bca5bf0fafc3e02 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Wed, 26 Jan 2022 10:23:30 +0000 Subject: [PATCH] Implement network environment variable for the executor. --- .env | 1 + Dockerfile | 1 + app/config/variables.php | 9 +++++++++ app/executor.php | 2 +- app/views/install/compose.phtml | 1 + docker-compose.yml | 1 + 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 3f8e511b6e..de41db626b 100644 --- a/.env +++ b/.env @@ -40,6 +40,7 @@ _APP_FUNCTIONS_CPUS=4 _APP_FUNCTIONS_MEMORY=2000 _APP_FUNCTIONS_MEMORY_SWAP=2000 _APP_EXECUTOR_SECRET=a-randomly-generated-key +_APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes _APP_MAINTENANCE_INTERVAL=86400 _APP_MAINTENANCE_RETENTION_EXECUTION=1209600 _APP_MAINTENANCE_RETENTION_ABUSE=86400 diff --git a/Dockerfile b/Dockerfile index 37f391fe23..19b9e6926c 100755 --- a/Dockerfile +++ b/Dockerfile @@ -174,6 +174,7 @@ ENV _APP_SERVER=swoole \ _APP_FUNCTIONS_MEMORY=128 \ _APP_FUNCTIONS_MEMORY_SWAP=128 \ _APP_EXECUTOR_SECRET=a-random-secret \ + _APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes \ _APP_SETUP=self-hosted \ _APP_VERSION=$VERSION \ _APP_USAGE_STATS=enabled \ diff --git a/app/config/variables.php b/app/config/variables.php index 76dbf1cd5f..93f1243978 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -498,6 +498,15 @@ return [ 'question' => '', 'filter' => '' ], + [ + 'name' => '_APP_EXECUTOR_RUNTIME_NETWORK', + 'description' => 'The docker network used for communication between the executor and runtimes. Change this if you have altered the default network names.', + 'introduction' => '0.13.0', + 'default' => 'appwrite_runtimes', + 'required' => false, + 'question' => '', + 'filter' => '' + ], [ 'name' => '_APP_FUNCTIONS_ENVS', 'description' => 'Deprecated with 0.8.0, use \'_APP_FUNCTIONS_RUNTIMES\' instead!', diff --git a/app/executor.php b/app/executor.php index 59c5de8f0d..74495e7d1b 100644 --- a/app/executor.php +++ b/app/executor.php @@ -301,7 +301,7 @@ function createRuntimeServer(string $functionId, string $projectId, string $depl } // Add to network - $orchestration->networkConnect($container, 'appwrite_runtimes'); + $orchestration->networkConnect($container, App::getEnv('_APP_EXECUTOR_RUNTIME_NETWORK', 'appwrite_runtimes')); $executionEnd = \microtime(true); diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index a4e8aeb0c0..f799a73e96 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -191,6 +191,7 @@ services: - _APP_FUNCTIONS_MEMORY - _APP_FUNCTIONS_MEMORY_SWAP - _APP_EXECUTOR_SECRET + - _APP_EXECUTOR_RUNTIME_NETWORK - _APP_USAGE_STATS - _APP_STATSD_HOST - _APP_STATSD_PORT diff --git a/docker-compose.yml b/docker-compose.yml index 4f7afc3d61..220ca8d146 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -391,6 +391,7 @@ services: - _APP_FUNCTIONS_MEMORY - _APP_FUNCTIONS_MEMORY_SWAP - _APP_EXECUTOR_SECRET + - _APP_EXECUTOR_RUNTIME_NETWORK - _APP_USAGE_STATS - _APP_STATSD_HOST - _APP_STATSD_PORT