Merge branch 'cl-1.4.x' of github.com:appwrite/appwrite into cl-1.4.x

This commit is contained in:
Christy Jacob 2023-09-26 00:02:09 +04:00
commit 2856d6db84
11 changed files with 234 additions and 50 deletions

View file

@ -16,7 +16,7 @@ jobs:
with:
fetch-depth: 2
submodules: recursive
ref: master
ref: cl-1.4.x
- name: Login to Docker Hub
uses: docker/login-action@v2

View file

@ -387,6 +387,108 @@ App::get('/v1/health/queue/certificates')
$response->dynamic(new Document([ 'size' => Resque::size(Event::CERTIFICATES_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
App::get('/v1/health/queue/builds')
->desc('Get Builds Queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueBuilds')
->label('sdk.description', '/docs/references/health/get-queue-builds.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->inject('response')
->action(function (Response $response) {
$response->dynamic(new Document([ 'size' => Resque::size(Event::BUILDS_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
App::get('/v1/health/queue/databases')
->desc('Get Databases Queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueDatabases')
->label('sdk.description', '/docs/references/health/get-queue-databases.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->inject('response')
->action(function (Response $response) {
$response->dynamic(new Document([ 'size' => Resque::size(Event::DATABASE_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
App::get('/v1/health/queue/deletes')
->desc('Get Deletes Queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueDeletes')
->label('sdk.description', '/docs/references/health/get-queue-deletes.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->inject('response')
->action(function (Response $response) {
$response->dynamic(new Document([ 'size' => Resque::size(Event::DELETE_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
App::get('/v1/health/queue/mails')
->desc('Get Mails Queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueMails')
->label('sdk.description', '/docs/references/health/get-queue-mails.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->inject('response')
->action(function (Response $response) {
$response->dynamic(new Document([ 'size' => Resque::size(Event::MAILS_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
App::get('/v1/health/queue/messaging')
->desc('Get Messaging Queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueMessaging')
->label('sdk.description', '/docs/references/health/get-queue-messaging.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->inject('response')
->action(function (Response $response) {
$response->dynamic(new Document([ 'size' => Resque::size(Event::MESSAGING_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
App::get('/v1/health/queue/migrations')
->desc('Get Migrations Queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueMigrations')
->label('sdk.description', '/docs/references/health/get-queue-migrations.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
->inject('response')
->action(function (Response $response) {
$response->dynamic(new Document([ 'size' => Resque::size(Event::MIGRATIONS_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
App::get('/v1/health/queue/functions')
->desc('Get Functions Queue')
->groups(['api', 'health'])

View file

@ -92,16 +92,17 @@ App::post('/v1/projects')
$projectId = ($projectId == 'unique()') ? ID::unique() : $projectId;
$backups['database_db_fra1_02'] = ['from' => '7:30', 'to' => '8:15'];
$backups['database_db_fra1_03'] = ['from' => '10:30', 'to' => '11:15'];
$backups['database_db_fra1_04'] = ['from' => '13:30', 'to' => '14:15'];
$backups['database_db_fra1_05'] = ['from' => '4:30', 'to' => '5:15'];
$backups['database_db_fra1_06'] = ['from' => '16:30', 'to' => '17:15'];
$backups['database_db_fra1_v14x_02'] = ['from' => '7:30', 'to' => '8:15'];
$backups['database_db_fra1_v14x_03'] = ['from' => '10:30', 'to' => '11:15'];
$backups['database_db_fra1_v14x_04'] = ['from' => '13:30', 'to' => '14:15'];
$backups['database_db_fra1_v14x_05'] = ['from' => '4:30', 'to' => '5:15'];
$backups['database_db_fra1_v14x_06'] = ['from' => '16:30', 'to' => '17:15'];
$backups['database_db_fra1_v14x_07'] = ['from' => '19:30', 'to' => '20:15'];
$databases = Config::getParam('pools-database', []);
/**
* Extract db from list while backing
* Remove databases from the list that are currently undergoing an backup
*/
if (count($databases) > 1) {
$now = new \DateTime();
@ -120,7 +121,7 @@ App::post('/v1/projects')
}
}
if ($index = array_search('database_db_fra1_06', $databases)) {
if ($index = array_search('database_db_fra1_v14x_07', $databases)) {
$database = $databases[$index];
} else {
$database = $databases[array_rand($databases)];

2
composer.lock generated
View file

@ -6029,5 +6029,5 @@
"platform-overrides": {
"php": "8.0"
},
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.6.0"
}

View file

@ -0,0 +1 @@
Get the number of builds that are waiting to be processed in the Appwrite internal queue server.

View file

@ -0,0 +1 @@
Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.

View file

@ -0,0 +1 @@
Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server.

View file

@ -0,0 +1 @@
Get the number of mails that are waiting to be processed in the Appwrite internal queue server.

View file

@ -0,0 +1 @@
Get the number of messages that are waiting to be processed in the Appwrite internal queue server.

View file

@ -0,0 +1 @@
Get the number of migrations that are waiting to be processed in the Appwrite internal queue server.

View file

@ -29,10 +29,6 @@ class HealthCustomServerTest extends Scope
$this->assertIsInt($response['body']['ping']);
$this->assertLessThan(100, $response['body']['ping']);
/**
* Test for FAILURE
*/
return [];
}
@ -51,10 +47,6 @@ class HealthCustomServerTest extends Scope
$this->assertIsInt($response['body']['statuses'][0]['ping']);
$this->assertLessThan(100, $response['body']['statuses'][0]['ping']);
/**
* Test for FAILURE
*/
return [];
}
@ -73,10 +65,6 @@ class HealthCustomServerTest extends Scope
$this->assertIsInt($response['body']['statuses'][0]['ping']);
$this->assertLessThan(100, $response['body']['statuses'][0]['ping']);
/**
* Test for FAILURE
*/
return [];
}
@ -95,10 +83,6 @@ class HealthCustomServerTest extends Scope
$this->assertIsInt($response['body']['statuses'][0]['ping']);
$this->assertLessThan(100, $response['body']['statuses'][0]['ping']);
/**
* Test for FAILURE
*/
return [];
}
@ -117,10 +101,6 @@ class HealthCustomServerTest extends Scope
$this->assertIsInt($response['body']['statuses'][0]['ping']);
$this->assertLessThan(100, $response['body']['statuses'][0]['ping']);
/**
* Test for FAILURE
*/
return [];
}
@ -141,10 +121,6 @@ class HealthCustomServerTest extends Scope
$this->assertNotEmpty($response['body']['localTime']);
$this->assertLessThan(10, $response['body']['diff']);
/**
* Test for FAILURE
*/
return [];
}
@ -162,10 +138,6 @@ class HealthCustomServerTest extends Scope
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
/**
* Test for FAILURE
*/
return [];
}
@ -183,10 +155,6 @@ class HealthCustomServerTest extends Scope
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
/**
* Test for FAILURE
*/
return [];
}
@ -204,9 +172,124 @@ class HealthCustomServerTest extends Scope
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
return [];
}
public function testFunctionsSuccess(): array
{
/**
* Test for FAILURE
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/functions', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
return [];
}
public function testBuildsSuccess(): array
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/builds', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
return [];
}
public function testDatabasesSuccess(): array
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/databases', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
return [];
}
public function testDeletesSuccess(): array
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/deletes', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
return [];
}
public function testMailsSuccess(): array
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/mails', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
return [];
}
public function testMessagingSuccess(): array
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/messaging', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
return [];
}
public function testMigrationsSuccess(): array
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/migrations', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
return [];
}
@ -226,10 +309,6 @@ class HealthCustomServerTest extends Scope
$this->assertIsInt($response['body']['ping']);
$this->assertLessThan(100, $response['body']['ping']);
/**
* Test for FAILURE
*/
return [];
}
@ -248,10 +327,6 @@ class HealthCustomServerTest extends Scope
$this->assertIsString($response['body']['status']);
$this->assertIsString($response['body']['version']);
/**
* Test for FAILURE
*/
return [];
}
}