1
0
Fork 0
mirror of synced 2024-06-30 04:00:34 +12:00

Fix usage with Proxy

This commit is contained in:
Matej Bačo 2023-03-24 09:26:21 +01:00
parent 55d94302db
commit 3916e4c0c5
3 changed files with 27 additions and 6 deletions

View file

@ -1551,8 +1551,8 @@ App::post('/v1/functions/:functionId/variables')
// Stop all running runtimes with this variable
(new Delete())
->setType(DELETE_TYPE_RUNTIMES)
->setProject($project)
->setFunction($function)
->setProject($project)
->trigger();
$response
@ -1677,8 +1677,8 @@ App::put('/v1/functions/:functionId/variables/:variableId')
// Stop all running runtimes with this variable
(new Delete())
->setType(DELETE_TYPE_RUNTIMES)
->setProject($project)
->setFunction($function)
->setProject($project)
->trigger();
$response->dynamic($variable, Response::MODEL_VARIABLE);
@ -1724,8 +1724,8 @@ App::delete('/v1/functions/:functionId/variables/:variableId')
// Stop all running runtimes with this variable
(new Delete())
->setType(DELETE_TYPE_RUNTIMES)
->setProject($project)
->setFunction($function)
->setProject($project)
->trigger();
$response->noContent();

View file

@ -729,6 +729,24 @@ services:
- OPR_EXECUTOR_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER
- OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG
# openruntimes-proxy:
# container_name: openruntimes-proxy
# hostname: proxy
# <<: *x-logging
# image: meldiron/proxy:0.3.0
# networks:
# - appwrite
# environment:
# - OPR_PROXY_ALGORITHM=random
# - OPR_PROXY_EXECUTORS=exc1,exc2
# - OPR_PROXY_HEALTHCHECK=enabled
# - OPR_PROXY_HEALTHCHECK_INTERVAL=10000
# - OPR_PROXY_SECRET=$_APP_EXECUTOR_SECRET
# - OPR_PROXY_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET
# - OPR_PROXY_ENV=development
# - OPR_PROXY_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER
# - OPR_PROXY_LOGGING_CONFIG=$_APP_LOGGING_CONFIG
mariadb:
image: mariadb:10.7 # fix issues when upgrading using: mysql_upgrade -u root -p
container_name: appwrite-mariadb

View file

@ -40,6 +40,7 @@ class Executor
$this->headers = [
'content-type' => 'application/json',
'authorization' => 'Bearer ' . App::getEnv('_APP_EXECUTOR_SECRET', ''),
'x-opr-addressing-method' => 'anycast-efficient'
];
}
@ -91,7 +92,7 @@ class Executor
$timeout = (int) App::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900);
$response = $this->call(self::METHOD_POST, $route, [], $params, true, $timeout);
$response = $this->call(self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout);
$status = $response['headers']['status-code'];
if ($status >= 400) {
@ -115,7 +116,9 @@ class Executor
$runtimeId = "$projectId-$deploymentId";
$route = "/runtimes/$runtimeId";
$response = $this->call(self::METHOD_DELETE, $route, [], [], true, 30);
$response = $this->call(self::METHOD_DELETE, $route, [
'x-opr-addressing-method' => 'broadcast'
], [], true, 30);
$status = $response['headers']['status-code'];
if ($status >= 400) {
@ -177,7 +180,7 @@ class Executor
$timeout = (int) App::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900);
$response = $this->call(self::METHOD_POST, $route, [], $params, true, $timeout);
$response = $this->call(self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout);
$status = $response['headers']['status-code'];
if ($status >= 400) {