diff --git a/.env b/.env index 1835f6af59..76d6f33c39 100644 --- a/.env +++ b/.env @@ -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= \ No newline at end of file +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 \ No newline at end of file diff --git a/app/workers/builds.php b/app/workers/builds.php index d1337f980d..af8e0e2717 100644 --- a/app/workers/builds.php +++ b/app/workers/builds.php @@ -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"); diff --git a/docker-compose.yml b/docker-compose.yml index aac166beec..757f142c4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: