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}', ], ], ];