From f0e6105ba0ffa6539360f79557c3c448cf88d15a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 13 Feb 2026 07:27:21 +1300 Subject: [PATCH] fix: Use Docker Compose profiles to isolate database containers in CI - Add profiles to database services (mariadb, mongodb, postgresql) so only the needed database starts per CI job, freeing resources for the executor - Increase Sites deployment activation timeouts from 50-100s to 200s for MongoDB compatibility - Increase SSR logs polling timeout from 30s to 120s Co-Authored-By: Claude Opus 4.6 --- .env | 1 + .github/workflows/tests.yml | 4 +++- docker-compose.yml | 4 ++++ tests/e2e/Services/Sites/SitesBase.php | 2 +- tests/e2e/Services/Sites/SitesCustomServerTest.php | 8 ++++---- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.env b/.env index 2d9a5ed8fd..dfa53ec54c 100644 --- a/.env +++ b/.env @@ -38,6 +38,7 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= +COMPOSE_PROFILES=mongodb _APP_DB_ADAPTER=mongodb _APP_DB_HOST=mongodb _APP_DB_PORT=27017 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1fe10b5b1a..eceac487a7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -229,7 +229,9 @@ jobs: docker load --input /tmp/${{ env.IMAGE }}.tar sed -i 's|^_APP_BROWSER_HOST=.*|_APP_BROWSER_HOST=http://invalid-browser/v1|' .env - # Set DB Adapter in .env before starting services + # Set DB Adapter and Compose profile in .env before starting services + DB_ADAPTER_LOWER=$(echo "${{ matrix.db_adapter }}" | tr 'A-Z' 'a-z') + sed -i "s|^COMPOSE_PROFILES=.*|COMPOSE_PROFILES=${DB_ADAPTER_LOWER}|" .env if [ "${{ matrix.db_adapter }}" = "MARIADB" ]; then sed -i 's|^_APP_DB_ADAPTER=.*|_APP_DB_ADAPTER=mariadb|' .env sed -i 's|^_APP_DB_HOST=.*|_APP_DB_HOST=mariadb|' .env diff --git a/docker-compose.yml b/docker-compose.yml index 6b39747268..9770e3763e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1225,6 +1225,7 @@ services: start_period: 5s mariadb: + profiles: ["mariadb"] image: mariadb:10.11 # fix issues when upgrading using: mysql_upgrade -u root -p container_name: appwrite-mariadb <<: *x-logging @@ -1243,6 +1244,7 @@ services: command: "mysqld --innodb-flush-method=fsync" mongodb: + profiles: ["mongodb"] image: mongo:8.2.5 container_name: appwrite-mongodb <<: *x-logging @@ -1279,6 +1281,7 @@ services: start_period: 30s appwrite-mongo-express: + profiles: ["mongodb"] image: mongo-express container_name: appwrite-mongo-express networks: @@ -1293,6 +1296,7 @@ services: - mongodb postgresql: + profiles: ["postgresql"] build: context: ./tests/resources/postgresql args: diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index 67759299d4..5fc0d40fec 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -76,7 +76,7 @@ trait SitesBase 'x-appwrite-key' => $this->getProject()['apiKey'], ])); $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); - }, 100000, 500); + }, 200000, 500); } return $deploymentId; diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index c40f591924..60fd06ac98 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -1584,7 +1584,7 @@ class SitesCustomServerTest extends Scope $this->assertEventually(function () use ($siteId) { $site = $this->getSite($siteId); $this->assertNotEmpty($site['body']['deploymentId']); - }, 50000, 500); + }, 200000, 500); $domain = $this->setupSiteDomain($siteId); $proxyClient = new Client(); @@ -1655,7 +1655,7 @@ class SitesCustomServerTest extends Scope $this->assertEventually(function () use ($siteId) { $site = $this->getSite($siteId); $this->assertNotEmpty($site['body']['deploymentId']); - }, 50000, 500); + }, 200000, 500); $domain = $this->setupSiteDomain($siteId); $proxyClient = new Client(); @@ -1733,7 +1733,7 @@ class SitesCustomServerTest extends Scope $this->assertEventually(function () use ($siteId) { $site = $this->getSite($siteId); $this->assertNotEmpty($site['body']['deploymentId']); - }, 50000, 500); + }, 200000, 500); $domain = $this->setupSiteDomain($siteId); $proxyClient = new Client(); @@ -2064,7 +2064,7 @@ class SitesCustomServerTest extends Scope // Poll for execution logs to be written (async) $logs = null; - $timeout = 30; + $timeout = 120; $start = \time(); while (\time() - $start < $timeout) { $logs = $this->listLogs($siteId, [