added changes

This commit is contained in:
ArnabChatterjee20k
2025-05-16 21:07:47 +05:30
parent b775a546c8
commit 78de031c74
4 changed files with 31 additions and 8 deletions
+9
View File
@@ -294,6 +294,15 @@ return [
'required' => false,
'question' => '',
'filter' => ''
],
[
'name' => '_APP_DB_SCHEME',
'description' => 'To switch between mariadb and postgresql',
'introduction' => '1.6.0',
'default' => 'mariadb',
'required' => true,
'question' => 'Choose your database (mariadb|postgresql)',
'filter' => ''
]
],
],
+1 -2
View File
@@ -99,10 +99,9 @@ $register->set('logger', function () {
$register->set('pools', function () {
$group = new Group();
$dbScheme = System::getEnv('_APP_DB_SCHEME', 'mariadb');
$fallbackForDB = 'db_main=' . AppwriteURL::unparse([
'scheme' => $dbScheme,
'scheme' => System::getEnv('_APP_DB_SCHEME', 'mariadb'),
'host' => System::getEnv('_APP_DB_HOST', 'mariadb'),
'port' => System::getEnv('_APP_DB_PORT', '3306'),
'user' => System::getEnv('_APP_DB_USER', ''),
+13 -5
View File
@@ -11,7 +11,7 @@ $httpsPort = $this->getParam('httpsPort', '');
$version = $this->getParam('version', '');
$organization = $this->getParam('organization', '');
$image = $this->getParam('image', '');
$dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : 'postgresql';
$dbService = $this->getParam('database');
?>services:
traefik:
image: traefik:2.11
@@ -885,10 +885,12 @@ $dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' :
- OPR_EXECUTOR_STORAGE_WASABI_REGION=$_APP_STORAGE_WASABI_REGION
- OPR_EXECUTOR_STORAGE_WASABI_BUCKET=$_APP_STORAGE_WASABI_BUCKET
<?php if ($dbService === 'mariadb'): ?>
mariadb:
image: mariadb:10.11 # fix issues when upgrading using: mysql_upgrade -u root -p
image: mariadb:10.11
container_name: appwrite-mariadb
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
@@ -902,10 +904,11 @@ $dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' :
- MARIADB_AUTO_UPGRADE=1
command: 'mysqld --innodb-flush-method=fsync'
<?php elseif ($dbService === 'postgresql'): ?>
postgresql:
image: postgres:15-alpine
container_name: appwrite-postgresql
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
@@ -916,6 +919,8 @@ $dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' :
- POSTGRES_USER=${_APP_DB_USER}
- POSTGRES_PASSWORD=${_APP_DB_PASS}
<?php endif; ?>
redis:
image: redis:7.2.4-alpine
container_name: appwrite-redis
@@ -949,7 +954,11 @@ networks:
name: runtimes
volumes:
<?php if ($dbService === 'mariadb'): ?>
appwrite-mariadb:
<?php elseif ($dbService === 'postgresql'): ?>
appwrite-postgresql:
<?php endif; ?>
appwrite-redis:
appwrite-cache:
appwrite-uploads:
@@ -957,4 +966,3 @@ volumes:
appwrite-functions:
appwrite-builds:
appwrite-config:
appwrite-postgresql:
+8 -1
View File
@@ -32,7 +32,7 @@ class Install extends Action
->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', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true)
->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database));
->callback($this->action(...));
}
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void
@@ -59,6 +59,13 @@ class Install extends Action
Console::success('Starting Appwrite installation...');
// Create directory with write permissions
if (!\file_exists(\dirname($this->path))) {
if (!@\mkdir(\dirname($this->path), 0755, true)) {
Console::error('Can\'t create directory ' . \dirname($this->path));
Console::exit(1);
}
}
$data = @file_get_contents($this->path . '/docker-compose.yml');