From e47ecd5c37caeb5d887e136ab7552dccd47e2aff Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 29 Jul 2026 14:06:29 +0100 Subject: [PATCH 1/3] chore(ci): run MongoDB only where tests need it MariaDB, MongoDB and PostgreSQL had no compose profiles, so all three database containers started on every test run -- the existing COMPOSE_PROFILES values in CI were inert for them. Gate MariaDB and MongoDB behind their own profiles in the dev/CI override. PostgreSQL stays unprofiled because VectorsDB requires it unconditionally. Profiles live only in the override, so the compose file generated for self-hosted installs is unchanged. DocumentsDB pools reject any non-MongoDB DSN, so Mongo still runs for the four suites that exercise it, and in shared tables mode where boot connects every pool. Everything else -- 24 service suites, unit, general E2E, the grouped jobs and the benchmark -- now runs without it. Two workers defaulted depends_on to ${_APP_DB_HOST:-mariadb} while the rest of the file defaults to postgresql; with profiles active that stale default is a hard failure, so align it and drop the now-dead placeholders from the compose generator. Co-Authored-By: Claude Opus 5 (1M context) --- .env | 3 +++ .github/workflows/ci.yml | 24 ++++++++++++++++++----- docker-compose.override.yml | 4 ++++ docker-compose.yml | 4 ++-- src/Appwrite/Docker/Compose/Generator.php | 2 -- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.env b/.env index 8aa4e80ccb..df725cc8df 100644 --- a/.env +++ b/.env @@ -36,6 +36,9 @@ _APP_CONSOLE_COUNTRIES_DENYLIST=AQ _APP_CONSOLE_WHITELIST_EMAILS= _APP_CONSOLE_WHITELIST_IPS= _APP_CONSOLE_WHITELIST_ROOT=disabled +# MariaDB and MongoDB only start when their profile is listed here; PostgreSQL always +# runs because VectorsDB requires it. MongoDB is on by default for DocumentsDB. +COMPOSE_PROFILES=mongodb _APP_DB_ADAPTER=postgresql _APP_DB_HOST=postgresql _APP_DB_PORT=5432 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3949e832f..47ac2a493b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -196,7 +196,7 @@ jobs: { name: 'Account', runner: runner4, functional: true, processes: null }, { name: 'Avatars', runner: runner4, functional: true, processes: null }, { name: 'Console', runner: runner4, functional: true, processes: null }, - { name: 'Databases', runner: runner8, functional: false, processes: 3 }, + { name: 'Databases', runner: runner8, functional: false, processes: 3, documentsdb: true }, { name: 'TablesDB', runner: runner8, functional: false, processes: 3 }, { name: 'Functions', runner: runner4, functional: false, processes: null }, { name: 'FunctionsSchedule', runner: runner4, functional: true, processes: null }, @@ -204,8 +204,8 @@ jobs: { name: 'Health', runner: runner4, functional: true, processes: null }, { name: 'Advisor', runner: runner4, functional: true, processes: null }, { name: 'Locale', runner: runner4, functional: true, processes: null }, - { name: 'Projects', runner: runner4, functional: true, processes: null }, - { name: 'Realtime', runner: runner4, functional: false, processes: null }, + { name: 'Projects', runner: runner4, functional: true, processes: null, documentsdb: true }, + { name: 'Realtime', runner: runner4, functional: false, processes: null, documentsdb: true }, { name: 'Sites', runner: runner4, functional: true, processes: null }, { name: 'Proxy', runner: runner4, functional: true, processes: null }, { name: 'Storage', runner: runner4, functional: true, processes: null }, @@ -218,7 +218,7 @@ jobs: { name: 'VCSGitea', runner: runner4, functional: false, processes: null }, { name: 'Messaging', runner: runner4, functional: true, processes: null }, { name: 'Notifications', runner: runner4, functional: true, processes: null }, - { name: 'Migrations', runner: runner4, functional: true, processes: 1 }, + { name: 'Migrations', runner: runner4, functional: true, processes: 1, documentsdb: true }, { name: 'Project', runner: runner4, functional: true, processes: null }, { name: 'Presences', runner: runner4, functional: true, processes: null }, ]; @@ -298,6 +298,8 @@ jobs: permissions: contents: read packages: read + env: + COMPOSE_PROFILES: '' steps: - name: checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -354,6 +356,8 @@ jobs: permissions: contents: read packages: read + env: + COMPOSE_PROFILES: '' steps: - name: checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -452,6 +456,13 @@ jobs: echo "_APP_DB_PORT=5432" >> $GITHUB_ENV fi + # DocumentsDB is MongoDB-only, so Mongo runs alongside another primary just for + # the suites that use it, and in shared tables mode where boot connects every pool. + if [ "${{ matrix.database }}" != "MongoDB" ] \ + && { [ "${{ matrix.service.documentsdb }}" = "true" ] || [ "${{ matrix.mode }}" = "shared" ]; }; then + COMPOSE_PROFILES="${COMPOSE_PROFILES},mongodb" + fi + # Gitea runs alongside Appwrite only where VCS tests need it. if [ "${{ matrix.service.name }}" = "VCSGitea" ]; then COMPOSE_PROFILES="${COMPOSE_PROFILES},gitea" @@ -580,7 +591,8 @@ jobs: compose_profiles: antivirus wait: clamav env: - COMPOSE_PROFILES: ${{ matrix.config.compose_profiles }} + # Shared tables mode connects every pool at boot, including the MongoDB-only DocumentsDB. + COMPOSE_PROFILES: ${{ matrix.mode == 'shared' && format('mongodb,{0}', matrix.config.compose_profiles) || matrix.config.compose_profiles }} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -692,6 +704,8 @@ jobs: issues: write pull-requests: write packages: read + env: + COMPOSE_PROFILES: '' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 5049c71a7a..7aab6ab22d 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -484,9 +484,13 @@ services: aliases: - appwrite.test mariadb: + profiles: + - mariadb ports: - "9510:3306" mongodb: + profiles: + - mongodb ports: - "9511:27017" postgresql: diff --git a/docker-compose.yml b/docker-compose.yml index 55dc9b0c0e..e78d013fcc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -751,7 +751,7 @@ services: - appwrite depends_on: - redis - - ${_APP_DB_HOST:-mariadb} + - ${_APP_DB_HOST:-postgresql} environment: - _APP_ENV - _APP_WORKERS_NUM=1 @@ -796,7 +796,7 @@ services: - appwrite depends_on: - redis - - ${_APP_DB_HOST:-mariadb} + - ${_APP_DB_HOST:-postgresql} environment: - _APP_ENV - _APP_WORKER_PER_CORE diff --git a/src/Appwrite/Docker/Compose/Generator.php b/src/Appwrite/Docker/Compose/Generator.php index 2baed3f2f6..1f53ea42f1 100644 --- a/src/Appwrite/Docker/Compose/Generator.php +++ b/src/Appwrite/Docker/Compose/Generator.php @@ -56,8 +56,6 @@ class Generator ], 'placeholders' => [ '${_APP_DB_HOST:-postgresql}', - '${_APP_DB_HOST:-mongodb}', - '${_APP_DB_HOST:-mariadb}', ], ], ]; From d0c183b93c6fa48527f70e3193fcc21674b70e13 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 29 Jul 2026 14:15:54 +0100 Subject: [PATCH 2/3] fix(dev): point Adminer at the configured database Adminer was hardcoded to the mariadb host with MariaDB-only root credentials, so with MariaDB no longer starting by default the bundled UI opened onto a service that was not running. Follow _APP_DB_HOST/_APP_DB_ADAPTER/_APP_DB_USER/_APP_DB_PASS/ _APP_DB_SCHEMA instead, and pick the Adminer driver from the adapter -- "pgsql" for PostgreSQL, "server" for MySQL/MariaDB. Mongo primaries are served by mongo-express, which Adminer cannot talk to either way. Co-Authored-By: Claude Opus 5 (1M context) --- docker-compose.override.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 7aab6ab22d..25719a7096 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -400,10 +400,11 @@ services: - gateway environment: - ADMINER_DESIGN=pepa-linha - - ADMINER_DEFAULT_SERVER=mariadb - - ADMINER_DEFAULT_USERNAME=root - - ADMINER_DEFAULT_PASSWORD=rootsecretpassword - - ADMINER_DEFAULT_DB=appwrite + - ADMINER_DEFAULT_SERVER=${_APP_DB_HOST:-postgresql} + - ADMINER_DEFAULT_DRIVER=${_APP_DB_ADAPTER:-postgresql} + - ADMINER_DEFAULT_USERNAME=${_APP_DB_USER} + - ADMINER_DEFAULT_PASSWORD=${_APP_DB_PASS} + - ADMINER_DEFAULT_DB=${_APP_DB_SCHEMA} configs: - source: adminer-index.php target: /var/www/html/index.php @@ -556,7 +557,8 @@ configs: if(!count($$_GET)) { $$_POST['auth'] = [ 'server' => $$_ENV['ADMINER_DEFAULT_SERVER'], - 'driver' => 'server', /* seems to autodetect the driver from server settings */ + /* Adminer calls the MySQL/MariaDB driver "server". */ + 'driver' => $$_ENV['ADMINER_DEFAULT_DRIVER'] === 'postgresql' ? 'pgsql' : 'server', 'username' => $$_ENV['ADMINER_DEFAULT_USERNAME'], 'password' => $$_ENV['ADMINER_DEFAULT_PASSWORD'], 'db' => $$_ENV['ADMINER_DEFAULT_DB'], From 01a8df8d3d486fe3af870a4a5bf9dc5af37eb671 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 29 Jul 2026 14:15:54 +0100 Subject: [PATCH 3/3] fix(ci): keep benchmark stacks comparable The before stack is a worktree at an arbitrary older SHA, so its compose file need not gate databases at all. With an empty COMPOSE_PROFILES only the head side was constrained, leaving the before run carrying MariaDB and MongoDB as idle load and the after run without them -- the reported delta would include two fewer containers rather than the code change. Start the same superset on both sides. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47ac2a493b..d8b6be61b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -705,7 +705,10 @@ jobs: pull-requests: write packages: read env: - COMPOSE_PROFILES: '' + # The before stack is a worktree at an arbitrary older SHA, so its compose file + # may not gate databases at all. Start the superset on both sides, otherwise the + # two runs measure different amounts of idle container load rather than the diff. + COMPOSE_PROFILES: mariadb,mongodb steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2