diff --git a/.env b/.env index c205935b79..92b13e20ce 100644 --- a/.env +++ b/.env @@ -54,7 +54,7 @@ _APP_FUNCTIONS_CPUS=0 _APP_FUNCTIONS_MEMORY=0 _APP_FUNCTIONS_MEMORY_SWAP=0 _APP_FUNCTIONS_INACTIVE_THRESHOLD=60 -_APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes +OPEN_RUNTIMES_NETWORK=appwrite_runtimes _APP_EXECUTOR_SECRET=your-secret-key _APP_MAINTENANCE_INTERVAL=86400 _APP_MAINTENANCE_RETENTION_EXECUTION=1209600 diff --git a/app/config/variables.php b/app/config/variables.php index c741cb5486..63321a4a8a 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -599,7 +599,7 @@ return [ ], [ '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.', + 'description' => 'Deprecated with 0.14.0, use \'OPEN_RUNTIMES_NETWORK\' instead!', 'introduction' => '0.13.0', 'default' => 'appwrite_runtimes', 'required' => false, @@ -651,6 +651,15 @@ return [ 'question' => '', 'filter' => '' ], + [ + 'name' => 'OPEN_RUNTIMES_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' => '' + ], ], [ 'category' => 'Maintenance', diff --git a/app/executor.php b/app/executor.php index 566f177471..e9f4c21391 100644 --- a/app/executor.php +++ b/app/executor.php @@ -141,7 +141,6 @@ App::post('/v1/runtimes') ->param('vars', [], new Assoc(), 'Environment Variables required for the build') ->param('commands', [], new ArrayList(new Text(0)), 'Commands required to build the container') ->param('runtime', '', new Text(128), 'Runtime for the cloud function') - ->param('network', '', new Text(128), 'Network to attach the container to') ->param('baseImage', '', new Text(128), 'Base image name of the runtime') ->param('entrypoint', '', new Text(256), 'Entrypoint of the code file', true) ->param('remove', false, new Boolean(), 'Remove a runtime after execution') @@ -149,8 +148,7 @@ App::post('/v1/runtimes') ->inject('orchestrationPool') ->inject('activeRuntimes') ->inject('response') - ->action(function (string $runtimeId, string $source, string $destination, array $vars, array $commands, string $runtime, string $network, string $baseImage, string $entrypoint, bool $remove, string $workdir, $orchestrationPool, $activeRuntimes, Response $response) { - + ->action(function (string $runtimeId, string $source, string $destination, array $vars, array $commands, string $runtime, string $baseImage, string $entrypoint, bool $remove, string $workdir, $orchestrationPool, $activeRuntimes, Response $response) { if ($activeRuntimes->exists($runtimeId)) { throw new Exception('Runtime already exists.', 409); } @@ -235,9 +233,7 @@ App::post('/v1/runtimes') throw new Exception('Failed to create build container', 500); } - if (!empty($network)) { - $orchestration->networkConnect($runtimeId, $network); - } + $orchestration->networkConnect($runtimeId, App::getEnv('OPEN_RUNTIMES_NETWORK', 'appwrite_runtimes')); /** * Execute any commands if they were provided diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index f25cfdc35f..3ae1c2654f 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -414,7 +414,7 @@ services: - _APP_FUNCTIONS_MEMORY_SWAP - _APP_FUNCTIONS_INACTIVE_THRESHOLD - _APP_EXECUTOR_SECRET - - _APP_EXECUTOR_RUNTIME_NETWORK + - OPEN_RUNTIMES_NETWORK - _APP_LOGGING_PROVIDER - _APP_LOGGING_CONFIG - _APP_STORAGE_DEVICE diff --git a/docker-compose.yml b/docker-compose.yml index c63b9c80e7..1ed63bd6f3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -472,7 +472,7 @@ services: - _APP_FUNCTIONS_MEMORY_SWAP - _APP_FUNCTIONS_INACTIVE_THRESHOLD - _APP_EXECUTOR_SECRET - - _APP_EXECUTOR_RUNTIME_NETWORK + - OPEN_RUNTIMES_NETWORK - _APP_LOGGING_PROVIDER - _APP_LOGGING_CONFIG - _APP_STORAGE_DEVICE diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index 1a96b3561b..fff322161f 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -59,7 +59,6 @@ class Executor string $entrypoint = '', string $workdir = '', string $destination = '', - string $network = '', array $vars = [], array $commands = [] ) { @@ -76,7 +75,6 @@ class Executor 'baseImage' => $baseImage, 'entrypoint' => $entrypoint, 'workdir' => $workdir, - 'network' => empty($network) ? App::getEnv('_APP_EXECUTOR_RUNTIME_NETWORK', 'appwrite_runtimes') : $network, 'vars' => $vars, 'remove' => $remove, 'commands' => $commands