Compare commits

...
4 changed files with 52 additions and 8 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ _APP_COMPUTE_INACTIVE_THRESHOLD=600
_APP_COMPUTE_MAINTENANCE_INTERVAL=600
_APP_COMPUTE_RUNTIMES_NETWORK=runtimes
_APP_EXECUTOR_SECRET=your-secret-key
_APP_EXECUTOR_HOST=http://exc1/v1
_APP_EXECUTOR_HOST=http://fastly/v1
_APP_FUNCTIONS_RUNTIMES=php-8.0,node-18.0,python-3.9,ruby-3.1
_APP_SITES_RUNTIMES=static-1,node-22,flutter-3.29
_APP_MAINTENANCE_INTERVAL=86400
+22 -2
View File
@@ -946,12 +946,32 @@ services:
networks:
- appwrite
fastly:
image: varnish:7.7.1
container_name: fastly
hostname: fastly
ports:
- 1337:80
volumes:
- ./varnish.vcl:/etc/varnish/default.vcl:ro
networks:
- appwrite
- runtimes
depends_on:
- openruntimes-executor
command: >
varnishd
-F
-f /etc/varnish/default.vcl
-a :80
-s malloc,256m
openruntimes-executor:
container_name: openruntimes-executor
hostname: exc1
<<: *x-logging
stop_signal: SIGINT
image: openruntimes/executor:0.7.14
image: openruntimes/executor:0.7.15-streaming-1
restart: unless-stopped
networks:
- appwrite
@@ -1015,7 +1035,7 @@ services:
- OPR_PROXY_SECRET=$_APP_EXECUTOR_SECRET
- OPR_PROXY_LOGGING_CONFIG=$_APP_LOGGING_CONFIG
- OPR_PROXY_ALGORITHM=random
- OPR_PROXY_EXECUTORS=exc1
- OPR_PROXY_EXECUTORS=fastly
- OPR_PROXY_HEALTHCHECK_INTERVAL=10000
- OPR_PROXY_MAX_TIMEOUT=600
- OPR_PROXY_HEALTHCHECK=enabled
+18 -5
View File
@@ -97,15 +97,28 @@ class Executor
];
$endpoint = $this->selectEndpoint($projectId, $deploymentId);
$response = $this->call($endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout);
$status = $response['headers']['status-code'];
$response = '';
$this->call(
$endpoint,
self::METHOD_POST,
$route,
['x-opr-runtime-id' => $runtimeId],
$params,
true,
$timeout,
callback: function ($chunk) use (&$response) {
$response .= $chunk;
}
);
$response = json_decode($response, true);
$status = $response['code'] ?? 201;
if ($status >= 400) {
$message = \is_string($response['body']) ? $response['body'] : $response['body']['message'];
throw new \Exception($message, $status);
throw new \Exception($response['message'], $status);
}
return $response['body'];
return $response;
}
/**
+11
View File
@@ -0,0 +1,11 @@
vcl 4.1;
backend exc1 {
.host = "exc1";
.port = "80";
.first_byte_timeout = 10s;
}
sub vcl_recv {
set req.backend_hint = exc1;
}