diff --git a/.env b/.env index d349afe7c..0f8526015 100644 --- a/.env +++ b/.env @@ -70,6 +70,8 @@ _APP_FUNCTIONS_TIMEOUT=900 _APP_FUNCTIONS_BUILD_TIMEOUT=900 _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=512 +OPR_EXECUTOR_INACTIVE_TRESHOLD=600 +OPR_EXECUTOR_NETWORK=openruntimes-runtimes _APP_EXECUTOR_SECRET=your-secret-key _APP_EXECUTOR_HOST=http://exc1/v1 _APP_FUNCTIONS_RUNTIMES= @@ -84,7 +86,5 @@ _APP_USAGE_STATS=enabled _APP_LOGGING_PROVIDER= _APP_LOGGING_CONFIG= OPR_EXECUTOR_CONNECTION_STORAGE=file://localhost -OPR_EXECUTOR_INACTIVE_TRESHOLD=600 -OPR_EXECUTOR_NETWORK=openruntimes-runtimes OPR_EXECUTOR_DOCKER_HUB_USERNAME= OPR_EXECUTOR_DOCKER_HUB_PASSWORD= \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6604d260e..594cd69cb 100755 --- a/Dockerfile +++ b/Dockerfile @@ -246,8 +246,10 @@ ENV _APP_SERVER=swoole \ _APP_SMS_FROM= \ _APP_FUNCTIONS_SIZE_LIMIT=30000000 \ _APP_FUNCTIONS_TIMEOUT=900 \ + _APP_FUNCTIONS_CPUS=1 \ + _APP_FUNCTIONS_MEMORY=128 \ _APP_EXECUTOR_SECRET=a-random-secret \ - _APP_EXECUTOR_HOST=http://appwrite-executor/v1 \ + _APP_EXECUTOR_HOST=http://exc1/v1 \ _APP_SETUP=self-hosted \ _APP_VERSION=$VERSION \ _APP_USAGE_STATS=enabled \ @@ -260,7 +262,11 @@ ENV _APP_SERVER=swoole \ _APP_MAINTENANCE_RETENTION_ABUSE=86400 \ _APP_MAINTENANCE_INTERVAL=86400 \ _APP_LOGGING_PROVIDER= \ - _APP_LOGGING_CONFIG= + OPR_EXECUTOR_CONNECTION_STORAGE=file://localhost \ + OPR_EXECUTOR_INACTIVE_TRESHOLD=600 \ + OPR_EXECUTOR_NETWORK=openruntimes-runtimes \ + OPR_EXECUTOR_DOCKER_HUB_USERNAME= \ + OPR_EXECUTOR_DOCKER_HUB_PASSWORD= RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone diff --git a/app/config/variables.php b/app/config/variables.php index dbe1a9748..7e0265662 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -701,7 +701,7 @@ return [ ], [ 'name' => '_APP_FUNCTIONS_CONTAINERS', - 'description' => 'Deprecated since 1.1.0. Use Open Runtimes Executor instead. The maximum number of containers Appwrite is allowed to keep alive in the background for function environments. Running containers allow faster execution time as there is no need to recreate each container every time a function gets executed. The default value is 10.', + 'description' => 'Deprecated since 1.2.0. Runtimes now timeout by inactivity using \'OPR_EXECUTOR_INACTIVE_TRESHOLD\'.', 'introduction' => '0.7.0', 'default' => '10', 'required' => false, @@ -710,7 +710,7 @@ return [ ], [ 'name' => '_APP_FUNCTIONS_CPUS', - 'description' => 'Deprecated since 1.1.0. Use Open Runtimes Executor instead. The maximum number of CPU core a single cloud function is allowed to use. Please note that setting a value higher than available cores will result in a function error, which might result in an error. The default value is empty. When it\'s empty, CPU limit will be disabled.', + 'description' => 'The maximum number of CPU core a single cloud function is allowed to use. Please note that setting a value higher than available cores will result in a function error, which might result in an error. The default value is empty. When it\'s empty, CPU limit will be disabled.', 'introduction' => '0.7.0', 'default' => '0', 'required' => false, @@ -719,7 +719,7 @@ return [ ], [ 'name' => '_APP_FUNCTIONS_MEMORY', - 'description' => 'Deprecated since 1.1.0. Use Open Runtimes Executor instead. The maximum amount of memory a single cloud function is allowed to use in megabytes. The default value is empty. When it\'s empty, memory limit will be disabled.', + 'description' => 'The maximum amount of memory a single cloud function is allowed to use in megabytes. The default value is empty. When it\'s empty, memory limit will be disabled.', 'introduction' => '0.7.0', 'default' => '0', 'required' => false, @@ -728,7 +728,7 @@ return [ ], [ 'name' => '_APP_FUNCTIONS_MEMORY_SWAP', - 'description' => 'Deprecated since 1.1.0. Use Open Runtimes Executor instead. The maximum amount of swap memory a single cloud function is allowed to use in megabytes. The default value is empty. When it\'s empty, swap memory limit will be disabled.', + 'description' => 'Deprecated since 1.2.0. High use of swap memory is not recommended to preserve harddrive health.', 'introduction' => '0.7.0', 'default' => '0', 'required' => false, @@ -782,7 +782,7 @@ return [ ], [ 'name' => '_APP_FUNCTIONS_INACTIVE_THRESHOLD', - 'description' => 'Deprecated since 1.1.0. Use Open Runtimes Executor instead. The minimum time a function can be inactive before it\'s container is shutdown and put to sleep. The default value is 60 seconds', + 'description' => 'Deprecated with 1.2.0, use \'OPR_EXECUTOR_INACTIVE_TRESHOLD\' instead!', 'introduction' => '0.13.0', 'default' => '60', 'required' => false, @@ -791,7 +791,7 @@ return [ ], [ 'name' => 'DOCKERHUB_PULL_USERNAME', - 'description' => 'Deprecated since 1.1.0. Use Open Runtimes Executor instead. The username for hub.docker.com. This variable is used to pull images from hub.docker.com.', + 'description' => 'Deprecated with 1.2.0, use \'OPR_EXECUTOR_DOCKER_HUB_USERNAME\' instead!', 'introduction' => '0.10.0', 'default' => '', 'required' => false, @@ -800,7 +800,7 @@ return [ ], [ 'name' => 'DOCKERHUB_PULL_PASSWORD', - 'description' => 'Deprecated since 1.1.0. Use Open Runtimes Executor instead. The password for hub.docker.com. This variable is used to pull images from hub.docker.com.', + 'description' => 'Deprecated with 1.2.0, use \'OPR_EXECUTOR_DOCKER_HUB_PASSWORD\' instead!', 'introduction' => '0.10.0', 'default' => '', 'required' => false, @@ -809,7 +809,7 @@ return [ ], [ 'name' => 'DOCKERHUB_PULL_EMAIL', - 'description' => 'Deprecated since 1.1.0. Use Open Runtimes Executor instead. The email for hub.docker.com. This variable is used to pull images from hub.docker.com.', + 'description' => 'Deprecated since 1.2.0. Email is no longer needed.', 'introduction' => '0.10.0', 'default' => '', 'required' => false, @@ -818,13 +818,58 @@ return [ ], [ 'name' => 'OPEN_RUNTIMES_NETWORK', - 'description' => 'Deprecated since 1.1.0. Use Open Runtimes Executor instead. The docker network used for communication between the executor and runtimes. Change this if you have altered the default network names.', + 'description' => 'Deprecated with 1.2.0, use \'OPR_EXECUTOR_NETWORK\' instead!', 'introduction' => '0.13.0', 'default' => 'appwrite_runtimes', 'required' => false, 'question' => '', 'filter' => '' ], + [ + 'name' => 'OPR_EXECUTOR_INACTIVE_TRESHOLD', + 'description' => 'The minimum time a function can be inactive before it\'s container is shutdown and put to sleep. The default value is 60 seconds', + 'introduction' => '1.2.0', + 'default' => '60', + 'required' => false, + 'question' => '', + 'filter' => '' + ], + [ + 'name' => 'OPR_EXECUTOR_NETWORK', + 'description' => 'The docker network used for communication between the executor and runtimes. Change this if you have altered the default network names.', + 'introduction' => '1.2.0', + 'default' => 'appwrite_runtimes', + 'required' => false, + 'question' => '', + 'filter' => '' + ], + [ + 'name' => 'OPR_EXECUTOR_DOCKER_HUB_USERNAME', + 'description' => 'The username for hub.docker.com. This variable is used to pull images from hub.docker.com.', + 'introduction' => '1.2.0', + 'default' => '', + 'required' => false, + 'question' => '', + 'filter' => '' + ], + [ + 'name' => 'OPR_EXECUTOR_DOCKER_HUB_PASSWORD', + 'description' => 'The password for hub.docker.com. This variable is used to pull images from hub.docker.com.', + 'introduction' => '1.2.0', + 'default' => '', + 'required' => false, + 'question' => '', + 'filter' => '' + ], + [ + 'name' => 'OPR_EXECUTOR_CONNECTION_STORAGE', + 'description' => 'DSN record of storage driver where Open Runtimes Executor stores output of Appwrite Function Deployment builds.', + 'introduction' => '1.2.0', + 'default' => '', + 'required' => false, + 'question' => '', + 'filter' => '' + ] ], ], [ diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 6bdbaf54d..b5edb4141 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -66,7 +66,7 @@ services: - appwrite-cache:/storage/cache:rw - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw - - appwrite-functions:/storage/functions:rw + - openruntimes-functions:/storage/functions:rw depends_on: - mariadb - redis @@ -259,8 +259,8 @@ services: volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw - - appwrite-functions:/storage/functions:rw - - appwrite-builds:/storage/builds:rw + - openruntimes-functions:/storage/functions:rw + - openruntimes-builds:/storage/builds:rw - appwrite-certificates:/storage/certificates:rw environment: - _APP_ENV @@ -637,8 +637,13 @@ services: networks: gateway: + name: gateway appwrite: - runtimes: + name: appwrite + openruntimes-runtimes: + name: openruntimes-runtimes + openruntimes-executors: + name: openruntimes-executors volumes: appwrite-mariadb: @@ -646,7 +651,7 @@ volumes: appwrite-cache: appwrite-uploads: appwrite-certificates: - appwrite-functions: - appwrite-builds: appwrite-influxdb: appwrite-config: + openruntimes-functions: + openruntimes-builds: diff --git a/docker-compose.yml b/docker-compose.yml index 0a41df723..d1a011ad7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -690,55 +690,9 @@ services: hostname: exc1 <<: *x-logging stop_signal: SIGINT - image: openruntimes/executor:0.1.1 - networks: - # - appwrite # If not using OPR proxy, uncomment this - - openruntimes-executors - - openruntimes-runtimes - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - openruntimes-builds:/storage/builds:rw - - openruntimes-functions:/storage/functions:rw - - /tmp:/tmp:rw - environment: - - 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_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES - - OPR_EXECUTOR_SECRET=$OPR_PROXY_EXECUTOR_SECRET # If not using OPR proxy, set to $_APP_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.2.2 + image: openruntimes/executor:0.1.3 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 - - openruntimes-executor2: - container_name: openruntimes-executor2 - hostname: exc2 - <<: *x-logging - stop_signal: SIGINT - image: openruntimes/executor:0.1.1 - networks: - - openruntimes-executors - openruntimes-runtimes volumes: - /var/run/docker.sock:/var/run/docker.sock @@ -753,7 +707,7 @@ services: - OPR_EXECUTOR_DOCKER_HUB_PASSWORD - OPR_EXECUTOR_ENV=$_APP_ENV - OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES - - OPR_EXECUTOR_SECRET=$OPR_PROXY_EXECUTOR_SECRET + - OPR_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET - OPR_EXECUTOR_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER - OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG @@ -919,11 +873,11 @@ services: networks: gateway: + name: gateway appwrite: + name: appwrite openruntimes-runtimes: name: openruntimes-runtimes - openruntimes-executors: - name: openruntimes-executors volumes: appwrite-mariadb: