diff --git a/.env b/.env index 09abb07be2..4e9f33ce4f 100644 --- a/.env +++ b/.env @@ -103,4 +103,9 @@ _APP_MESSAGE_SMS_TEST_DSN= _APP_MESSAGE_EMAIL_TEST_DSN= _APP_MESSAGE_PUSH_TEST_DSN= _APP_WEBHOOK_MAX_FAILED_ATTEMPTS=10 -_APP_PROJECT_REGIONS=default \ No newline at end of file +_APP_PROJECT_REGIONS=default + +_APP_DATABASE_PROXY_SECRET=secret-key +_APP_DATABASE_PROXY_CONNECTION=mariadb://user:password@mariadb:3306/appwrite?pool_size=256 +_APP_CONNECTIONS_DB_PROJECT=managed=mariadb-proxy://secret-key@database-proxy/appwrite +_APP_CONNECTIONS_DB_CONSOLE=db_fra1_v14x_01=mariadb-proxy://secret-key@database-proxy/appwrite \ No newline at end of file diff --git a/app/http.php b/app/http.php index 086260cb62..bbb9834371 100644 --- a/app/http.php +++ b/app/http.php @@ -77,6 +77,7 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg try { $attempts++; $dbForConsole = $app->getResource('dbForConsole'); + $dbForConsole->ping(); /** @var Utopia\Database\Database $dbForConsole */ break; // leave the do-while if successful } catch (\Throwable $e) { diff --git a/app/init.php b/app/init.php index 0ce44fa181..2249d5d40a 100644 --- a/app/init.php +++ b/app/init.php @@ -83,6 +83,7 @@ use Utopia\Validator\IP; use Utopia\Validator\URL; use Utopia\Validator\WhiteList; use Utopia\CLI\Console; +use Utopia\Database\Adapter\MariaDBProxy; use Utopia\Domains\Validator\PublicDomain; const APP_NAME = 'Appwrite'; @@ -759,13 +760,13 @@ $register->set('pools', function () { 'type' => 'database', 'dsns' => App::getEnv('_APP_CONNECTIONS_DB_CONSOLE', $fallbackForDB), 'multiple' => false, - 'schemes' => ['mariadb', 'mysql'], + 'schemes' => ['mariadb', 'mysql', 'mariadb-proxy'], ], 'database' => [ 'type' => 'database', 'dsns' => App::getEnv('_APP_CONNECTIONS_DB_PROJECT', $fallbackForDB), 'multiple' => true, - 'schemes' => ['mariadb', 'mysql'], + 'schemes' => ['mariadb', 'mysql', 'mariadb-proxy'], ], 'queue' => [ 'type' => 'queue', @@ -841,6 +842,14 @@ $register->set('pools', function () { * Resource assignment to an adapter will happen below. */ switch ($dsnScheme) { + case 'mariadb-proxy': + // Ignore port and password (user = password) + $resource = [ + 'endpoint' => 'http://' . $dsnHost . '/v1', + 'secret' => $dsnUser, + 'database' => $dsnDatabase + ]; + break; case 'mysql': case 'mariadb': $resource = function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { @@ -880,6 +889,7 @@ $register->set('pools', function () { $adapter = match ($dsn->getScheme()) { 'mariadb' => new MariaDB($resource()), 'mysql' => new MySQL($resource()), + 'mariadb-proxy' => new MariaDBProxy($resource['endpoint'], $resource['secret'], $resource['database']), default => null }; diff --git a/composer.json b/composer.json index 28dbde65be..6eb06efa50 100644 --- a/composer.json +++ b/composer.json @@ -44,13 +44,13 @@ "ext-sockets": "*", "appwrite/php-runtimes": "0.13.*", "appwrite/php-clamav": "2.0.*", - "utopia-php/abuse": "0.36.*", + "utopia-php/abuse": "dev-feat-database-proxy as 0.36.99", "utopia-php/analytics": "0.10.*", - "utopia-php/audit": "0.38.*", + "utopia-php/audit": "dev-feat-database-proxy as 0.38.99", "utopia-php/cache": "0.9.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.48.*", + "utopia-php/database": "0.49.*", "utopia-php/domains": "0.5.*", "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*", diff --git a/composer.lock b/composer.lock index 79509e7d12..7b1d614660 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "733cdc4128cc298318cf487442d3efed", + "content-hash": "76e3175bdffb16335168d35fc5322e8f", "packages": [ { "name": "adhocore/jwt", @@ -156,16 +156,16 @@ }, { "name": "appwrite/php-runtimes", - "version": "0.13.2", + "version": "0.13.3", "source": { "type": "git", "url": "https://github.com/appwrite/runtimes.git", - "reference": "214a37c2c66e0f2bc9c30fdfde66955d9fd084a1" + "reference": "5d93fc578a9a543bcdc9b2c0562d80a51d56c73d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/runtimes/zipball/214a37c2c66e0f2bc9c30fdfde66955d9fd084a1", - "reference": "214a37c2c66e0f2bc9c30fdfde66955d9fd084a1", + "url": "https://api.github.com/repos/appwrite/runtimes/zipball/5d93fc578a9a543bcdc9b2c0562d80a51d56c73d", + "reference": "5d93fc578a9a543bcdc9b2c0562d80a51d56c73d", "shasum": "" }, "require": { @@ -204,9 +204,9 @@ ], "support": { "issues": "https://github.com/appwrite/runtimes/issues", - "source": "https://github.com/appwrite/runtimes/tree/0.13.2" + "source": "https://github.com/appwrite/runtimes/tree/0.13.3" }, - "time": "2023-11-22T15:36:00+00:00" + "time": "2024-03-01T14:47:47+00:00" }, { "name": "beberlei/assert", @@ -1260,23 +1260,23 @@ }, { "name": "utopia-php/abuse", - "version": "0.36.0", + "version": "dev-feat-database-proxy", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "d3d09b4fa0db75935110714ad4b2a87f3ace31ed" + "reference": "5032d5220af527853e2d549e62be3f4ee2932db9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/d3d09b4fa0db75935110714ad4b2a87f3ace31ed", - "reference": "d3d09b4fa0db75935110714ad4b2a87f3ace31ed", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/5032d5220af527853e2d549e62be3f4ee2932db9", + "reference": "5032d5220af527853e2d549e62be3f4ee2932db9", "shasum": "" }, "require": { "ext-curl": "*", "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "0.48.*" + "utopia-php/database": "0.49.*" }, "require-dev": { "laravel/pint": "1.5.*", @@ -1303,9 +1303,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.36.0" + "source": "https://github.com/utopia-php/abuse/tree/feat-database-proxy" }, - "time": "2024-01-19T09:32:56+00:00" + "time": "2024-03-05T09:31:14+00:00" }, { "name": "utopia-php/analytics", @@ -1355,21 +1355,21 @@ }, { "name": "utopia-php/audit", - "version": "0.38.0", + "version": "dev-feat-database-proxy", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "a9067f4af76e8787f1d29850a8ec94fc32bb6539" + "reference": "973865837fd502f98e5762241ea0c0ebecf776f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/a9067f4af76e8787f1d29850a8ec94fc32bb6539", - "reference": "a9067f4af76e8787f1d29850a8ec94fc32bb6539", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/973865837fd502f98e5762241ea0c0ebecf776f2", + "reference": "973865837fd502f98e5762241ea0c0ebecf776f2", "shasum": "" }, "require": { "php": ">=8.0", - "utopia-php/database": "0.48.*" + "utopia-php/database": "0.49.*" }, "require-dev": { "laravel/pint": "1.5.*", @@ -1396,9 +1396,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.38.0" + "source": "https://github.com/utopia-php/audit/tree/feat-database-proxy" }, - "time": "2024-01-19T09:33:05+00:00" + "time": "2024-03-05T09:31:19+00:00" }, { "name": "utopia-php/cache", @@ -1552,16 +1552,16 @@ }, { "name": "utopia-php/database", - "version": "0.48.4", + "version": "0.49.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "02f20bd901b8fab26d7dc2c58f7da1d6a08d21c0" + "reference": "02000f01e9329b92251825fdccde023feb88a915" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/02f20bd901b8fab26d7dc2c58f7da1d6a08d21c0", - "reference": "02f20bd901b8fab26d7dc2c58f7da1d6a08d21c0", + "url": "https://api.github.com/repos/utopia-php/database/zipball/02000f01e9329b92251825fdccde023feb88a915", + "reference": "02000f01e9329b92251825fdccde023feb88a915", "shasum": "" }, "require": { @@ -1569,6 +1569,7 @@ "ext-pdo": "*", "php": ">=8.0", "utopia-php/cache": "0.9.*", + "utopia-php/fetch": "0.1.*", "utopia-php/framework": "0.33.*", "utopia-php/mongo": "0.3.*" }, @@ -1602,9 +1603,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.48.4" + "source": "https://github.com/utopia-php/database/tree/0.49.0" }, - "time": "2024-02-23T03:22:55+00:00" + "time": "2024-03-01T10:44:41+00:00" }, { "name": "utopia-php/domains", @@ -1713,6 +1714,45 @@ }, "time": "2023-11-02T12:01:43+00:00" }, + { + "name": "utopia-php/fetch", + "version": "0.1.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/fetch.git", + "reference": "2fa214b9262acd1a3583515a364da4f35929d5c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/fetch/zipball/2fa214b9262acd1a3583515a364da4f35929d5c5", + "reference": "2fa214b9262acd1a3583515a364da4f35929d5c5", + "shasum": "" + }, + "require": { + "php": ">=8.0" + }, + "require-dev": { + "laravel/pint": "^1.5.0", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Fetch\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A simple library that provides an interface for making HTTP Requests.", + "support": { + "issues": "https://github.com/utopia-php/fetch/issues", + "source": "https://github.com/utopia-php/fetch/tree/0.1.0" + }, + "time": "2023-10-10T11:58:32+00:00" + }, { "name": "utopia-php/framework", "version": "0.33.2", @@ -3136,20 +3176,21 @@ }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -3190,9 +3231,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -3531,16 +3578,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.30", + "version": "9.2.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "shasum": "" }, "require": { @@ -3597,7 +3644,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" }, "funding": [ { @@ -3605,7 +3652,7 @@ "type": "github" } ], - "time": "2023-12-22T06:47:57+00:00" + "time": "2024-03-02T06:37:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4003,16 +4050,16 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -4047,7 +4094,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -4055,7 +4102,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -4301,16 +4348,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -4355,7 +4402,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -4363,7 +4410,7 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -4430,16 +4477,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -4495,7 +4542,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -4503,20 +4550,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -4559,7 +4606,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -4567,7 +4614,7 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", @@ -5287,16 +5334,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -5325,7 +5372,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.2" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -5333,7 +5380,7 @@ "type": "github" } ], - "time": "2023-11-20T00:12:19+00:00" + "time": "2024-03-03T12:36:25+00:00" }, { "name": "twig/twig", @@ -5406,50 +5453,26 @@ } ], "time": "2023-11-21T18:54:41+00:00" - }, - { - "name": "utopia-php/fetch", - "version": "0.1.0", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/fetch.git", - "reference": "2fa214b9262acd1a3583515a364da4f35929d5c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/fetch/zipball/2fa214b9262acd1a3583515a364da4f35929d5c5", - "reference": "2fa214b9262acd1a3583515a364da4f35929d5c5", - "shasum": "" - }, - "require": { - "php": ">=8.0" - }, - "require-dev": { - "laravel/pint": "^1.5.0", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\Fetch\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A simple library that provides an interface for making HTTP Requests.", - "support": { - "issues": "https://github.com/utopia-php/fetch/issues", - "source": "https://github.com/utopia-php/fetch/tree/0.1.0" - }, - "time": "2023-10-10T11:58:32+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/abuse", + "version": "dev-feat-database-proxy", + "alias": "0.36.99", + "alias_normalized": "0.36.99.0" + }, + { + "package": "utopia-php/audit", + "version": "dev-feat-database-proxy", + "alias": "0.38.99", + "alias_normalized": "0.38.99.0" + } + ], "minimum-stability": "stable", "stability-flags": { + "utopia-php/abuse": 20, + "utopia-php/audit": 20, "appwrite/sdk-generator": 5 }, "prefer-stable": false, @@ -5475,5 +5498,5 @@ "platform-overrides": { "php": "8.2" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/docker-compose.yml b/docker-compose.yml index eacee76fca..f82d920e93 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -117,6 +117,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -230,6 +232,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -260,6 +264,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -287,6 +293,8 @@ services: - _APP_OPENSSL_KEY_V1 - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -326,6 +334,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -378,6 +388,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -413,6 +425,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -480,6 +494,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -510,6 +526,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -582,6 +600,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -618,6 +638,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -651,6 +673,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -682,6 +706,8 @@ services: - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -713,6 +739,8 @@ services: - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -748,6 +776,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -775,6 +805,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -806,6 +838,8 @@ services: - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -838,6 +872,8 @@ services: - _APP_REDIS_USER - _APP_REDIS_PASS - _APP_DB_HOST + - _APP_CONNECTIONS_DB_CONSOLE + - _APP_CONNECTIONS_DB_PROJECT - _APP_DB_PORT - _APP_DB_SCHEMA - _APP_DB_USER @@ -918,12 +954,29 @@ services: - OPR_PROXY_MAX_TIMEOUT=600 - OPR_PROXY_HEALTHCHECK=enabled + database-proxy: + container_name: database-proxy + image: appwrite/database-proxy:0.1.0 + build: + context: . + networks: + - appwrite + - database-proxy + ports: + - 9520:80 + environment: + - UTOPIA_DATA_API_ENV=$_APP_ENV + - UTOPIA_DATA_API_SECRET=$_APP_DATABASE_PROXY_SECRET + - UTOPIA_DATA_API_SECRET_CONNECTION=$_APP_DATABASE_PROXY_CONNECTION + - UTOPIA_DATA_API_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER + - UTOPIA_DATA_API_LOGGING_CONFIG=$_APP_LOGGING_CONFIG + mariadb: image: mariadb:10.11 # fix issues when upgrading using: mysql_upgrade -u root -p container_name: appwrite-mariadb <<: *x-logging networks: - - appwrite + - database-proxy volumes: - appwrite-mariadb:/var/lib/mysql:rw ports: @@ -1010,7 +1063,7 @@ services: ports: - 9506:8080 networks: - - appwrite + - database-proxy redis-insight: image: redis/redisinsight:latest @@ -1040,6 +1093,8 @@ networks: name: gateway appwrite: name: appwrite + database-proxy: + name: database-proxy runtimes: name: runtimes