mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Update Docker Compose to clarify MongoDB readiness check comment, addressing implications of template substitution limitations.
This commit is contained in:
+1
-1
@@ -89,7 +89,7 @@ services:
|
||||
- ./vendor/utopia-php/mongo/src:/usr/src/code/vendor/utopia-php/mongo/src
|
||||
- ./vendor/utopia-php/database/src:/usr/src/code/vendor/utopia-php/database/src
|
||||
depends_on:
|
||||
# we need to wait for the mongodb to be ready to avoid errors (what are the implications on mariadb? and also on the other services?)
|
||||
# we need to wait for the mongodb to be ready to avoid errors (what are the implications since we can't use template substitution here?)
|
||||
mongodb:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
|
||||
@@ -31,10 +31,11 @@ class Install extends Action
|
||||
->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true)
|
||||
->param('interactive', 'Y', new Text(1), 'Run an interactive session', true)
|
||||
->param('no-start', false, new Boolean(true), 'Run an interactive session', true)
|
||||
->param('database', 'mongodb', new Text(0), 'Database to use (mongodb|mariadb)', true)
|
||||
->callback($this->action(...));
|
||||
}
|
||||
|
||||
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void
|
||||
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void
|
||||
{
|
||||
$config = Config::getParam('variables');
|
||||
$defaultHTTPPort = '80';
|
||||
@@ -171,6 +172,11 @@ class Install extends Action
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($var['name'] === '_APP_DB_ADAPTER' && $data !== false) {
|
||||
$input[$var['name']] = $database;
|
||||
continue;
|
||||
}
|
||||
|
||||
$input[$var['name']] = Console::confirm($var['question'] . ' (default: \'' . $var['default'] . '\')');
|
||||
|
||||
if (empty($input[$var['name']])) {
|
||||
@@ -188,6 +194,15 @@ class Install extends Action
|
||||
}
|
||||
}
|
||||
|
||||
$database = $input['_APP_DB_ADAPTER'];
|
||||
if ($database === 'mongodb') {
|
||||
$input['_APP_DB_HOST'] = 'mongodb';
|
||||
$input['_APP_DB_PORT'] = 27017;
|
||||
} elseif ($database === 'mariadb') {
|
||||
$input['_APP_DB_HOST'] = 'mariadb';
|
||||
$input['_APP_DB_PORT'] = 3306;
|
||||
}
|
||||
|
||||
$templateForCompose = new View(__DIR__ . '/../../../../app/views/install/compose.phtml');
|
||||
$templateForEnv = new View(__DIR__ . '/../../../../app/views/install/env.phtml');
|
||||
|
||||
@@ -196,7 +211,8 @@ class Install extends Action
|
||||
->setParam('httpsPort', $httpsPort)
|
||||
->setParam('version', APP_VERSION_STABLE)
|
||||
->setParam('organization', $organization)
|
||||
->setParam('image', $image);
|
||||
->setParam('image', $image)
|
||||
->setParam('database', $database);
|
||||
|
||||
$templateForEnv->setParam('vars', $input);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Appwrite\Platform\Tasks;
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Validator\Boolean;
|
||||
use Utopia\Validator\Text;
|
||||
use Utopia\System\System;
|
||||
|
||||
class Upgrade extends Install
|
||||
{
|
||||
@@ -23,10 +24,11 @@ class Upgrade extends Install
|
||||
->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true)
|
||||
->param('interactive', 'Y', new Text(1), 'Run an interactive session', true)
|
||||
->param('no-start', false, new Boolean(true), 'Run an interactive session', true)
|
||||
->param('database', 'mongodb', new Text(length: 0), 'Database to use (mongodb|mariadb)', true)
|
||||
->callback($this->action(...));
|
||||
}
|
||||
|
||||
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void
|
||||
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void
|
||||
{
|
||||
// Check for previous installation
|
||||
$data = @file_get_contents($this->path . '/docker-compose.yml');
|
||||
@@ -39,6 +41,7 @@ class Upgrade extends Install
|
||||
Console::log(' └── docker-compose.yml');
|
||||
Console::exit(1);
|
||||
}
|
||||
parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart);
|
||||
$database = System::getEnv('_APP_DB_ADAPTER', 'mongodb');
|
||||
parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user