1
0
Fork 0
mirror of synced 2024-09-28 07:21:35 +12:00

Fix executor bugs, Add Open Runtimes Proxy

This commit is contained in:
Matej Bačo 2022-11-08 10:02:22 +00:00
parent a52ff7372a
commit 80b49452f4
3 changed files with 39 additions and 12 deletions

12
.env
View file

@ -74,11 +74,17 @@ _APP_USAGE_STATS=enabled
_APP_LOGGING_PROVIDER=
_APP_LOGGING_CONFIG=
_APP_EXECUTOR_SECRET=your-secret-key
_APP_EXECUTOR_HOST=http://appwrite-executor/v1
_APP_EXECUTOR_HOST=http://proxy1/v1
_APP_FUNCTIONS_RUNTIMES=php-8.0
OPR_EXECUTOR_RUNTIMES=php-8.0 # same as _APP_FUNCTIONS_RUNTIMES
OPR_EXECUTOR_CONNECTION_STORAGE=file://localhost
OPR_EXECUTOR_INACTIVE_TRESHOLD=60
OPR_EXECUTOR_NETWORK=openruntimes-runtimes
OPR_EXECUTOR_DOCKER_HUB_USERNAME=
OPR_EXECUTOR_DOCKER_HUB_PASSWORD=
OPR_EXECUTOR_DOCKER_HUB_PASSWORD=
OPR_PROXY_ALGORITHM=round-robin
OPR_PROXY_EXECUTORS=exc1
OPR_PROXY_HEALTHCHECK=enabled
OPR_PROXY_HEALTHCHECK_INTERVAL=5000
OPR_PROXY_EXECUTOR_SECRET=executor-secret-key

View file

@ -171,13 +171,16 @@ class BuildsV1 extends Worker
]
);
$endTime = new \DateTime();
$endTime->setTimestamp($response['endTimeUnix']);
/** Update the build document */
$build->setAttribute('endTime', $response['endTime']);
$build->setAttribute('duration', $response['duration']);
$build->setAttribute('endTime', DateTime::format($endTime));
$build->setAttribute('duration', \intval($response['duration']));
$build->setAttribute('status', $response['status']);
$build->setAttribute('outputPath', $response['outputPath']);
$build->setAttribute('stderr', $response['stderr']);
$build->setAttribute('stdout', $response['response']);
$build->setAttribute('stdout', $response['stdout']);
Console::success("Build id: $buildId created");

View file

@ -633,30 +633,46 @@ services:
stop_signal: SIGINT
image: openruntimes/executor:0.1.0
networks:
- appwrite
- openruntimes-runtimes
- openruntimes-executors
ports:
- 9900:80
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./app:/usr/local/app:rw
- ./src:/usr/local/src:rw
- openruntimes-builds:/storage/builds:rw
- openruntimes-functions:/storage/functions:rw
- /tmp:/tmp:rw
- ./tests/resources/functions:/storage/functions:rw
environment:
- OPR_EXECUTOR_RUNTIMES
- OPR_EXECUTOR_CONNECTION_STORAGE
- OPR_EXECUTOR_INACTIVE_TRESHOLD
- OPR_EXECUTOR_NETWORK
- OPR_EXECUTOR_DOCKER_HUB_USERNAME
- OPR_EXECUTOR_DOCKER_HUB_PASSWORD
- OPR_EXECUTOR_ENV=$_APP_ENV
- OPR_EXECUTOR_SECRET=_APP_EXECUTOR_SECRET
- OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES
- OPR_EXECUTOR_SECRET=$OPR_PROXY_EXECUTOR_SECRET
- OPR_EXECUTOR_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER
- OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG
openruntimes-proxy:
container_name: openruntimes-proxy
hostname: proxy1
<<: *x-logging
image: openruntimes/proxy:0.3.0
networks:
- appwrite
- openruntimes-executors
environment:
- OPR_PROXY_ALGORITHM
- OPR_PROXY_EXECUTORS
- OPR_PROXY_HEALTHCHECK
- OPR_PROXY_HEALTHCHECK_INTERVAL
- OPR_PROXY_EXECUTOR_SECRET
- OPR_PROXY_ENV=$_APP_ENV
- OPR_PROXY_SECRET=$_APP_EXECUTOR_SECRET
- 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
@ -827,6 +843,8 @@ networks:
appwrite:
openruntimes-runtimes:
name: openruntimes-runtimes
openruntimes-executors:
name: openruntimes-executors
volumes:
appwrite-mariadb: