Merge pull request #2844 from appwrite/feat-implement-refactor-suggestions
Feat implement refactor suggestions
This commit is contained in:
commit
a46e3fa63b
7 changed files with 16 additions and 53 deletions
2
.env
2
.env
|
@ -41,6 +41,7 @@ _APP_FUNCTIONS_CONTAINERS=10
|
||||||
_APP_FUNCTIONS_CPUS=4
|
_APP_FUNCTIONS_CPUS=4
|
||||||
_APP_FUNCTIONS_MEMORY=2000
|
_APP_FUNCTIONS_MEMORY=2000
|
||||||
_APP_FUNCTIONS_MEMORY_SWAP=2000
|
_APP_FUNCTIONS_MEMORY_SWAP=2000
|
||||||
|
_APP_FUNCTIONS_INACTIVE_THRESHOLD=60
|
||||||
_APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes
|
_APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes
|
||||||
_APP_EXECUTOR_SECRET=a-random-secret
|
_APP_EXECUTOR_SECRET=a-random-secret
|
||||||
_APP_MAINTENANCE_INTERVAL=86400
|
_APP_MAINTENANCE_INTERVAL=86400
|
||||||
|
@ -50,4 +51,3 @@ _APP_MAINTENANCE_RETENTION_AUDIT=1209600
|
||||||
_APP_USAGE_STATS=enabled
|
_APP_USAGE_STATS=enabled
|
||||||
_APP_LOGGING_PROVIDER=
|
_APP_LOGGING_PROVIDER=
|
||||||
_APP_LOGGING_CONFIG=
|
_APP_LOGGING_CONFIG=
|
||||||
OPENRUNTIMES_INACTIVE_THRESHOLD=60
|
|
|
@ -282,7 +282,7 @@ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
|
||||||
```
|
```
|
||||||
**Build Functions Runtimes**
|
**Build Functions Runtimes**
|
||||||
|
|
||||||
The Runtimes for all supported cloud functions (multicore builds) can be found at the [appwrite/runtimes](https://github.com/appwrite/runtimes) repository.
|
The Runtimes for all supported cloud functions (multicore builds) can be found at the [open-runtimes/open-runtimes](https://github.com/open-runtimes/open-runtimes) repository.
|
||||||
|
|
||||||
## Generate SDK
|
## Generate SDK
|
||||||
|
|
||||||
|
|
|
@ -597,6 +597,15 @@ return [
|
||||||
'question' => '',
|
'question' => '',
|
||||||
'filter' => ''
|
'filter' => ''
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'name' => '_APP_FUNCTIONS_INACTIVE_THRESHOLD',
|
||||||
|
'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' => '0.13.0',
|
||||||
|
'default' => '60',
|
||||||
|
'required' => false,
|
||||||
|
'question' => '',
|
||||||
|
'filter' => ''
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'name' => 'DOCKERHUB_PULL_USERNAME',
|
'name' => 'DOCKERHUB_PULL_USERNAME',
|
||||||
'description' => 'The username for hub.docker.com. This variable is used to pull images from hub.docker.com.',
|
'description' => 'The username for hub.docker.com. This variable is used to pull images from hub.docker.com.',
|
||||||
|
|
|
@ -653,7 +653,7 @@ $http->on('start', function ($http) {
|
||||||
Timer::tick(MAINTENANCE_INTERVAL * 1000, function () use ($orchestrationPool, $activeRuntimes) {
|
Timer::tick(MAINTENANCE_INTERVAL * 1000, function () use ($orchestrationPool, $activeRuntimes) {
|
||||||
Console::warning("Running maintenance task ...");
|
Console::warning("Running maintenance task ...");
|
||||||
foreach ($activeRuntimes as $runtime) {
|
foreach ($activeRuntimes as $runtime) {
|
||||||
$inactiveThreshold = \time() - App::getEnv('OPENRUNTIMES_INACTIVE_THRESHOLD', 60);
|
$inactiveThreshold = \time() - App::getEnv('_APP_FUNCTIONS_INACTIVE_THRESHOLD', 60);
|
||||||
if ($runtime['updated'] < $inactiveThreshold) {
|
if ($runtime['updated'] < $inactiveThreshold) {
|
||||||
go(function () use ($runtime, $orchestrationPool, $activeRuntimes) {
|
go(function () use ($runtime, $orchestrationPool, $activeRuntimes) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -181,13 +181,13 @@ services:
|
||||||
- _APP_FUNCTIONS_CPUS
|
- _APP_FUNCTIONS_CPUS
|
||||||
- _APP_FUNCTIONS_MEMORY
|
- _APP_FUNCTIONS_MEMORY
|
||||||
- _APP_FUNCTIONS_MEMORY_SWAP
|
- _APP_FUNCTIONS_MEMORY_SWAP
|
||||||
|
- _APP_FUNCTIONS_INACTIVE_THRESHOLD
|
||||||
- _APP_EXECUTOR_SECRET
|
- _APP_EXECUTOR_SECRET
|
||||||
- _APP_EXECUTOR_RUNTIME_NETWORK
|
- _APP_EXECUTOR_RUNTIME_NETWORK
|
||||||
- _APP_LOGGING_PROVIDER
|
- _APP_LOGGING_PROVIDER
|
||||||
- _APP_LOGGING_CONFIG
|
- _APP_LOGGING_CONFIG
|
||||||
- DOCKERHUB_PULL_USERNAME
|
- DOCKERHUB_PULL_USERNAME
|
||||||
- DOCKERHUB_PULL_PASSWORD
|
- DOCKERHUB_PULL_PASSWORD
|
||||||
- OPENRUNTIMES_INACTIVE_THRESHOLD
|
|
||||||
|
|
||||||
appwrite-worker-database:
|
appwrite-worker-database:
|
||||||
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
|
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
|
||||||
|
@ -355,52 +355,6 @@ services:
|
||||||
- _APP_EXECUTOR_SECRET
|
- _APP_EXECUTOR_SECRET
|
||||||
- _APP_USAGE_STATS
|
- _APP_USAGE_STATS
|
||||||
|
|
||||||
appwrite-executor:
|
|
||||||
container_name: appwrite-executor
|
|
||||||
entrypoint: executor
|
|
||||||
stop_signal: SIGINT
|
|
||||||
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
|
|
||||||
networks:
|
|
||||||
appwrite:
|
|
||||||
runtimes:
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
- appwrite-functions:/storage/functions:rw
|
|
||||||
- /tmp:/tmp:rw
|
|
||||||
- ./app:/usr/src/code/app
|
|
||||||
- ./src:/usr/src/code/src
|
|
||||||
- ./dev:/usr/local/dev
|
|
||||||
depends_on:
|
|
||||||
- redis
|
|
||||||
- mariadb
|
|
||||||
environment:
|
|
||||||
- _APP_ENV
|
|
||||||
- _APP_OPENSSL_KEY_V1
|
|
||||||
- _APP_REDIS_HOST
|
|
||||||
- _APP_REDIS_PORT
|
|
||||||
- _APP_REDIS_USER
|
|
||||||
- _APP_REDIS_PASS
|
|
||||||
- _APP_DB_HOST
|
|
||||||
- _APP_DB_PORT
|
|
||||||
- _APP_DB_SCHEMA
|
|
||||||
- _APP_DB_USER
|
|
||||||
- _APP_DB_PASS
|
|
||||||
- _APP_FUNCTIONS_TIMEOUT
|
|
||||||
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
|
||||||
- _APP_FUNCTIONS_CONTAINERS
|
|
||||||
- _APP_FUNCTIONS_RUNTIMES
|
|
||||||
- _APP_FUNCTIONS_CPUS
|
|
||||||
- _APP_FUNCTIONS_MEMORY
|
|
||||||
- _APP_FUNCTIONS_MEMORY_SWAP
|
|
||||||
- _APP_EXECUTOR_SECRET
|
|
||||||
- _APP_USAGE_STATS
|
|
||||||
- _APP_STATSD_HOST
|
|
||||||
- _APP_STATSD_PORT
|
|
||||||
- _APP_LOGGING_PROVIDER
|
|
||||||
- _APP_LOGGING_CONFIG
|
|
||||||
- DOCKERHUB_PULL_USERNAME
|
|
||||||
- DOCKERHUB_PULL_PASSWORD
|
|
||||||
|
|
||||||
appwrite-worker-mails:
|
appwrite-worker-mails:
|
||||||
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
|
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
|
||||||
entrypoint: worker-mails
|
entrypoint: worker-mails
|
||||||
|
@ -424,6 +378,7 @@ services:
|
||||||
- _APP_SMTP_USERNAME
|
- _APP_SMTP_USERNAME
|
||||||
- _APP_SMTP_PASSWORD
|
- _APP_SMTP_PASSWORD
|
||||||
|
|
||||||
|
|
||||||
appwrite-maintenance:
|
appwrite-maintenance:
|
||||||
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
|
image: <?php echo $organization; ?>/<?php echo $image; ?>:<?php echo $version."\n"; ?>
|
||||||
entrypoint: maintenance
|
entrypoint: maintenance
|
||||||
|
|
|
@ -426,13 +426,13 @@ services:
|
||||||
- _APP_FUNCTIONS_CPUS
|
- _APP_FUNCTIONS_CPUS
|
||||||
- _APP_FUNCTIONS_MEMORY
|
- _APP_FUNCTIONS_MEMORY
|
||||||
- _APP_FUNCTIONS_MEMORY_SWAP
|
- _APP_FUNCTIONS_MEMORY_SWAP
|
||||||
|
- _APP_FUNCTIONS_INACTIVE_THRESHOLD
|
||||||
- _APP_EXECUTOR_SECRET
|
- _APP_EXECUTOR_SECRET
|
||||||
- _APP_EXECUTOR_RUNTIME_NETWORK
|
- _APP_EXECUTOR_RUNTIME_NETWORK
|
||||||
- _APP_LOGGING_PROVIDER
|
- _APP_LOGGING_PROVIDER
|
||||||
- _APP_LOGGING_CONFIG
|
- _APP_LOGGING_CONFIG
|
||||||
- DOCKERHUB_PULL_USERNAME
|
- DOCKERHUB_PULL_USERNAME
|
||||||
- DOCKERHUB_PULL_PASSWORD
|
- DOCKERHUB_PULL_PASSWORD
|
||||||
- OPENRUNTIMES_INACTIVE_THRESHOLD
|
|
||||||
|
|
||||||
appwrite-worker-mails:
|
appwrite-worker-mails:
|
||||||
entrypoint: worker-mails
|
entrypoint: worker-mails
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Get a list of all the current user build logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. [Learn more about different API modes](/docs/admin).
|
|
Loading…
Reference in a new issue