mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: revert unintentional changes from rebase conflict resolution
Restore docker-compose.yml, Install.php, VectorsDB.php, and progress.js to match 1.9.x — these were accidentally modified during the rebase. https://claude.ai/code/session_01JLPDurUgyj7qViA8JqQFTH
This commit is contained in:
@@ -1074,7 +1074,9 @@
|
||||
if (existingInstallId) {
|
||||
resumeInstall(existingInstallId).then((resumed) => {
|
||||
if (!resumed) {
|
||||
startFreshInstall();
|
||||
clearInstallId?.();
|
||||
clearInstallLock?.();
|
||||
window.location.href = '/?step=1';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
+1
-15
@@ -254,7 +254,7 @@ services:
|
||||
appwrite-console:
|
||||
<<: *x-logging
|
||||
container_name: appwrite-console
|
||||
image: appwrite/console:7.5.7
|
||||
image: appwrite/console:7.8.26
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
@@ -1320,20 +1320,6 @@ services:
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
|
||||
appwrite-mongo-express:
|
||||
image: mongo-express
|
||||
container_name: appwrite-mongo-express
|
||||
networks:
|
||||
- appwrite
|
||||
ports:
|
||||
- "8082:8081"
|
||||
environment:
|
||||
ME_CONFIG_MONGODB_URL: "mongodb://root:${_APP_DB_ROOT_PASS}@appwrite-mongodb:27017/?replicaSet=rs0&directConnection=true"
|
||||
ME_CONFIG_BASICAUTH_USERNAME: ${_APP_DB_USER}
|
||||
ME_CONFIG_BASICAUTH_PASSWORD: ${_APP_DB_PASS}
|
||||
depends_on:
|
||||
- mongodb
|
||||
|
||||
postgresql:
|
||||
image: appwrite/postgres:0.1.0
|
||||
container_name: appwrite-postgresql
|
||||
|
||||
@@ -10,6 +10,7 @@ use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Bul
|
||||
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Create as CreateDocument;
|
||||
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Delete as DeleteDocument;
|
||||
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Get as GetDocument;
|
||||
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Logs\XList as ListDocumentLogs;
|
||||
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Update as UpdateDocument;
|
||||
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Upsert as UpsertDocument;
|
||||
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\XList as ListDocuments;
|
||||
@@ -91,6 +92,7 @@ class VectorsDB extends Base
|
||||
$service->addAction(UpdateDocuments::getName(), new UpdateDocuments());
|
||||
$service->addAction(UpsertDocuments::getName(), new UpsertDocuments());
|
||||
$service->addAction(DeleteDocuments::getName(), new DeleteDocuments());
|
||||
$service->addAction(ListDocumentLogs::getName(), new ListDocumentLogs());
|
||||
}
|
||||
|
||||
private function registerTransactionActions(Service $service): void
|
||||
|
||||
@@ -170,9 +170,9 @@ class Install extends Action
|
||||
}
|
||||
}
|
||||
|
||||
// Block database type changes on existing installations.
|
||||
// Only enforce if the existing config explicitly set _APP_DB_ADAPTER
|
||||
// (pre-1.9.0 installs never had this variable).
|
||||
// Detect database type from existing installation.
|
||||
// 1.9.0+ installs have _APP_DB_ADAPTER; pre-1.9.0 installs
|
||||
// can be detected by the DB service name or _APP_DB_HOST.
|
||||
$existingDatabase = null;
|
||||
foreach ($compose->getServices() as $service) {
|
||||
if (!$service) {
|
||||
@@ -191,10 +191,15 @@ class Install extends Action
|
||||
$existingDatabase = (new Env($rawEnv))->list()['_APP_DB_ADAPTER'] ?? null;
|
||||
}
|
||||
}
|
||||
if ($existingDatabase !== null && $existingDatabase !== $database) {
|
||||
Console::error("Cannot change database type from '{$existingDatabase}' to '{$database}'.");
|
||||
Console::error('Changing database types on an existing installation is not supported.');
|
||||
Console::exit(1);
|
||||
if ($existingDatabase === null) {
|
||||
$existingDatabase = $this->detectDatabaseFromCompose($compose);
|
||||
}
|
||||
if ($existingDatabase !== null) {
|
||||
if ($existingDatabase !== $database) {
|
||||
$database = $existingDatabase;
|
||||
Console::info("Detected existing database: {$database}");
|
||||
}
|
||||
$vars['_APP_DB_ADAPTER']['default'] = $database;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +216,8 @@ class Install extends Action
|
||||
Console::info('Open your browser at: http://localhost:' . InstallerServer::INSTALLER_WEB_PORT);
|
||||
Console::info('Press Ctrl+C to cancel installation');
|
||||
|
||||
$this->startWebServer($defaultHttpPort, $defaultHttpsPort, $organization, $image, $noStart, $vars);
|
||||
$detectedDb = ($existingInstallation && isset($existingDatabase)) ? $existingDatabase : null;
|
||||
$this->startWebServer($defaultHttpPort, $defaultHttpsPort, $organization, $image, $noStart, $vars, $isUpgrade, $detectedDb);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -614,6 +620,9 @@ class Install extends Action
|
||||
$domain = $input['_APP_DOMAIN'] ?? 'localhost';
|
||||
|
||||
$healthStep = $isUpgrade ? InstallerServer::STEP_DOCKER_CONTAINERS : InstallerServer::STEP_ACCOUNT_SETUP;
|
||||
if (!$isUpgrade) {
|
||||
$currentStep = InstallerServer::STEP_ACCOUNT_SETUP;
|
||||
}
|
||||
$apiUrl = $this->waitForApiReady($domain, $httpPort, $isLocalInstall, $progress, $healthStep);
|
||||
|
||||
if ($isUpgrade) {
|
||||
@@ -621,7 +630,6 @@ class Install extends Action
|
||||
}
|
||||
|
||||
if (!$isUpgrade) {
|
||||
$currentStep = InstallerServer::STEP_ACCOUNT_SETUP;
|
||||
$this->createInitialAdminAccount($account, $progress, $apiUrl, $domain);
|
||||
}
|
||||
|
||||
@@ -1088,24 +1096,56 @@ class Install extends Action
|
||||
return ['output' => [], 'exit' => 1];
|
||||
}
|
||||
|
||||
while (($line = fgets($pipes[1])) !== false) {
|
||||
$trimmed = rtrim($line, "\n\r");
|
||||
$output[] = $trimmed;
|
||||
stream_set_blocking($pipes[1], false);
|
||||
$deadline = time() + self::PROC_CLOSE_TIMEOUT_SECONDS;
|
||||
$buffer = '';
|
||||
|
||||
if (str_contains($trimmed, 'Container') && (str_contains($trimmed, 'Started') || str_contains($trimmed, 'Running'))) {
|
||||
$started = min($started + 1, $totalServices);
|
||||
if ($totalServices > 0) {
|
||||
try {
|
||||
$progress(
|
||||
InstallerServer::STEP_DOCKER_CONTAINERS,
|
||||
InstallerServer::STATUS_IN_PROGRESS,
|
||||
$message,
|
||||
['containerStarted' => $started, 'containerTotal' => $totalServices]
|
||||
);
|
||||
} catch (\Throwable) {
|
||||
while (time() < $deadline) {
|
||||
$status = proc_get_status($process);
|
||||
|
||||
$read = [$pipes[1]];
|
||||
$write = null;
|
||||
$except = null;
|
||||
$changed = @stream_select($read, $write, $except, 1);
|
||||
|
||||
if ($changed > 0) {
|
||||
$chunk = fread($pipes[1], 8192);
|
||||
if ($chunk === false || $chunk === '') {
|
||||
if (!$status['running']) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$buffer .= $chunk;
|
||||
while (($pos = strpos($buffer, "\n")) !== false) {
|
||||
$trimmed = rtrim(substr($buffer, 0, $pos), "\r");
|
||||
$buffer = substr($buffer, $pos + 1);
|
||||
$output[] = $trimmed;
|
||||
|
||||
if (str_contains($trimmed, 'Container') && (str_contains($trimmed, 'Started') || str_contains($trimmed, 'Running'))) {
|
||||
$started = min($started + 1, $totalServices);
|
||||
if ($totalServices > 0) {
|
||||
try {
|
||||
$progress(
|
||||
InstallerServer::STEP_DOCKER_CONTAINERS,
|
||||
InstallerServer::STATUS_IN_PROGRESS,
|
||||
$message,
|
||||
['containerStarted' => $started, 'containerTotal' => $totalServices]
|
||||
);
|
||||
} catch (\Throwable) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$status['running'] && ($changed === 0 || feof($pipes[1]))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($buffer !== '') {
|
||||
$output[] = rtrim($buffer, "\r\n");
|
||||
}
|
||||
|
||||
fclose($pipes[1]);
|
||||
@@ -1221,6 +1261,34 @@ class Install extends Action
|
||||
$this->hostPath = $this->getInstallerHostPath();
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect the database adapter from a pre-1.9.0 compose file by
|
||||
* checking which DB service exists or reading _APP_DB_HOST.
|
||||
*/
|
||||
private function detectDatabaseFromCompose(Compose $compose): ?string
|
||||
{
|
||||
$serviceNames = array_keys($compose->getServices());
|
||||
$dbServices = ['mariadb', 'mongodb', 'postgresql'];
|
||||
foreach ($dbServices as $db) {
|
||||
if (in_array($db, $serviceNames, true)) {
|
||||
return $db;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($compose->getServices() as $service) {
|
||||
if (!$service) {
|
||||
continue;
|
||||
}
|
||||
$env = $service->getEnvironment()->list();
|
||||
$host = $env['_APP_DB_HOST'] ?? null;
|
||||
if ($host !== null && in_array($host, $dbServices, true)) {
|
||||
return $host;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function readExistingCompose(): string
|
||||
{
|
||||
$composeFile = $this->path . '/' . $this->getComposeFileName();
|
||||
|
||||
Reference in New Issue
Block a user