mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Add shared tables test infrastructure for documentsdb/vectorsdb
Add docker-compose.tests.yml with separate MongoDB and PostgreSQL containers for shared tables v1/v2 testing, .env.tests with multi-pool connection strings, and update CI workflow to pass documentsdb/vectorsdb shared tables env vars based on the test matrix mode.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# Environment variable overrides for CI tests
|
||||
# Provides multi-pool connections for documentsdb and vectorsdb shared tables testing
|
||||
|
||||
_APP_CONNECTIONS_DATABASE_DOCUMENTSDB=db_main=mongodb://user:password@mongodb:27017/appwrite,db_shared_v1=mongodb://user:password@mongodb-shared-tables-v1:27017/appwrite,db_shared_v2=mongodb://user:password@mongodb-shared-tables-v2:27017/appwrite
|
||||
_APP_DATABASE_DOCUMENTSDB_KEYS=documentsdb_db_main,documentsdb_db_shared_v1,documentsdb_db_shared_v2
|
||||
|
||||
_APP_CONNECTIONS_DATABASE_VECTORSDB=db_main=postgresql://user:password@postgresql:5432/appwrite,db_shared_v1=postgresql://user:password@postgresql-shared-tables-v1:5432/appwrite,db_shared_v2=postgresql://user:password@postgresql-shared-tables-v2:5432/appwrite
|
||||
_APP_DATABASE_VECTORSDB_KEYS=vectorsdb_db_main,vectorsdb_db_shared_v1,vectorsdb_db_shared_v2
|
||||
@@ -5,7 +5,7 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
COMPOSE_FILE: docker-compose.yml
|
||||
COMPOSE_FILE: docker-compose.yml:docker-compose.tests.yml
|
||||
IMAGE: appwrite-dev
|
||||
|
||||
on:
|
||||
@@ -460,10 +460,14 @@ jobs:
|
||||
_APP_BROWSER_HOST: http://invalid-browser/v1
|
||||
_APP_DATABASE_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'database_db_main' || '' }}
|
||||
_APP_DATABASE_SHARED_TABLES_V1: ${{ matrix.mode == 'shared_v1' && 'database_db_main' || '' }}
|
||||
_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'documentsdb_db_shared_v1,documentsdb_db_shared_v2' || '' }}
|
||||
_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES_V1: ${{ matrix.mode == 'shared_v1' && 'documentsdb_db_shared_v1' || '' }}
|
||||
_APP_DATABASE_VECTORSDB_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'vectorsdb_db_shared_v1,vectorsdb_db_shared_v2' || '' }}
|
||||
_APP_DATABASE_VECTORSDB_SHARED_TABLES_V1: ${{ matrix.mode == 'shared_v1' && 'vectorsdb_db_shared_v1' || '' }}
|
||||
run: |
|
||||
docker load --input /tmp/${{ env.IMAGE }}.tar
|
||||
docker compose pull --quiet --ignore-buildable
|
||||
docker compose up -d --quiet-pull --wait
|
||||
docker compose --env-file .env --env-file .env.tests pull --quiet --ignore-buildable
|
||||
docker compose --env-file .env --env-file .env.tests up -d --quiet-pull --wait
|
||||
|
||||
- name: Wait for Open Runtimes
|
||||
timeout-minutes: 3
|
||||
@@ -534,10 +538,14 @@ jobs:
|
||||
_APP_OPTIONS_ABUSE: enabled
|
||||
_APP_DATABASE_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'database_db_main' || '' }}
|
||||
_APP_DATABASE_SHARED_TABLES_V1: ${{ matrix.mode == 'shared_v1' && 'database_db_main' || '' }}
|
||||
_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'documentsdb_db_shared_v1,documentsdb_db_shared_v2' || '' }}
|
||||
_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES_V1: ${{ matrix.mode == 'shared_v1' && 'documentsdb_db_shared_v1' || '' }}
|
||||
_APP_DATABASE_VECTORSDB_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'vectorsdb_db_shared_v1,vectorsdb_db_shared_v2' || '' }}
|
||||
_APP_DATABASE_VECTORSDB_SHARED_TABLES_V1: ${{ matrix.mode == 'shared_v1' && 'vectorsdb_db_shared_v1' || '' }}
|
||||
run: |
|
||||
docker load --input /tmp/${{ env.IMAGE }}.tar
|
||||
docker compose pull --quiet --ignore-buildable
|
||||
docker compose up -d --quiet-pull --wait
|
||||
docker compose --env-file .env --env-file .env.tests pull --quiet --ignore-buildable
|
||||
docker compose --env-file .env --env-file .env.tests up -d --quiet-pull --wait
|
||||
|
||||
- name: Run tests
|
||||
uses: itznotabug/php-retry@v3
|
||||
@@ -591,10 +599,14 @@ jobs:
|
||||
env:
|
||||
_APP_DATABASE_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'database_db_main' || '' }}
|
||||
_APP_DATABASE_SHARED_TABLES_V1: ${{ matrix.mode == 'shared_v1' && 'database_db_main' || '' }}
|
||||
_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'documentsdb_db_shared_v1,documentsdb_db_shared_v2' || '' }}
|
||||
_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES_V1: ${{ matrix.mode == 'shared_v1' && 'documentsdb_db_shared_v1' || '' }}
|
||||
_APP_DATABASE_VECTORSDB_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'vectorsdb_db_shared_v1,vectorsdb_db_shared_v2' || '' }}
|
||||
_APP_DATABASE_VECTORSDB_SHARED_TABLES_V1: ${{ matrix.mode == 'shared_v1' && 'vectorsdb_db_shared_v1' || '' }}
|
||||
run: |
|
||||
docker load --input /tmp/${{ env.IMAGE }}.tar
|
||||
docker compose pull --quiet --ignore-buildable
|
||||
docker compose up -d --quiet-pull --wait
|
||||
docker compose --env-file .env --env-file .env.tests pull --quiet --ignore-buildable
|
||||
docker compose --env-file .env --env-file .env.tests up -d --quiet-pull --wait
|
||||
|
||||
- name: Wait for Open Runtimes
|
||||
timeout-minutes: 3
|
||||
@@ -668,6 +680,8 @@ jobs:
|
||||
run: docker compose down -v
|
||||
|
||||
- name: Installing latest version
|
||||
env:
|
||||
COMPOSE_FILE: docker-compose.yml
|
||||
run: |
|
||||
rm docker-compose.yml
|
||||
rm .env
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
# Test-specific containers for shared tables testing
|
||||
# Provides separate MongoDB and PostgreSQL instances for documentsdb/vectorsdb shared tables
|
||||
|
||||
x-logging: &x-logging
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-file: "5"
|
||||
max-size: "10m"
|
||||
|
||||
services:
|
||||
appwrite:
|
||||
depends_on:
|
||||
mongodb-shared-tables-v1:
|
||||
condition: service_healthy
|
||||
mongodb-shared-tables-v2:
|
||||
condition: service_healthy
|
||||
postgresql-shared-tables-v1:
|
||||
condition: service_healthy
|
||||
postgresql-shared-tables-v2:
|
||||
condition: service_healthy
|
||||
|
||||
appwrite-realtime:
|
||||
depends_on:
|
||||
mongodb-shared-tables-v1:
|
||||
condition: service_healthy
|
||||
mongodb-shared-tables-v2:
|
||||
condition: service_healthy
|
||||
postgresql-shared-tables-v1:
|
||||
condition: service_healthy
|
||||
postgresql-shared-tables-v2:
|
||||
condition: service_healthy
|
||||
|
||||
mongodb-shared-tables-v1:
|
||||
image: mongo:8.2.5
|
||||
container_name: appwrite-mongodb-shared-tables-v1
|
||||
<<: *x-logging
|
||||
networks:
|
||||
- appwrite
|
||||
volumes:
|
||||
- appwrite-mongodb-shared-tables-v1:/data/db
|
||||
- appwrite-mongodb-shared-tables-v1-keyfile:/data/keyfile
|
||||
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
|
||||
- ./mongo-entrypoint.sh:/mongo-entrypoint.sh:ro
|
||||
ports:
|
||||
- "27018:27017"
|
||||
environment:
|
||||
- MONGO_INITDB_ROOT_USERNAME=root
|
||||
- MONGO_INITDB_ROOT_PASSWORD=${_APP_DB_ROOT_PASS}
|
||||
- MONGO_INITDB_DATABASE=${_APP_DB_SCHEMA}
|
||||
- MONGO_INITDB_USERNAME=${_APP_DB_USER}
|
||||
- MONGO_INITDB_PASSWORD=${_APP_DB_PASS}
|
||||
entrypoint: ["/bin/bash", "/mongo-entrypoint.sh"]
|
||||
healthcheck:
|
||||
test: |
|
||||
bash -c "
|
||||
if mongosh -u root -p ${_APP_DB_ROOT_PASS} --authenticationDatabase admin --quiet --eval 'rs.status().ok' 2>/dev/null | grep -q 1; then
|
||||
exit 0
|
||||
else
|
||||
mongosh -u root -p ${_APP_DB_ROOT_PASS} --authenticationDatabase admin --quiet --eval \"
|
||||
rs.initiate({_id: 'rs0', members: [{_id: 0, host: 'appwrite-mongodb-shared-tables-v1:27017'}]})
|
||||
\" 2>/dev/null || exit 1
|
||||
fi
|
||||
"
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
|
||||
mongodb-shared-tables-v2:
|
||||
image: mongo:8.2.5
|
||||
container_name: appwrite-mongodb-shared-tables-v2
|
||||
<<: *x-logging
|
||||
networks:
|
||||
- appwrite
|
||||
volumes:
|
||||
- appwrite-mongodb-shared-tables-v2:/data/db
|
||||
- appwrite-mongodb-shared-tables-v2-keyfile:/data/keyfile
|
||||
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
|
||||
- ./mongo-entrypoint.sh:/mongo-entrypoint.sh:ro
|
||||
ports:
|
||||
- "27019:27017"
|
||||
environment:
|
||||
- MONGO_INITDB_ROOT_USERNAME=root
|
||||
- MONGO_INITDB_ROOT_PASSWORD=${_APP_DB_ROOT_PASS}
|
||||
- MONGO_INITDB_DATABASE=${_APP_DB_SCHEMA}
|
||||
- MONGO_INITDB_USERNAME=${_APP_DB_USER}
|
||||
- MONGO_INITDB_PASSWORD=${_APP_DB_PASS}
|
||||
entrypoint: ["/bin/bash", "/mongo-entrypoint.sh"]
|
||||
healthcheck:
|
||||
test: |
|
||||
bash -c "
|
||||
if mongosh -u root -p ${_APP_DB_ROOT_PASS} --authenticationDatabase admin --quiet --eval 'rs.status().ok' 2>/dev/null | grep -q 1; then
|
||||
exit 0
|
||||
else
|
||||
mongosh -u root -p ${_APP_DB_ROOT_PASS} --authenticationDatabase admin --quiet --eval \"
|
||||
rs.initiate({_id: 'rs0', members: [{_id: 0, host: 'appwrite-mongodb-shared-tables-v2:27017'}]})
|
||||
\" 2>/dev/null || exit 1
|
||||
fi
|
||||
"
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
|
||||
postgresql-shared-tables-v1:
|
||||
image: appwrite/postgres:0.1.0
|
||||
container_name: appwrite-postgresql-shared-tables-v1
|
||||
<<: *x-logging
|
||||
networks:
|
||||
- appwrite
|
||||
volumes:
|
||||
- appwrite-postgresql-shared-tables-v1:/var/lib/postgresql/18/data:rw
|
||||
ports:
|
||||
- "5433:5432"
|
||||
environment:
|
||||
- POSTGRES_DB=${_APP_DB_SCHEMA}
|
||||
- POSTGRES_USER=${_APP_DB_USER}
|
||||
- POSTGRES_PASSWORD=${_APP_DB_PASS}
|
||||
command: postgres -c 'max_connections=500'
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${_APP_DB_USER} -d ${_APP_DB_SCHEMA}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
|
||||
postgresql-shared-tables-v2:
|
||||
image: appwrite/postgres:0.1.0
|
||||
container_name: appwrite-postgresql-shared-tables-v2
|
||||
<<: *x-logging
|
||||
networks:
|
||||
- appwrite
|
||||
volumes:
|
||||
- appwrite-postgresql-shared-tables-v2:/var/lib/postgresql/18/data:rw
|
||||
ports:
|
||||
- "5434:5432"
|
||||
environment:
|
||||
- POSTGRES_DB=${_APP_DB_SCHEMA}
|
||||
- POSTGRES_USER=${_APP_DB_USER}
|
||||
- POSTGRES_PASSWORD=${_APP_DB_PASS}
|
||||
command: postgres -c 'max_connections=500'
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${_APP_DB_USER} -d ${_APP_DB_SCHEMA}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
|
||||
networks:
|
||||
appwrite:
|
||||
name: appwrite
|
||||
|
||||
volumes:
|
||||
appwrite-mongodb-shared-tables-v1:
|
||||
appwrite-mongodb-shared-tables-v1-keyfile:
|
||||
appwrite-mongodb-shared-tables-v2:
|
||||
appwrite-mongodb-shared-tables-v2-keyfile:
|
||||
appwrite-postgresql-shared-tables-v1:
|
||||
appwrite-postgresql-shared-tables-v2:
|
||||
Reference in New Issue
Block a user