-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Pg adapter installation #9772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.6.x
Are you sure you want to change the base?
Pg adapter installation #9772
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
app/init/registers.php
Outdated
$dbScheme = System::getEnv('_APP_DB_SCHEME', 'mariadb'); | ||
|
||
$fallbackForDB = 'db_main=' . AppwriteURL::unparse([ | ||
'scheme' => 'mariadb', | ||
'scheme' => $dbScheme, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just fetch it inline with the rest
app/views/install/compose.phtml
Outdated
@@ -11,6 +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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets just call this $database here too, no need for the ternary, just fetch and default to mariadb
app/views/install/compose.phtml
Outdated
postgresql: | ||
image: postgres:15-alpine | ||
container_name: appwrite-postgresql | ||
<<: *x-logging | ||
restart: unless-stopped | ||
networks: | ||
- appwrite | ||
volumes: | ||
- appwrite-postgresql:/var/lib/postgresql/data:rw | ||
environment: | ||
- POSTGRES_DB=${_APP_DB_SCHEMA} | ||
- POSTGRES_USER=${_APP_DB_USER} | ||
- POSTGRES_PASSWORD=${_APP_DB_PASS} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this file, we should only include the container for the database you choose
app/views/install/compose.phtml
Outdated
@@ -938,3 +957,4 @@ volumes: | ||
appwrite-functions: | ||
appwrite-builds: | ||
appwrite-config: | ||
appwrite-postgresql: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, lets only include this volume if postgres is selected
@@ -31,16 +31,25 @@ public function __construct() | ||
->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) | ||
->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart)); | ||
->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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); | |
->callback($this->action(...)); |
// 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); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidental removal?
$vars['_APP_DB_SCHEME'] = [ | ||
'name' => '_APP_DB_SCHEME', | ||
'default' => $database, | ||
'required' => true, | ||
'filter' => '', | ||
'overwrite' => true, | ||
'question' => 'Choose your database (mariadb|postgresql)', | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be added in config/varaiables.php instead of here
@@ -23,10 +23,11 @@ public function __construct() | ||
->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) | ||
->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart)); | ||
->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't support changing db during upgrade, we have no way to migrate existing data at the moment
What does this PR do?
(Provide a description of what this PR does and why it's needed.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)
Related PRs and Issues
Checklist