From a5c1d4215fce0cf96bd93e9471c9f1d5e74bffa9 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 31 Aug 2026 15:42:30 +0530 Subject: [PATCH 1/3] Enable embedding service in Docker Compose and update profiles --- .env | 3 ++- docker-compose.yml | 15 ++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/.env b/.env index 3ff3672e3d..3a7b868566 100644 --- a/.env +++ b/.env @@ -47,7 +47,8 @@ _APP_CONSOLE_GOOGLE_APP_ID= _APP_CONSOLE_GOOGLE_SECRET= # 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 +# The embedding service is resource-heavy; drop 'embedding' here to disable it. +COMPOSE_PROFILES=mongodb,embedding _APP_DB_ADAPTER=postgresql _APP_DB_HOST=postgresql _APP_DB_PORT=5432 diff --git a/docker-compose.yml b/docker-compose.yml index c709dc73e5..494923b43e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -75,7 +75,6 @@ services: depends_on: - redis - ${_APP_DB_HOST:-postgresql} - - appwrite-embedding - appwrite-geo environment: - _APP_ENV @@ -309,7 +308,6 @@ services: depends_on: - ${_APP_DB_HOST:-postgresql} - redis - - appwrite-embedding environment: - _APP_ENV - _APP_USAGE_STATS @@ -368,7 +366,6 @@ services: depends_on: - redis - ${_APP_DB_HOST:-postgresql} - - appwrite-embedding volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -532,7 +529,6 @@ services: depends_on: - ${_APP_DB_HOST:-postgresql} - redis - - appwrite-embedding environment: - _APP_ENV - _APP_USAGE_STATS @@ -610,7 +606,6 @@ services: depends_on: - redis - ${_APP_DB_HOST:-postgresql} - - appwrite-embedding environment: - _APP_ENV - _APP_WORKERS_NUM=1 @@ -650,7 +645,6 @@ services: depends_on: - redis - ${_APP_DB_HOST:-postgresql} - - appwrite-embedding volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -735,7 +729,6 @@ services: depends_on: - redis - ${_APP_DB_HOST:-postgresql} - - appwrite-embedding environment: - _APP_ENV - _APP_WORKERS_NUM=1 @@ -794,7 +787,6 @@ services: depends_on: - redis - ${_APP_DB_HOST:-postgresql} - - appwrite-embedding environment: - _APP_ENV - _APP_WORKERS_NUM=1 @@ -1002,7 +994,6 @@ services: depends_on: - redis - ${_APP_DB_HOST:-postgresql} - - appwrite-embedding volumes: - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw @@ -1052,7 +1043,6 @@ services: depends_on: - redis - ${_APP_DB_HOST:-postgresql} - - appwrite-embedding environment: - _APP_ENV - _APP_WORKERS_NUM=1 @@ -1451,7 +1441,6 @@ services: depends_on: - ${_APP_DB_HOST:-postgresql} - redis - - appwrite-embedding environment: - _APP_ENV - _APP_LOGGING_FORMAT @@ -1494,7 +1483,6 @@ services: depends_on: - ${_APP_DB_HOST:-postgresql} - redis - - appwrite-embedding environment: - _APP_ENV - _APP_LOGGING_FORMAT @@ -1536,7 +1524,6 @@ services: depends_on: - ${_APP_DB_HOST:-postgresql} - redis - - appwrite-embedding environment: - _APP_ENV - _APP_LOGGING_FORMAT @@ -1793,6 +1780,8 @@ services: - full_page_writes=off appwrite-embedding: image: appwrite/embedding:0.1.0 + profiles: + - embedding environment: EMBEDDING_MODELS: ${_APP_EMBEDDING_MODELS:-nomic-embed-text} container_name: appwrite-embedding From e11e21a23a146d5d49334409c962696edc87a652 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 31 Aug 2026 16:00:02 +0530 Subject: [PATCH 2/3] Gate embeddings API behind _APP_EMBEDDING, default off The embedding container is resource-heavy and now sits behind the "embedding" Compose profile, so a stock installer deployment does not start it. Left as-is, the /v1/embeddings/text route stayed reachable and failed against an absent host. Mirror the DocumentsDB/VectorsDB pattern (#13411): add _APP_EMBEDDING (default disabled) and return GENERAL_SERVICE_DISABLED from the embeddings namespace until an operator starts the container and enables the flag. CI enables both for the Databases suite, which exercises the embeddings routes. Co-Authored-By: Claude Opus 4.8 --- .env | 6 ++++-- .github/workflows/ci.yml | 9 ++++++++- app/config/variables.php | 9 +++++++++ app/controllers/shared/api.php | 6 ++++-- docker-compose.yml | 4 ++++ 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 3a7b868566..b6aa02a20e 100644 --- a/.env +++ b/.env @@ -47,8 +47,9 @@ _APP_CONSOLE_GOOGLE_APP_ID= _APP_CONSOLE_GOOGLE_SECRET= # 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. -# The embedding service is resource-heavy; drop 'embedding' here to disable it. -COMPOSE_PROFILES=mongodb,embedding +# The embedding service is resource-heavy and off by default; add 'embedding' here and +# set _APP_EMBEDDING=enabled below to turn it on. +COMPOSE_PROFILES=mongodb _APP_DB_ADAPTER=postgresql _APP_DB_HOST=postgresql _APP_DB_PORT=5432 @@ -68,6 +69,7 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_USER= _APP_REDIS_PASS= +_APP_EMBEDDING=disabled _APP_EMBEDDING_ENDPOINT='http://appwrite-embedding:3000/embed' _APP_EMBEDDING_MODELS=nomic-embed-text _APP_EMBEDDING_TIMEOUT=30000 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a56b7fc26..0a84d860a7 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, documentsdb: true }, + { name: 'Databases', runner: runner8, functional: false, processes: 3, documentsdb: true, embedding: 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 }, @@ -469,6 +469,13 @@ jobs: COMPOSE_PROFILES="${COMPOSE_PROFILES},gitea" fi + # The embedding container is resource-heavy and off by default, so start it and + # enable the API only for the suites that exercise the embeddings routes. + if [ "${{ matrix.service.embedding }}" = "true" ]; then + COMPOSE_PROFILES="${COMPOSE_PROFILES},embedding" + echo "_APP_EMBEDDING=enabled" >> $GITHUB_ENV + fi + echo "COMPOSE_PROFILES=${COMPOSE_PROFILES}" >> $GITHUB_ENV - name: Login to Docker Hub diff --git a/app/config/variables.php b/app/config/variables.php index e21b086f92..dc2c9fbd46 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -706,6 +706,15 @@ return [ 'question' => '', 'filter' => '' ], + [ + 'name' => '_APP_EMBEDDING', + 'description' => 'Enables the embeddings API, backed by the resource-heavy appwrite-embedding container. That container is off by default (it is behind the "embedding" Compose profile), so start it and add "embedding" to COMPOSE_PROFILES before enabling this; until then the /v1/embeddings routes return a service disabled error. Default value is: disabled.', + 'introduction' => '2.0.0', + 'default' => 'disabled', + 'required' => false, + 'question' => '', + 'filter' => '' + ], ], ], [ diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 53bb02dd49..9f26dab32c 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -463,12 +463,14 @@ Http::init() // DocumentsDB runs only on MongoDB and VectorsDB only on PostgreSQL, while an // installation deploys just the engine backing the platform, so neither is on - // until an operator provisions that engine and says so. Closed to everyone -- + // until an operator provisions that engine and says so. Embeddings is the same: + // its container is resource-heavy and off by default. Closed to everyone -- // keys and privileged roles included -- rather than answering and then failing - // on the first write with the reason only in the logs. + // against an absent service with the reason only in the logs. $products = [ 'documentsdb' => '_APP_DOCUMENTSDB', 'vectorsdb' => '_APP_VECTORSDB', + 'embeddings' => '_APP_EMBEDDING', ]; if ( isset($products[$namespace]) diff --git a/docker-compose.yml b/docker-compose.yml index 494923b43e..a66eeef978 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -254,6 +254,7 @@ services: - _APP_LIMIT_DATABASE_BATCH - _APP_DOCUMENTSDB - _APP_VECTORSDB + - _APP_EMBEDDING appwrite-console: logging: driver: json-file @@ -349,6 +350,7 @@ services: - _APP_LIMIT_DATABASE_BATCH - _APP_DOCUMENTSDB - _APP_VECTORSDB + - _APP_EMBEDDING - _APP_POOL_ADAPTER=swoole appwrite-worker: @@ -513,6 +515,7 @@ services: - _APP_LIMIT_DATABASE_BATCH - _APP_DOCUMENTSDB - _APP_VECTORSDB + - _APP_EMBEDDING appwrite-task-scheduler: entrypoint: schedule @@ -767,6 +770,7 @@ services: - _APP_LIMIT_DATABASE_BATCH - _APP_DOCUMENTSDB - _APP_VECTORSDB + - _APP_EMBEDDING appwrite-worker-builds: profiles: - separate From 1835bf6115caa597496800191cc9b7ec3a064b42 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 4 Sep 2026 15:56:56 +0100 Subject: [PATCH 3/3] fix: keep the embeddings API on for installations that already run it The gate defaulted _APP_EMBEDDING to disabled, so an upgrade with a pre-change .env turned every embeddings request into a service disabled error even though the container had been running. Default the API to enabled and leave only the resource-heavy container behind the Compose profile. --- .env | 4 ++-- app/config/variables.php | 4 ++-- app/controllers/shared/api.php | 16 +++++++++------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.env b/.env index ca05930caf..d015689eab 100644 --- a/.env +++ b/.env @@ -48,8 +48,8 @@ _APP_CONSOLE_GOOGLE_APP_ID= _APP_CONSOLE_GOOGLE_SECRET= # 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. -# The embedding service is resource-heavy and off by default; add 'embedding' here and -# set _APP_EMBEDDING=enabled below to turn it on. +# The embedding container is resource-heavy and off by default; add 'embedding' here to +# start it. The embeddings API is on by default and is switched off below until then. COMPOSE_PROFILES=mongodb _APP_DB_ADAPTER=postgresql _APP_DB_HOST=postgresql diff --git a/app/config/variables.php b/app/config/variables.php index 4bfee0f80e..9b758e39f4 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -717,9 +717,9 @@ return [ ], [ 'name' => '_APP_EMBEDDING', - 'description' => 'Enables the embeddings API, backed by the resource-heavy appwrite-embedding container. That container is off by default (it is behind the "embedding" Compose profile), so start it and add "embedding" to COMPOSE_PROFILES before enabling this; until then the /v1/embeddings routes return a service disabled error. Default value is: disabled.', + 'description' => 'Enables the embeddings API, backed by the resource-heavy appwrite-embedding container. That container sits behind the "embedding" Compose profile, so add "embedding" to COMPOSE_PROFILES to start it. Set this to "disabled" to have the /v1/embeddings routes return a service disabled error instead of reaching for the container. Default value is: enabled.', 'introduction' => '2.0.0', - 'default' => 'disabled', + 'default' => 'enabled', 'required' => false, 'question' => '', 'filter' => '' diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 9f26dab32c..96d1ccd7d5 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -463,18 +463,20 @@ Http::init() // DocumentsDB runs only on MongoDB and VectorsDB only on PostgreSQL, while an // installation deploys just the engine backing the platform, so neither is on - // until an operator provisions that engine and says so. Embeddings is the same: - // its container is resource-heavy and off by default. Closed to everyone -- + // until an operator provisions that engine and says so. Closed to everyone -- // keys and privileged roles included -- rather than answering and then failing - // against an absent service with the reason only in the logs. + // against an absent service with the reason only in the logs. Embeddings ran + // on every installation before it had a switch, so it stays on unless an + // operator turns it off; the resource-heavy container is what sits behind a + // Compose profile. $products = [ - 'documentsdb' => '_APP_DOCUMENTSDB', - 'vectorsdb' => '_APP_VECTORSDB', - 'embeddings' => '_APP_EMBEDDING', + 'documentsdb' => ['_APP_DOCUMENTSDB', 'disabled'], + 'vectorsdb' => ['_APP_VECTORSDB', 'disabled'], + 'embeddings' => ['_APP_EMBEDDING', 'enabled'], ]; if ( isset($products[$namespace]) - && System::getEnv($products[$namespace], 'disabled') !== 'enabled' + && System::getEnv(...$products[$namespace]) !== 'enabled' ) { throw new Exception(Exception::GENERAL_SERVICE_DISABLED); }