1
0
Fork 0
mirror of synced 2024-06-29 19:50:26 +12:00

Update build to use 1 logs attribute

This commit is contained in:
Matej Bačo 2023-08-05 16:50:28 +02:00
parent 787a5c42de
commit 8a9f3f1b54
11 changed files with 52 additions and 47 deletions

48
.env
View file

@ -1,4 +1,4 @@
_APP_ENV=development
_APP_ENV=production
_APP_LOCALE=en
_APP_WORKER_PER_CORE=10
_APP_CONSOLE_WHITELIST_ROOT=disabled
@ -13,10 +13,10 @@ _APP_SYSTEM_RESPONSE_FORMAT=
_APP_OPTIONS_ABUSE=disabled
_APP_OPTIONS_FORCE_HTTPS=disabled
_APP_OPENSSL_KEY_V1=your-secret-key
_APP_DOMAIN=localhost
_APP_DOMAIN=matejbaco.loca.lt
_APP_DOMAIN_FUNCTIONS=functions.localhost
_APP_DOMAIN_DO_TOKEN=
_APP_DOMAIN_TARGET=localhost
_APP_DOMAIN_TARGET=matejbaco.loca.lt
_APP_REDIS_HOST=redis
_APP_REDIS_PORT=6379
_APP_REDIS_PASS=
@ -57,8 +57,8 @@ _APP_STORAGE_PREVIEW_LIMIT=20000000
_APP_FUNCTIONS_SIZE_LIMIT=30000000
_APP_FUNCTIONS_TIMEOUT=900
_APP_FUNCTIONS_BUILD_TIMEOUT=900
_APP_FUNCTIONS_CPUS=1
_APP_FUNCTIONS_MEMORY=1024
_APP_FUNCTIONS_CPUS=4
_APP_FUNCTIONS_MEMORY=2048
_APP_FUNCTIONS_INACTIVE_THRESHOLD=600
_APP_FUNCTIONS_MAINTENANCE_INTERVAL=600
_APP_FUNCTIONS_RUNTIMES_NETWORK=runtimes
@ -81,9 +81,35 @@ _APP_DOCKER_HUB_USERNAME=
_APP_DOCKER_HUB_PASSWORD=
_APP_CONSOLE_GITHUB_SECRET=
_APP_CONSOLE_GITHUB_APP_ID=
_APP_VCS_GITHUB_APP_NAME=
_APP_VCS_GITHUB_PRIVATE_KEY=""
_APP_VCS_GITHUB_APP_ID=
_APP_VCS_GITHUB_CLIENT_ID=
_APP_VCS_G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kHBkcyGbozUrznzzduYcP/C2iMsAvrigI
p6WkYX9hXYMAyjp+PcxRRCQE9WWijn4iNBMQ7mr+vZKCnot+KYU1ccVLY17RnKv1
lBPXhp47FhVOhvThtGVXtXgorunCfV5vLvy/hUkCgYAFBuc6EHR06q6SG+jxydH5
rsx9TO2kR7WNV67s7qyACF3mk5NCFNHD76OL9TfHs7T7Ez4aa7o/16IqCvKLsyDs
NlbB2dDBwbE5KDt3WHN4XsfcVUnhFaLhMOQ/qOmIBk+Hv0BzNAioVYzjksP2cfqp
6x6cCtEl4lyIKKQd6FTRmwKBgAqt/QhFtH/yvRq/yvb2qQXPyOo2XEXEZ0Y+Oiey
WecpE/60KpYeIH4llexNZTfuIP9SIrsNTImLWLX9kp6ptzQ5TYjQIE3Yu2jIh+Va
7Y4F4uZjd4WoFzXsOHmeqge6v9Xo4IlHsrMaLNagWHq/WkNz0WKfPzRlxpUVJ/y8
XD7JAoGAKWyDPw4dAo/IA4bTY13k1nPgT7vo7pby17FjGv4dVlWfD4Tz6Xfd7lUv
IVAdvMngMvyWBcGPWm+7mP9FpH0NflgQLD2Mubbed7DgaXfFrByAxo/3YRI3rfNH
sVTI5wPWVuuNzg+vI5SJ3RqceiKVkUESDWh725k3vB7+u01tMGE=
-----END RSA PRIVATE KEY-----"
_APP_VCS_GITHUB_APP_ID=337303
_APP_VCS_GITHUB_CLIENT_ID=Iv1.306ee38582d3f948
_APP_VCS_GITHUB_CLIENT_SECRET=0ab2a4a81c7f9c7783348527db36d215eca7e6e1
_APP_VCS_GITHUB_WEBHOOK_SECRET=33e0440e0a311cd4b33a702ebf27e5791de30050

View file

@ -3425,18 +3425,7 @@ $collections = [
'filters' => [],
],
[
'$id' => ID::custom('stderr'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 1000000,
'signed' => true,
'required' => false,
'default' => '',
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('stdout'),
'$id' => ID::custom('logs'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 1000000,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
Subproject commit cd583f44f7a71a34e7b4de7f6225d82ae473711c
Subproject commit 6e4bd59e0900c770bc0f164021d08ed5444913a7

View file

@ -1145,8 +1145,7 @@ App::get('/v1/functions/:functionId/deployments')
foreach ($results as $result) {
$build = $dbForProject->getDocument('builds', $result->getAttribute('buildId', ''));
$result->setAttribute('status', $build->getAttribute('status', 'processing'));
$result->setAttribute('buildStderr', $build->getAttribute('stderr', ''));
$result->setAttribute('buildStdout', $build->getAttribute('stdout', ''));
$result->setAttribute('buildLogs', $build->getAttribute('logs', ''));
$result->setAttribute('buildTime', $build->getAttribute('duration', 0));
$result->setAttribute('size', $result->getAttribute('size', 0) + $build->getAttribute('size', 0));
}
@ -1192,8 +1191,7 @@ App::get('/v1/functions/:functionId/deployments/:deploymentId')
$build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId', ''));
$deployment->setAttribute('status', $build->getAttribute('status', 'waiting'));
$deployment->setAttribute('buildStderr', $build->getAttribute('stderr', ''));
$deployment->setAttribute('buildStdout', $build->getAttribute('stdout', ''));
$deployment->setAttribute('buildLogs', $build->getAttribute('logs', ''));
$deployment->setAttribute('buildTime', $build->getAttribute('duration', 0));
$deployment->setAttribute('size', $deployment->getAttribute('size', 0) + $build->getAttribute('size', 0));

View file

@ -128,8 +128,7 @@ class BuildsV1 extends Worker
'runtime' => $function->getAttribute('runtime'),
'source' => $deployment->getAttribute('path', ''),
'sourceType' => strtolower(App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL)),
'stdout' => '',
'stderr' => '',
'logs' => '',
'endTime' => null,
'duration' => 0,
'size' => 0
@ -365,7 +364,7 @@ class BuildsV1 extends Worker
deploymentId: $deployment->getId(),
callback: function ($logs) use (&$response, &$build, $dbForProject, $allEvents, $project) {
if ($response === null) {
$build = $build->setAttribute('stdout', $build->getAttribute('stdout', '') . $logs);
$build = $build->setAttribute('logs', $build->getAttribute('logs', '') . $logs);
$build = $dbForProject->updateDocument('builds', $build->getId(), $build);
/**
@ -410,8 +409,7 @@ class BuildsV1 extends Worker
$build->setAttribute('status', 'ready');
$build->setAttribute('path', $response['path']);
$build->setAttribute('size', $response['size']);
$build->setAttribute('stderr', $response['stderr']);
$build->setAttribute('stdout', $response['stdout']);
$build->setAttribute('logs', $response['output']);
if ($isVcsEnabled) {
$this->runGitAction('ready', $github, $providerCommitHash, $owner, $repositoryName, $providerTargetUrl, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole);
@ -442,7 +440,7 @@ class BuildsV1 extends Worker
$build->setAttribute('endTime', $endTime);
$build->setAttribute('duration', \intval(\ceil($durationEnd - $durationStart)));
$build->setAttribute('status', 'failed');
$build->setAttribute('stderr', $th->getMessage());
$build->setAttribute('logs', $th->getMessage());
Console::error($th->getMessage());
if ($isVcsEnabled) {

View file

@ -727,7 +727,7 @@ services:
hostname: exc1
<<: *x-logging
stop_signal: SIGINT
image: meldiron/executor:0.3.4
image: meldiron/executor:0.3.5
networks:
- appwrite
- runtimes

View file

@ -70,18 +70,12 @@ class Deployment extends Model
'default' => '',
'example' => 'ready',
])
->addRule('buildStdout', [
->addRule('buildLogs', [
'type' => self::TYPE_STRING,
'description' => 'The build stdout.',
'description' => 'The build logs.',
'default' => '',
'example' => 'Compiling source files...',
])
->addRule('buildStderr', [
'type' => self::TYPE_STRING,
'description' => 'The build stderr.',
'default' => '',
'example' => 'File index.ts not found!',
])
->addRule('buildTime', [
'type' => self::TYPE_INTEGER,
'description' => 'The current build time in seconds.',