Implement various suggestions
+ Fix Docblocks + Remove unused variable from deleteRuntime in executor + Added build status explanation to description + Sync composer.phtml to composer.json
This commit is contained in:
parent
55a4bf3dcc
commit
b1acc028c9
|
@ -269,6 +269,7 @@ RUN chmod +x /usr/local/bin/doctor && \
|
||||||
chmod +x /usr/local/bin/install && \
|
chmod +x /usr/local/bin/install && \
|
||||||
chmod +x /usr/local/bin/migrate && \
|
chmod +x /usr/local/bin/migrate && \
|
||||||
chmod +x /usr/local/bin/realtime && \
|
chmod +x /usr/local/bin/realtime && \
|
||||||
|
chmod +x /usr/local/bin/executor && \
|
||||||
chmod +x /usr/local/bin/schedule && \
|
chmod +x /usr/local/bin/schedule && \
|
||||||
chmod +x /usr/local/bin/sdks && \
|
chmod +x /usr/local/bin/sdks && \
|
||||||
chmod +x /usr/local/bin/specs && \
|
chmod +x /usr/local/bin/specs && \
|
||||||
|
@ -282,8 +283,7 @@ RUN chmod +x /usr/local/bin/doctor && \
|
||||||
chmod +x /usr/local/bin/worker-functions && \
|
chmod +x /usr/local/bin/worker-functions && \
|
||||||
chmod +x /usr/local/bin/worker-builds && \
|
chmod +x /usr/local/bin/worker-builds && \
|
||||||
chmod +x /usr/local/bin/worker-mails && \
|
chmod +x /usr/local/bin/worker-mails && \
|
||||||
chmod +x /usr/local/bin/worker-webhooks && \
|
chmod +x /usr/local/bin/worker-webhooks
|
||||||
chmod +x /usr/local/bin/executor
|
|
||||||
|
|
||||||
# Letsencrypt Permissions
|
# Letsencrypt Permissions
|
||||||
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
|
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
|
||||||
|
|
|
@ -174,16 +174,6 @@ services:
|
||||||
- appwrite
|
- appwrite
|
||||||
environment:
|
environment:
|
||||||
- _APP_ENV
|
- _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_TIMEOUT
|
||||||
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
- _APP_FUNCTIONS_BUILD_TIMEOUT
|
||||||
- _APP_FUNCTIONS_CONTAINERS
|
- _APP_FUNCTIONS_CONTAINERS
|
||||||
|
@ -193,13 +183,11 @@ services:
|
||||||
- _APP_FUNCTIONS_MEMORY_SWAP
|
- _APP_FUNCTIONS_MEMORY_SWAP
|
||||||
- _APP_EXECUTOR_SECRET
|
- _APP_EXECUTOR_SECRET
|
||||||
- _APP_EXECUTOR_RUNTIME_NETWORK
|
- _APP_EXECUTOR_RUNTIME_NETWORK
|
||||||
- _APP_USAGE_STATS
|
|
||||||
- _APP_STATSD_HOST
|
|
||||||
- _APP_STATSD_PORT
|
|
||||||
- _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"; ?>
|
||||||
|
|
|
@ -371,7 +371,7 @@ class DeletesV1 extends Worker
|
||||||
$executor = new Executor();
|
$executor = new Executor();
|
||||||
foreach ($deploymentIds as $deploymentId) {
|
foreach ($deploymentIds as $deploymentId) {
|
||||||
try {
|
try {
|
||||||
$executor->deleteRuntime($projectId, $functionId, $deploymentId);
|
$executor->deleteRuntime($projectId, $deploymentId);
|
||||||
} catch (Throwable $th) {
|
} catch (Throwable $th) {
|
||||||
Console::error($th->getMessage());
|
Console::error($th->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ class DeletesV1 extends Worker
|
||||||
Console::info("Requesting executor to delete deployment container for deployment " . $deploymentId);
|
Console::info("Requesting executor to delete deployment container for deployment " . $deploymentId);
|
||||||
try {
|
try {
|
||||||
$executor = new Executor();
|
$executor = new Executor();
|
||||||
$executor->deleteRuntime($projectId, $functionId, $deploymentId);
|
$executor->deleteRuntime($projectId, $deploymentId);
|
||||||
} catch (Throwable $th) {
|
} catch (Throwable $th) {
|
||||||
Console::error($th->getMessage());
|
Console::error($th->getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Build extends Model
|
||||||
])
|
])
|
||||||
->addRule('deploymentId', [
|
->addRule('deploymentId', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_STRING,
|
||||||
'description' => 'The deployment that created this build',
|
'description' => 'The deployment that created this build.',
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'example' => '5e5ea5c16897e',
|
'example' => '5e5ea5c16897e',
|
||||||
])
|
])
|
||||||
|
@ -35,7 +35,7 @@ class Build extends Model
|
||||||
// Building - The deployment is currently being built
|
// Building - The deployment is currently being built
|
||||||
->addRule('status', [
|
->addRule('status', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_STRING,
|
||||||
'description' => 'The build status.',
|
'description' => 'The build status. There are a few different types and each one means something different. \nFailed - The deployment build has failed. More details can usually be found in buildStderr\nReady - The deployment build was successful and the deployment is ready to be deployed\nProcessing - The deployment is currently waiting to have a build triggered\nBuilding - The deployment is currently being built',
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'example' => 'ready',
|
'example' => 'ready',
|
||||||
])
|
])
|
||||||
|
@ -71,17 +71,17 @@ class Build extends Model
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName():string
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return 'Build';
|
return 'Build';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Collection
|
* Get Type
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getType():string
|
public function getType(): string
|
||||||
{
|
{
|
||||||
return Response::MODEL_BUILD;
|
return Response::MODEL_BUILD;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,9 +122,12 @@ class Func extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Collection
|
* Filter Function
|
||||||
*
|
*
|
||||||
* @return string
|
* Automatically converts a [] default to a stdClass, this is called while grabbing the document.
|
||||||
|
*
|
||||||
|
* @param Document $document
|
||||||
|
* @return Document
|
||||||
*/
|
*/
|
||||||
public function filter(Document $document): Document
|
public function filter(Document $document): Document
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,25 @@ class Executor
|
||||||
$this->endpoint = $endpoint;
|
$this->endpoint = $endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create runtime
|
||||||
|
*
|
||||||
|
* Launches a runtime container for a deployment ready for execution
|
||||||
|
*
|
||||||
|
* @param string $functionId
|
||||||
|
* @param string $deploymentId
|
||||||
|
* @param string $projectId
|
||||||
|
* @param string $source
|
||||||
|
* @param string $runtime
|
||||||
|
* @param string $baseImage
|
||||||
|
* @param bool $remove
|
||||||
|
* @param string $entrypoint
|
||||||
|
* @param string $workdir
|
||||||
|
* @param string $destinaction
|
||||||
|
* @param string $network
|
||||||
|
* @param array $vars
|
||||||
|
* @param array $commands
|
||||||
|
*/
|
||||||
public function createRuntime(
|
public function createRuntime(
|
||||||
string $functionId,
|
string $functionId,
|
||||||
string $deploymentId,
|
string $deploymentId,
|
||||||
|
@ -75,7 +94,15 @@ class Executor
|
||||||
return $response['body'];
|
return $response['body'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteRuntime(string $projectId, string $functionId, string $deploymentId)
|
/**
|
||||||
|
* Delete Runtime
|
||||||
|
*
|
||||||
|
* Deletes a runtime and cleans up any containers remaining.
|
||||||
|
*
|
||||||
|
* @param string $projectId
|
||||||
|
* @param string $deploymentId
|
||||||
|
*/
|
||||||
|
public function deleteRuntime(string $projectId, string $deploymentId)
|
||||||
{
|
{
|
||||||
$runtimeId = "$projectId-$deploymentId";
|
$runtimeId = "$projectId-$deploymentId";
|
||||||
$route = "/runtimes/$runtimeId";
|
$route = "/runtimes/$runtimeId";
|
||||||
|
@ -96,6 +123,22 @@ class Executor
|
||||||
return $response['body'];
|
return $response['body'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an execution
|
||||||
|
*
|
||||||
|
* @param string $projectId
|
||||||
|
* @param string $functionId
|
||||||
|
* @param string $deploymentId
|
||||||
|
* @param string $path
|
||||||
|
* @param array $vars
|
||||||
|
* @param string $entrypoint
|
||||||
|
* @param string $data
|
||||||
|
* @param string runtime
|
||||||
|
* @param string $baseImage
|
||||||
|
* @param int $timeout
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function createExecution(
|
public function createExecution(
|
||||||
string $projectId,
|
string $projectId,
|
||||||
string $functionId,
|
string $functionId,
|
||||||
|
@ -108,7 +151,6 @@ class Executor
|
||||||
string $baseImage,
|
string $baseImage,
|
||||||
$timeout
|
$timeout
|
||||||
) {
|
) {
|
||||||
|
|
||||||
$route = "/execution";
|
$route = "/execution";
|
||||||
$headers = [
|
$headers = [
|
||||||
'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
|
|
Loading…
Reference in a new issue