Add Build Timeout EnvVar
This commit is contained in:
parent
037420e0bc
commit
e64bb9faf5
6 changed files with 20 additions and 2 deletions
1
.env
1
.env
|
@ -34,6 +34,7 @@ _APP_SMTP_USERNAME=
|
||||||
_APP_SMTP_PASSWORD=
|
_APP_SMTP_PASSWORD=
|
||||||
_APP_STORAGE_LIMIT=10000000
|
_APP_STORAGE_LIMIT=10000000
|
||||||
_APP_FUNCTIONS_TIMEOUT=900
|
_APP_FUNCTIONS_TIMEOUT=900
|
||||||
|
_APP_FUNCTIONS_BUILD_TIMEOUT=900
|
||||||
_APP_FUNCTIONS_CONTAINERS=10
|
_APP_FUNCTIONS_CONTAINERS=10
|
||||||
_APP_FUNCTIONS_CPUS=4
|
_APP_FUNCTIONS_CPUS=4
|
||||||
_APP_FUNCTIONS_MEMORY=2000
|
_APP_FUNCTIONS_MEMORY=2000
|
||||||
|
|
|
@ -417,6 +417,15 @@ return [
|
||||||
'question' => '',
|
'question' => '',
|
||||||
'filter' => ''
|
'filter' => ''
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'name' => '_APP_FUNCTIONS_BUILD_TIMEOUT',
|
||||||
|
'description' => 'The maximum number of seconds allowed as a timeout value when building a new function. The default value is 900 seconds.',
|
||||||
|
'introduction' => '0.12.0',
|
||||||
|
'default' => '900',
|
||||||
|
'required' => false,
|
||||||
|
'question' => '',
|
||||||
|
'filter' => ''
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'name' => '_APP_FUNCTIONS_CONTAINERS',
|
'name' => '_APP_FUNCTIONS_CONTAINERS',
|
||||||
'description' => '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' => '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.',
|
||||||
|
|
|
@ -319,6 +319,7 @@ function runBuildStage(string $tagID, Document $function, string $projectID, Dat
|
||||||
$tagPath = $tag->getAttribute('path', '');
|
$tagPath = $tag->getAttribute('path', '');
|
||||||
$tagPathTarget = '/tmp/project-' . $projectID . '/' . $tag->getId() . '/code.tar.gz';
|
$tagPathTarget = '/tmp/project-' . $projectID . '/' . $tag->getId() . '/code.tar.gz';
|
||||||
$tagPathTargetDir = \pathinfo($tagPathTarget, PATHINFO_DIRNAME);
|
$tagPathTargetDir = \pathinfo($tagPathTarget, PATHINFO_DIRNAME);
|
||||||
|
|
||||||
$container = 'build-stage-' . $tag->getId();
|
$container = 'build-stage-' . $tag->getId();
|
||||||
|
|
||||||
// Perform various checks
|
// Perform various checks
|
||||||
|
@ -392,7 +393,7 @@ function runBuildStage(string $tagID, Document $function, string $projectID, Dat
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
throw new Exception('Failed to start build container');
|
throw new Exception('Failed to start build container');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +443,7 @@ function runBuildStage(string $tagID, Document $function, string $projectID, Dat
|
||||||
command: ['sh', '-c', 'cd /usr/local/src && ./build.sh'],
|
command: ['sh', '-c', 'cd /usr/local/src && ./build.sh'],
|
||||||
stdout: $buildStdout,
|
stdout: $buildStdout,
|
||||||
stderr: $buildStderr,
|
stderr: $buildStderr,
|
||||||
timeout: 600 //TODO: Make this configurable
|
timeout: App::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$buildSuccess) {
|
if (!$buildSuccess) {
|
||||||
|
|
|
@ -101,6 +101,7 @@ services:
|
||||||
- _APP_STORAGE_ANTIVIRUS_HOST
|
- _APP_STORAGE_ANTIVIRUS_HOST
|
||||||
- _APP_STORAGE_ANTIVIRUS_PORT
|
- _APP_STORAGE_ANTIVIRUS_PORT
|
||||||
- _APP_FUNCTIONS_TIMEOUT
|
- _APP_FUNCTIONS_TIMEOUT
|
||||||
|
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
||||||
- _APP_FUNCTIONS_CONTAINERS
|
- _APP_FUNCTIONS_CONTAINERS
|
||||||
- _APP_FUNCTIONS_CPUS
|
- _APP_FUNCTIONS_CPUS
|
||||||
- _APP_FUNCTIONS_MEMORY
|
- _APP_FUNCTIONS_MEMORY
|
||||||
|
@ -290,6 +291,7 @@ services:
|
||||||
- _APP_DB_USER
|
- _APP_DB_USER
|
||||||
- _APP_DB_PASS
|
- _APP_DB_PASS
|
||||||
- _APP_FUNCTIONS_TIMEOUT
|
- _APP_FUNCTIONS_TIMEOUT
|
||||||
|
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
||||||
- _APP_FUNCTIONS_CONTAINERS
|
- _APP_FUNCTIONS_CONTAINERS
|
||||||
- _APP_FUNCTIONS_CPUS
|
- _APP_FUNCTIONS_CPUS
|
||||||
- _APP_FUNCTIONS_MEMORY
|
- _APP_FUNCTIONS_MEMORY
|
||||||
|
|
|
@ -121,6 +121,7 @@ services:
|
||||||
- _APP_USAGE_STATS
|
- _APP_USAGE_STATS
|
||||||
- _APP_STORAGE_LIMIT
|
- _APP_STORAGE_LIMIT
|
||||||
- _APP_FUNCTIONS_TIMEOUT
|
- _APP_FUNCTIONS_TIMEOUT
|
||||||
|
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
||||||
- _APP_FUNCTIONS_CONTAINERS
|
- _APP_FUNCTIONS_CONTAINERS
|
||||||
- _APP_FUNCTIONS_CPUS
|
- _APP_FUNCTIONS_CPUS
|
||||||
- _APP_FUNCTIONS_MEMORY
|
- _APP_FUNCTIONS_MEMORY
|
||||||
|
@ -330,6 +331,7 @@ services:
|
||||||
- _APP_DB_USER
|
- _APP_DB_USER
|
||||||
- _APP_DB_PASS
|
- _APP_DB_PASS
|
||||||
- _APP_FUNCTIONS_TIMEOUT
|
- _APP_FUNCTIONS_TIMEOUT
|
||||||
|
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
||||||
- _APP_FUNCTIONS_CONTAINERS
|
- _APP_FUNCTIONS_CONTAINERS
|
||||||
- _APP_FUNCTIONS_RUNTIMES
|
- _APP_FUNCTIONS_RUNTIMES
|
||||||
- _APP_FUNCTIONS_CPUS
|
- _APP_FUNCTIONS_CPUS
|
||||||
|
@ -381,6 +383,7 @@ services:
|
||||||
- _APP_DB_USER
|
- _APP_DB_USER
|
||||||
- _APP_DB_PASS
|
- _APP_DB_PASS
|
||||||
- _APP_FUNCTIONS_TIMEOUT
|
- _APP_FUNCTIONS_TIMEOUT
|
||||||
|
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
||||||
- _APP_FUNCTIONS_CONTAINERS
|
- _APP_FUNCTIONS_CONTAINERS
|
||||||
- _APP_FUNCTIONS_RUNTIMES
|
- _APP_FUNCTIONS_RUNTIMES
|
||||||
- _APP_FUNCTIONS_CPUS
|
- _APP_FUNCTIONS_CPUS
|
||||||
|
|
|
@ -84,6 +84,7 @@ services:
|
||||||
- _APP_STORAGE_ANTIVIRUS=disabled
|
- _APP_STORAGE_ANTIVIRUS=disabled
|
||||||
- _APP_STORAGE_LIMIT
|
- _APP_STORAGE_LIMIT
|
||||||
- _APP_FUNCTIONS_TIMEOUT
|
- _APP_FUNCTIONS_TIMEOUT
|
||||||
|
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
||||||
- _APP_FUNCTIONS_CONTAINERS
|
- _APP_FUNCTIONS_CONTAINERS
|
||||||
- _APP_FUNCTIONS_CPUS
|
- _APP_FUNCTIONS_CPUS
|
||||||
- _APP_FUNCTIONS_MEMORY
|
- _APP_FUNCTIONS_MEMORY
|
||||||
|
@ -243,6 +244,7 @@ services:
|
||||||
- _APP_DB_USER
|
- _APP_DB_USER
|
||||||
- _APP_DB_PASS
|
- _APP_DB_PASS
|
||||||
- _APP_FUNCTIONS_TIMEOUT
|
- _APP_FUNCTIONS_TIMEOUT
|
||||||
|
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
||||||
- _APP_FUNCTIONS_CONTAINERS
|
- _APP_FUNCTIONS_CONTAINERS
|
||||||
- _APP_FUNCTIONS_CPUS
|
- _APP_FUNCTIONS_CPUS
|
||||||
- _APP_FUNCTIONS_MEMORY
|
- _APP_FUNCTIONS_MEMORY
|
||||||
|
|
Loading…
Reference in a new issue