diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php
index 46e410980..2dc9a38b0 100644
--- a/app/Actions/Database/StartPostgresql.php
+++ b/app/Actions/Database/StartPostgresql.php
@@ -32,6 +32,8 @@ public function handle(StandalonePostgresql $database)
$volume_names = $this->generate_local_persistent_volumes_only_volume_names();
$environment_variables = $this->generate_environment_variables();
$this->generate_init_scripts();
+ $this->add_custom_conf();
+
$docker_compose = [
'version' => '3.8',
'services' => [
@@ -96,6 +98,19 @@ public function handle(StandalonePostgresql $database)
];
}
}
+ if (!is_null($this->database->postgres_conf)) {
+ $docker_compose['services'][$container_name]['volumes'][] = [
+ 'type' => 'bind',
+ 'source' => $this->configuration_dir . '/custom-postgres.conf',
+ 'target' => '/etc/postgresql/postgresql.conf',
+ 'read_only' => true,
+ ];
+ $docker_compose['services'][$container_name]['command'] = [
+ 'postgres',
+ '-c',
+ 'config_file=/etc/postgresql/postgresql.conf',
+ ];
+ }
$docker_compose = Yaml::dump($docker_compose, 10);
$docker_compose_base64 = base64_encode($docker_compose);
$this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml";
@@ -171,4 +186,14 @@ private function generate_init_scripts()
$this->init_scripts[] = "$this->configuration_dir/docker-entrypoint-initdb.d/{$filename}";
}
}
+ private function add_custom_conf()
+ {
+ if (is_null($this->database->postgres_conf)) {
+ return;
+ }
+ $filename = 'custom-postgres.conf';
+ $content = $this->database->postgres_conf;
+ $content_base64 = base64_encode($content);
+ $this->commands[] = "echo '{$content_base64}' | base64 -d > $this->configuration_dir/{$filename}";
+ }
}
diff --git a/app/Http/Livewire/Project/Database/Mariadb/General.php b/app/Http/Livewire/Project/Database/Mariadb/General.php
index 11b5fc42b..173e9290f 100644
--- a/app/Http/Livewire/Project/Database/Mariadb/General.php
+++ b/app/Http/Livewire/Project/Database/Mariadb/General.php
@@ -13,7 +13,8 @@ class General extends Component
protected $listeners = ['refresh'];
public StandaloneMariadb $database;
- public string $db_url;
+ public ?string $db_url = null;
+ public ?string $db_url_public = null;
protected $rules = [
'database.name' => 'required',
@@ -41,6 +42,14 @@ class General extends Component
'database.is_public' => 'Is Public',
'database.public_port' => 'Public Port',
];
+
+ public function mount()
+ {
+ $this->db_url = $this->database->getDbUrl(true);
+ if ($this->database->is_public) {
+ $this->db_url_public = $this->database->getDbUrl();
+ }
+ }
public function submit()
{
try {
@@ -69,12 +78,13 @@ public function instantSave()
return;
}
StartDatabaseProxy::run($this->database);
+ $this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
+ $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.');
}
- $this->db_url = $this->database->getDbUrl();
$this->database->save();
} catch (\Throwable $e) {
$this->database->is_public = !$this->database->is_public;
@@ -86,11 +96,6 @@ public function refresh(): void
$this->database->refresh();
}
- public function mount()
- {
- $this->db_url = $this->database->getDbUrl();
- }
-
public function render()
{
return view('livewire.project.database.mariadb.general');
diff --git a/app/Http/Livewire/Project/Database/Mongodb/General.php b/app/Http/Livewire/Project/Database/Mongodb/General.php
index ce0ff14ea..189f2632e 100644
--- a/app/Http/Livewire/Project/Database/Mongodb/General.php
+++ b/app/Http/Livewire/Project/Database/Mongodb/General.php
@@ -13,7 +13,8 @@ class General extends Component
protected $listeners = ['refresh'];
public StandaloneMongodb $database;
- public string $db_url;
+ public ?string $db_url = null;
+ public ?string $db_url_public = null;
protected $rules = [
'database.name' => 'required',
@@ -39,6 +40,15 @@ class General extends Component
'database.is_public' => 'Is Public',
'database.public_port' => 'Public Port',
];
+
+ public function mount()
+ {
+ $this->db_url = $this->database->getDbUrl(true);
+ if ($this->database->is_public) {
+ $this->db_url_public = $this->database->getDbUrl();
+ }
+ }
+
public function submit()
{
try {
@@ -70,12 +80,13 @@ public function instantSave()
return;
}
StartDatabaseProxy::run($this->database);
+ $this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
+ $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.');
}
- $this->db_url = $this->database->getDbUrl();
$this->database->save();
} catch (\Throwable $e) {
$this->database->is_public = !$this->database->is_public;
@@ -87,11 +98,6 @@ public function refresh(): void
$this->database->refresh();
}
- public function mount()
- {
- $this->db_url = $this->database->getDbUrl();
- }
-
public function render()
{
return view('livewire.project.database.mongodb.general');
diff --git a/app/Http/Livewire/Project/Database/Mysql/General.php b/app/Http/Livewire/Project/Database/Mysql/General.php
index 416970ea9..cb1a063db 100644
--- a/app/Http/Livewire/Project/Database/Mysql/General.php
+++ b/app/Http/Livewire/Project/Database/Mysql/General.php
@@ -13,7 +13,8 @@ class General extends Component
protected $listeners = ['refresh'];
public StandaloneMysql $database;
- public string $db_url;
+ public ?string $db_url = null;
+ public ?string $db_url_public = null;
protected $rules = [
'database.name' => 'required',
@@ -41,6 +42,14 @@ class General extends Component
'database.is_public' => 'Is Public',
'database.public_port' => 'Public Port',
];
+
+ public function mount()
+ {
+ $this->db_url = $this->database->getDbUrl(true);
+ if ($this->database->is_public) {
+ $this->db_url_public = $this->database->getDbUrl();
+ }
+ }
public function submit()
{
try {
@@ -69,12 +78,13 @@ public function instantSave()
return;
}
StartDatabaseProxy::run($this->database);
+ $this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
+ $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.');
}
- $this->db_url = $this->database->getDbUrl();
$this->database->save();
} catch (\Throwable $e) {
$this->database->is_public = !$this->database->is_public;
@@ -86,11 +96,6 @@ public function refresh(): void
$this->database->refresh();
}
- public function mount()
- {
- $this->db_url = $this->database->getDbUrl();
- }
-
public function render()
{
return view('livewire.project.database.mysql.general');
diff --git a/app/Http/Livewire/Project/Database/Postgresql/General.php b/app/Http/Livewire/Project/Database/Postgresql/General.php
index 7872764e3..ebc69a1bc 100644
--- a/app/Http/Livewire/Project/Database/Postgresql/General.php
+++ b/app/Http/Livewire/Project/Database/Postgresql/General.php
@@ -15,7 +15,8 @@ class General extends Component
public StandalonePostgresql $database;
public string $new_filename;
public string $new_content;
- public string $db_url;
+ public ?string $db_url = null;
+ public ?string $db_url_public = null;
protected $listeners = ['refresh', 'save_init_script', 'delete_init_script'];
@@ -27,6 +28,7 @@ class General extends Component
'database.postgres_db' => 'required',
'database.postgres_initdb_args' => 'nullable',
'database.postgres_host_auth_method' => 'nullable',
+ 'database.postgres_conf' => 'nullable',
'database.init_scripts' => 'nullable',
'database.image' => 'required',
'database.ports_mappings' => 'nullable',
@@ -41,6 +43,7 @@ class General extends Component
'database.postgres_db' => 'Postgres DB',
'database.postgres_initdb_args' => 'Postgres Initdb Args',
'database.postgres_host_auth_method' => 'Postgres Host Auth Method',
+ 'database.postgres_conf' => 'Postgres Configuration',
'database.init_scripts' => 'Init Scripts',
'database.image' => 'Image',
'database.ports_mappings' => 'Port Mapping',
@@ -49,7 +52,10 @@ class General extends Component
];
public function mount()
{
- $this->db_url = $this->database->getDbUrl();
+ $this->db_url = $this->database->getDbUrl(true);
+ if ($this->database->is_public) {
+ $this->db_url_public = $this->database->getDbUrl();
+ }
}
public function instantSave()
{
@@ -66,12 +72,13 @@ public function instantSave()
return;
}
StartDatabaseProxy::run($this->database);
+ $this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
+ $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.');
}
- $this->db_url = $this->database->getDbUrl();
$this->database->save();
} catch (\Throwable $e) {
$this->database->is_public = !$this->database->is_public;
diff --git a/app/Http/Livewire/Project/Database/Redis/General.php b/app/Http/Livewire/Project/Database/Redis/General.php
index dd2e8151d..834a9f381 100644
--- a/app/Http/Livewire/Project/Database/Redis/General.php
+++ b/app/Http/Livewire/Project/Database/Redis/General.php
@@ -13,7 +13,8 @@ class General extends Component
protected $listeners = ['refresh'];
public StandaloneRedis $database;
- public string $db_url;
+ public ?string $db_url = null;
+ public ?string $db_url_public = null;
protected $rules = [
'database.name' => 'required',
@@ -35,6 +36,13 @@ class General extends Component
'database.is_public' => 'Is Public',
'database.public_port' => 'Public Port',
];
+ public function mount()
+ {
+ $this->db_url = $this->database->getDbUrl(true);
+ if ($this->database->is_public) {
+ $this->db_url_public = $this->database->getDbUrl();
+ }
+ }
public function submit()
{
try {
@@ -63,12 +71,13 @@ public function instantSave()
return;
}
StartDatabaseProxy::run($this->database);
+ $this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
+ $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.');
}
- $this->db_url = $this->database->getDbUrl();
$this->database->save();
} catch (\Throwable $e) {
$this->database->is_public = !$this->database->is_public;
@@ -80,10 +89,6 @@ public function refresh(): void
$this->database->refresh();
}
- public function mount()
- {
- $this->db_url = $this->database->getDbUrl();
- }
public function render()
{
return view('livewire.project.database.redis.general');
diff --git a/config/sentry.php b/config/sentry.php
index 180d98f99..b499fe319 100644
--- a/config/sentry.php
+++ b/config/sentry.php
@@ -7,7 +7,7 @@
// The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
- 'release' => '4.0.0-beta.114',
+ 'release' => '4.0.0-beta.115',
// When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'),
diff --git a/config/version.php b/config/version.php
index aee7423ea..4c86b6ee4 100644
--- a/config/version.php
+++ b/config/version.php
@@ -1,3 +1,3 @@
longText('postgres_conf')->nullable();
+ $table->string('image')->default('postgres:16-alpine')->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('standalone_postgresqls', function (Blueprint $table) {
+ $table->dropColumn('postgres_conf');
+ $table->string('image')->default('postgres:15-alpine')->change();
+ });
+ }
+};
diff --git a/resources/views/livewire/project/database/mariadb/general.blade.php b/resources/views/livewire/project/database/mariadb/general.blade.php
index 6b0205cbe..520e29eaa 100644
--- a/resources/views/livewire/project/database/mariadb/general.blade.php
+++ b/resources/views/livewire/project/database/mariadb/general.blade.php
@@ -49,9 +49,14 @@
label="Public Port" />