An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
feat: gzip enabled & stipprefix setting refactor: code
Andras Bacsai8385bbb0a07a
diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.phpindex 8dca584f23..3274566a17 100644--- a/app/Actions/Database/StartMariadb.php+++ b/app/Actions/Database/StartMariadb.php@@ -71,7 +71,7 @@ class StartMariadbif (!is_null($this->database->limits_cpuset)) {data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);}- if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {+ if ($this->database->destination->server->is_log_drain_enabled() && $this->database->is_log_drain_enabled()) {$docker_compose['services'][$container_name]['logging'] = ['driver' => 'fluentd','options' => [diff --git a/app/Actions/Database/StartMongodb.php b/app/Actions/Database/StartMongodb.phpindex ef04a9be83..75bfe3ed39 100644--- a/app/Actions/Database/StartMongodb.php+++ b/app/Actions/Database/StartMongodb.php@@ -78,7 +78,7 @@ class StartMongodbif (!is_null($this->database->limits_cpuset)) {data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);}- if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {+ if ($this->database->destination->server->is_log_drain_enabled() && $this->database->is_log_drain_enabled()) {$docker_compose['services'][$container_name]['logging'] = ['driver' => 'fluentd','options' => [diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.phpindex 3b47483a3d..4a8edc1e2a 100644--- a/app/Actions/Database/StartMysql.php+++ b/app/Actions/Database/StartMysql.php@@ -71,7 +71,7 @@ class StartMysqlif (!is_null($this->database->limits_cpuset)) {data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);}- if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {+ if ($this->database->destination->server->is_log_drain_enabled() && $this->database->is_log_drain_enabled()) {$docker_compose['services'][$container_name]['logging'] = ['driver' => 'fluentd','options' => [diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.phpindex 844f81c311..ea5de10dad 100644--- a/app/Actions/Database/StartPostgresql.php+++ b/app/Actions/Database/StartPostgresql.php@@ -77,7 +77,7 @@ class StartPostgresqlif (!is_null($this->database->limits_cpuset)) {data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);}- if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {+ if ($this->database->destination->server->is_log_drain_enabled() && $this->database->is_log_drain_enabled()) {ray('Log Drain Enabled');$docker_compose['services'][$container_name]['logging'] = ['driver' => 'fluentd',diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.phpindex e1a8eef41b..692c14c1cb 100644--- a/app/Actions/Database/StartRedis.php+++ b/app/Actions/Database/StartRedis.php@@ -81,7 +81,7 @@ class StartRedisif (!is_null($this->database->limits_cpuset)) {data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);}- if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {+ if ($this->database->destination->server->is_log_drain_enabled() && $this->database->is_log_drain_enabled()) {$docker_compose['services'][$container_name]['logging'] = ['driver' => 'fluentd','options' => [diff --git a/app/Console/Kernel.php b/app/Console/Kernel.phpindex e92c602cff..4599dd5a41 100644--- a/app/Console/Kernel.php+++ b/app/Console/Kernel.php@@ -77,7 +77,7 @@ class Kernel extends ConsoleKernel// ray('dispatching container status job in ' . $randomSeconds . ' seconds');// dispatch($job);// })->name('container-status-' . $server->id)->everyMinute()->onOneServer();- if ($server->isLogDrainEnabled()) {+ if ($server->is_log_drain_enabled()) {$schedule->job(new CheckLogDrainContainerJob($server))->everyMinute()->onOneServer();// $schedule// ->call(function () use ($server) {diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex 0dedfd5968..29709d6753 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -1185,7 +1185,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted} else {$docker_compose['services'][$this->container_name]['labels'] = $labels;}- if ($this->server->isLogDrainEnabled() && $this->application->isLogDrainEnabled()) {+ if ($this->server->is_log_drain_enabled() && $this->application->is_log_drain_enabled()) {$docker_compose['services'][$this->container_name]['logging'] = ['driver' => 'fluentd','options' => [diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.phpindex 71de3e3528..aa4b2fa7ff 100644--- a/app/Jobs/DatabaseBackupJob.php+++ b/app/Jobs/DatabaseBackupJob.php@@ -319,7 +319,7 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncryptedprivate function backup_standalone_mongodb(string $databaseWithCollections): void{try {- $url = $this->database->getDbUrl(useInternal: true);+ $url = $this->database->get_db_url(useInternal: true);if ($databaseWithCollections === 'all') {$commands[] = "mkdir -p " . $this->backup_dir;$commands[] = "docker exec $this->container_name mongodump --authenticationDatabase=admin --uri=$url --gzip --archive > $this->backup_location";diff --git a/app/Livewire/Project/Application/Advanced.php b/app/Livewire/Project/Application/Advanced.phpindex 08b4f95239..442f5488a6 100644--- a/app/Livewire/Project/Application/Advanced.php+++ b/app/Livewire/Project/Application/Advanced.php@@ -9,6 +9,8 @@ class Advanced extends Component{public Application $application;public bool $is_force_https_enabled;+ public bool $is_gzip_enabled;+ public bool $is_stripprefix_enabled;protected $rules = ['application.settings.is_git_submodules_enabled' => 'boolean|required','application.settings.is_git_lfs_enabled' => 'boolean|required',@@ -19,6 +21,8 @@ class Advanced extends Component'application.settings.is_gpu_enabled' => 'boolean|required','application.settings.is_build_server_enabled' => 'boolean|required','application.settings.is_consistent_container_name_enabled' => 'boolean|required',+ 'application.settings.is_gzip_enabled' => 'boolean|required',+ 'application.settings.is_stripprefix_enabled' => 'boolean|required','application.settings.gpu_driver' => 'string|required','application.settings.gpu_count' => 'string|required','application.settings.gpu_device_ids' => 'string|required',@@ -26,11 +30,13 @@ class Advanced extends Component];public function mount() {$this->is_force_https_enabled = $this->application->settings->is_force_https_enabled;+ $this->is_gzip_enabled = $this->application->settings->is_gzip_enabled;+ $this->is_stripprefix_enabled = $this->application->settings->is_stripprefix_enabled;}public function instantSave(){- if ($this->application->isLogDrainEnabled()) {- if (!$this->application->destination->server->isLogDrainEnabled()) {+ if ($this->application->is_log_drain_enabled()) {+ if (!$this->application->destination->server->is_log_drain_enabled()) {$this->application->settings->is_log_drain_enabled = false;$this->dispatch('error', 'Log drain is not enabled on this server.');return;@@ -40,6 +46,14 @@ class Advanced extends Component$this->application->settings->is_force_https_enabled = $this->is_force_https_enabled;$this->dispatch('resetDefaultLabels', false);}+ if ($this->application->settings->is_gzip_enabled !== $this->is_gzip_enabled) {+ $this->application->settings->is_gzip_enabled = $this->is_gzip_enabled;+ $this->dispatch('resetDefaultLabels', false);+ }+ if ($this->application->settings->is_stripprefix_enabled !== $this->is_stripprefix_enabled) {+ $this->application->settings->is_stripprefix_enabled = $this->is_stripprefix_enabled;+ $this->dispatch('resetDefaultLabels', false);+ }$this->application->settings->save();$this->dispatch('success', 'Settings saved.');}diff --git a/app/Livewire/Project/Database/Mariadb/General.php b/app/Livewire/Project/Database/Mariadb/General.phpindex 9b15c6c3c5..9e0a0c5fc4 100644--- a/app/Livewire/Project/Database/Mariadb/General.php+++ b/app/Livewire/Project/Database/Mariadb/General.php@@ -46,14 +46,14 @@ class General extends Componentpublic function mount(){- $this->db_url = $this->database->getDbUrl(true);+ $this->db_url = $this->database->get_db_url(true);if ($this->database->is_public) {- $this->db_url_public = $this->database->getDbUrl();+ $this->db_url_public = $this->database->get_db_url();}}public function instantSaveAdvanced() {try {- if (!$this->database->destination->server->isLogDrainEnabled()) {+ if (!$this->database->destination->server->is_log_drain_enabled()) {$this->database->is_log_drain_enabled = false;$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');return;@@ -93,7 +93,7 @@ class General extends Componentreturn;}StartDatabaseProxy::run($this->database);- $this->db_url_public = $this->database->getDbUrl();+ $this->db_url_public = $this->database->get_db_url();$this->dispatch('success', 'Database is now publicly accessible.');} else {StopDatabaseProxy::run($this->database);diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.phpindex cd3ea06309..5c9f9cb479 100644--- a/app/Livewire/Project/Database/Mongodb/General.php+++ b/app/Livewire/Project/Database/Mongodb/General.php@@ -44,15 +44,15 @@ class General extends Componentpublic function mount(){- $this->db_url = $this->database->getDbUrl(true);+ $this->db_url = $this->database->get_db_url(true);if ($this->database->is_public) {- $this->db_url_public = $this->database->getDbUrl();+ $this->db_url_public = $this->database->get_db_url();}}public function instantSaveAdvanced(){try {- if (!$this->database->destination->server->isLogDrainEnabled()) {+ if (!$this->database->destination->server->is_log_drain_enabled()) {$this->database->is_log_drain_enabled = false;$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');return;@@ -95,7 +95,7 @@ class General extends Componentreturn;}StartDatabaseProxy::run($this->database);- $this->db_url_public = $this->database->getDbUrl();+ $this->db_url_public = $this->database->get_db_url();$this->dispatch('success', 'Database is now publicly accessible.');} else {StopDatabaseProxy::run($this->database);diff --git a/app/Livewire/Project/Database/Mysql/General.php b/app/Livewire/Project/Database/Mysql/General.phpindex 2470a934bc..f67641b315 100644--- a/app/Livewire/Project/Database/Mysql/General.php+++ b/app/Livewire/Project/Database/Mysql/General.php@@ -46,15 +46,15 @@ class General extends Componentpublic function mount(){- $this->db_url = $this->database->getDbUrl(true);+ $this->db_url = $this->database->get_db_url(true);if ($this->database->is_public) {- $this->db_url_public = $this->database->getDbUrl();+ $this->db_url_public = $this->database->get_db_url();}}public function instantSaveAdvanced(){try {- if (!$this->database->destination->server->isLogDrainEnabled()) {+ if (!$this->database->destination->server->is_log_drain_enabled()) {$this->database->is_log_drain_enabled = false;$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');return;@@ -94,7 +94,7 @@ class General extends Componentreturn;}StartDatabaseProxy::run($this->database);- $this->db_url_public = $this->database->getDbUrl();+ $this->db_url_public = $this->database->get_db_url();$this->dispatch('success', 'Database is now publicly accessible.');} else {StopDatabaseProxy::run($this->database);diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.phpindex 43f5591400..1025573513 100644--- a/app/Livewire/Project/Database/Postgresql/General.php+++ b/app/Livewire/Project/Database/Postgresql/General.php@@ -53,14 +53,14 @@ class General extends Component];public function mount(){- $this->db_url = $this->database->getDbUrl(true);+ $this->db_url = $this->database->get_db_url(true);if ($this->database->is_public) {- $this->db_url_public = $this->database->getDbUrl();+ $this->db_url_public = $this->database->get_db_url();}}public function instantSaveAdvanced() {try {- if (!$this->database->destination->server->isLogDrainEnabled()) {+ if (!$this->database->destination->server->is_log_drain_enabled()) {$this->database->is_log_drain_enabled = false;$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');return;@@ -87,7 +87,7 @@ class General extends Componentreturn;}StartDatabaseProxy::run($this->database);- $this->db_url_public = $this->database->getDbUrl();+ $this->db_url_public = $this->database->get_db_url();$this->dispatch('success', 'Database is now publicly accessible.');} else {StopDatabaseProxy::run($this->database);diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.phpindex 07c161de55..ee02239af7 100644--- a/app/Livewire/Project/Database/Redis/General.php+++ b/app/Livewire/Project/Database/Redis/General.php@@ -39,14 +39,14 @@ class General extends Component];public function mount(){- $this->db_url = $this->database->getDbUrl(true);+ $this->db_url = $this->database->get_db_url(true);if ($this->database->is_public) {- $this->db_url_public = $this->database->getDbUrl();+ $this->db_url_public = $this->database->get_db_url();}}public function instantSaveAdvanced() {try {- if (!$this->database->destination->server->isLogDrainEnabled()) {+ if (!$this->database->destination->server->is_log_drain_enabled()) {$this->database->is_log_drain_enabled = false;$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');return;@@ -86,7 +86,7 @@ class General extends Componentreturn;}StartDatabaseProxy::run($this->database);- $this->db_url_public = $this->database->getDbUrl();+ $this->db_url_public = $this->database->get_db_url();$this->dispatch('success', 'Database is now publicly accessible.');} else {StopDatabaseProxy::run($this->database);diff --git a/app/Livewire/Project/Service/Database.php b/app/Livewire/Project/Service/Database.phpindex 8dec97852f..c86c54da2c 100644--- a/app/Livewire/Project/Service/Database.php+++ b/app/Livewire/Project/Service/Database.php@@ -36,7 +36,7 @@ class Database extends Component}public function instantSaveAdvanced(){- if (!$this->database->service->destination->server->isLogDrainEnabled()) {+ if (!$this->database->service->destination->server->is_log_drain_enabled()) {$this->database->is_log_drain_enabled = false;$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');return;diff --git a/app/Livewire/Project/Service/ServiceApplicationView.php b/app/Livewire/Project/Service/ServiceApplicationView.phpindex 2bae41a806..9a4738c9fc 100644--- a/app/Livewire/Project/Service/ServiceApplicationView.php+++ b/app/Livewire/Project/Service/ServiceApplicationView.php@@ -18,6 +18,7 @@ class ServiceApplicationView extends Component'application.required_fqdn' => 'required|boolean','application.is_log_drain_enabled' => 'nullable|boolean','application.is_gzip_enabled' => 'nullable|boolean',+ 'application.is_stripprefix_enabled' => 'nullable|boolean',];public function render(){@@ -29,7 +30,7 @@ class ServiceApplicationView extends Component}public function instantSaveAdvanced(){- if (!$this->application->service->destination->server->isLogDrainEnabled()) {+ if (!$this->application->service->destination->server->is_log_drain_enabled()) {$this->application->is_log_drain_enabled = false;$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');return;diff --git a/app/Livewire/Server/LogDrains.php b/app/Livewire/Server/LogDrains.phpindex 4eca682d49..605aa25b5a 100644--- a/app/Livewire/Server/LogDrains.php+++ b/app/Livewire/Server/LogDrains.php@@ -54,7 +54,7 @@ class LogDrains extends Component{try {InstallLogDrain::run($this->server);- if (!$this->server->isLogDrainEnabled()) {+ if (!$this->server->is_log_drain_enabled()) {$this->dispatch('serverRefresh');$this->dispatch('success', 'Log drain service stopped.');return;diff --git a/app/Models/Application.php b/app/Models/Application.phpindex f6df1ca881..24a61eca96 100644--- a/app/Models/Application.php+++ b/app/Models/Application.php@@ -80,6 +80,18 @@ class Application extends BaseModel}return false;}+ public function is_force_https_enabled()+ {+ return data_get($this, 'settings.is_force_https_enabled', false);+ }+ public function is_stripprefix_enabled()+ {+ return data_get($this, 'settings.is_stripprefix_enabled', true);+ }+ public function is_gzip_enabled()+ {+ return data_get($this, 'settings.is_gzip_enabled', true);+ }public function link(){if (data_get($this, 'environment.project.uuid')) {@@ -481,7 +493,7 @@ class Application extends BaseModel{return application_configuration_dir() . "/{$this->uuid}";}- public function isLogDrainEnabled()+ public function is_log_drain_enabled(){return data_get($this, 'settings.is_log_drain_enabled', false);}diff --git a/app/Models/Server.php b/app/Models/Server.phpindex 4028109e2f..5293bdd999 100644--- a/app/Models/Server.php+++ b/app/Models/Server.php@@ -405,7 +405,7 @@ class Server extends BaseModel{return $this->settings->is_reachable && $this->settings->is_usable && !$this->settings->force_disabled;}- public function isLogDrainEnabled()+ public function is_log_drain_enabled(){return $this->settings->is_logdrain_newrelic_enabled || $this->settings->is_logdrain_highlight_enabled || $this->settings->is_logdrain_axiom_enabled || $this->settings->is_logdrain_custom_enabled;}diff --git a/app/Models/ServiceApplication.php b/app/Models/ServiceApplication.phpindex 314a01ba3a..8a01aa50e8 100644--- a/app/Models/ServiceApplication.php+++ b/app/Models/ServiceApplication.php@@ -19,11 +19,15 @@ class ServiceApplication extends BaseModel$service->fileStorages()->delete();});}- public function isLogDrainEnabled()+ public function is_log_drain_enabled(){return data_get($this, 'is_log_drain_enabled', false);}- public function isGzipEnabled()+ public function is_stripprefix_enabled()+ {+ return data_get($this, 'is_stripprefix_enabled', true);+ }+ public function is_gzip_enabled(){return data_get($this, 'is_gzip_enabled', true);}diff --git a/app/Models/ServiceDatabase.php b/app/Models/ServiceDatabase.phpindex 31bd2786d2..c3f4cc278e 100644--- a/app/Models/ServiceDatabase.php+++ b/app/Models/ServiceDatabase.php@@ -17,11 +17,11 @@ class ServiceDatabase extends BaseModel$service->fileStorages()->delete();});}- public function isLogDrainEnabled()+ public function is_log_drain_enabled(){return data_get($this, 'is_log_drain_enabled', false);}- public function isGzipEnabled()+ public function is_gzip_enabled(){return true;}diff --git a/app/Models/StandaloneMariadb.php b/app/Models/StandaloneMariadb.phpindex 174397baa0..2f2be6757a 100644--- a/app/Models/StandaloneMariadb.php+++ b/app/Models/StandaloneMariadb.php@@ -100,7 +100,7 @@ class StandaloneMariadb extends BaseModel}return null;}- public function isLogDrainEnabled()+ public function is_log_drain_enabled(){return data_get($this, 'is_log_drain_enabled', false);}@@ -126,7 +126,7 @@ class StandaloneMariadb extends BaseModel);}- public function getDbUrl(bool $useInternal = false): string+ public function get_db_url(bool $useInternal = false): string{if ($this->is_public && !$useInternal) {return "mysql://{$this->mariadb_user}:{$this->mariadb_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->mariadb_database}";diff --git a/app/Models/StandaloneMongodb.php b/app/Models/StandaloneMongodb.phpindex d6efaaa1e9..cb10f8f55b 100644--- a/app/Models/StandaloneMongodb.php+++ b/app/Models/StandaloneMongodb.php@@ -92,7 +92,7 @@ class StandaloneMongodb extends BaseModel{return data_get($this, 'environment.project.team');}- public function isLogDrainEnabled()+ public function is_log_drain_enabled(){return data_get($this, 'is_log_drain_enabled', false);}@@ -142,7 +142,7 @@ class StandaloneMongodb extends BaseModel{return 'standalone-mongodb';}- public function getDbUrl(bool $useInternal = false)+ public function get_db_url(bool $useInternal = false){if ($this->is_public && !$useInternal) {return "mongodb://{$this->mongo_initdb_root_username}:{$this->mongo_initdb_root_password}@{$this->destination->server->getIp}:{$this->public_port}/?directConnection=true";diff --git a/app/Models/StandaloneMysql.php b/app/Models/StandaloneMysql.phpindex f317196aae..c2d2b5c6f6 100644--- a/app/Models/StandaloneMysql.php+++ b/app/Models/StandaloneMysql.php@@ -105,7 +105,7 @@ class StandaloneMysql extends BaseModelreturn 'standalone-mysql';}- public function isLogDrainEnabled()+ public function is_log_drain_enabled(){return data_get($this, 'is_log_drain_enabled', false);}@@ -127,7 +127,7 @@ class StandaloneMysql extends BaseModel);}- public function getDbUrl(bool $useInternal = false): string+ public function get_db_url(bool $useInternal = false): string{if ($this->is_public && !$useInternal) {return "mysql://{$this->mysql_user}:{$this->mysql_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->mysql_database}";diff --git a/app/Models/StandalonePostgresql.php b/app/Models/StandalonePostgresql.phpindex 3d23171596..ad0dce1081 100644--- a/app/Models/StandalonePostgresql.php+++ b/app/Models/StandalonePostgresql.php@@ -97,7 +97,7 @@ class StandalonePostgresql extends BaseModel}return null;}- public function isLogDrainEnabled()+ public function is_log_drain_enabled(){return data_get($this, 'is_log_drain_enabled', false);}@@ -126,7 +126,7 @@ class StandalonePostgresql extends BaseModel{return 'standalone-postgresql';}- public function getDbUrl(bool $useInternal = false): string+ public function get_db_url(bool $useInternal = false): string{if ($this->is_public && !$useInternal) {return "postgres://{$this->postgres_user}:{$this->postgres_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->postgres_db}";diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.phpindex 6b6b6c415d..c1b1d1390e 100644--- a/app/Models/StandaloneRedis.php+++ b/app/Models/StandaloneRedis.php@@ -96,7 +96,7 @@ class StandaloneRedis extends BaseModel}return null;}- public function isLogDrainEnabled()+ public function is_log_drain_enabled(){return data_get($this, 'is_log_drain_enabled', false);}@@ -122,7 +122,7 @@ class StandaloneRedis extends BaseModel{return 'standalone-redis';}- public function getDbUrl(bool $useInternal = false): string+ public function get_db_url(bool $useInternal = false): string{if ($this->is_public && !$useInternal) {return "redis://:{$this->redis_password}@{$this->destination->server->getIp}:{$this->public_port}/0";diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.phpindex 008bd4d7ff..237a12d74d 100644--- a/bootstrap/helpers/docker.php+++ b/bootstrap/helpers/docker.php@@ -215,7 +215,7 @@ function generateServiceSpecificFqdns(ServiceApplication|Application $resource,}return $payload;}-function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_https_enabled = false, $onlyPort = null, ?Collection $serviceLabels = null, ?bool $is_gzip_enabled = true, ?string $service_name = null)+function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_https_enabled = false, $onlyPort = null, ?Collection $serviceLabels = null, ?bool $is_gzip_enabled = true, ?bool $is_stripprefix_enabled = true, ?string $service_name = null){$labels = collect([]);$labels->push('traefik.enable=true');@@ -281,8 +281,10 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_$labels->push("traefik.http.services.{$https_label}.loadbalancer.server.port=$port");}if ($path !== '/') {- $labels->push("traefik.http.middlewares.{$https_label}-stripprefix.stripprefix.prefixes={$path}");- $middlewares = collect(["{$https_label}-stripprefix"]);+ if ($is_stripprefix_enabled) {+ $labels->push("traefik.http.middlewares.{$https_label}-stripprefix.stripprefix.prefixes={$path}");+ $middlewares = collect(["{$https_label}-stripprefix"]);+ }if ($is_gzip_enabled) {$middlewares->push('gzip');}@@ -334,8 +336,10 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_$labels->push("traefik.http.routers.{$http_label}.service={$http_label}");}if ($path !== '/') {- $labels->push("traefik.http.middlewares.{$http_label}-stripprefix.stripprefix.prefixes={$path}");- $middlewares = collect(["{$http_label}-stripprefix"]);+ if ($is_stripprefix_enabled) {+ $labels->push("traefik.http.middlewares.{$http_label}-stripprefix.stripprefix.prefixes={$path}");+ $middlewares = collect(["{$http_label}-stripprefix"]);+ }if ($is_gzip_enabled) {$middlewares->push('gzip');}@@ -392,7 +396,14 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview$domains = Str::of(data_get($application, 'fqdn'))->explode(',');}// Add Traefik labels no matter which proxy is selected- $labels = $labels->merge(fqdnLabelsForTraefik($appUuid, $domains, $application->settings->is_force_https_enabled, $onlyPort));+ $labels = $labels->merge(fqdnLabelsForTraefik(+ uuid: $appUuid,+ domains: $domains,+ onlyPort: $onlyPort,+ is_force_https_enabled: $application->is_force_https_enabled(),+ is_gzip_enabled: $application->is_gzip_enabled(),+ is_stripprefix_enabled: $application->is_stripprefix_enabled()+ ));}return $labels->all();}diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex 47dd8b2847..47cc57c356 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -1047,10 +1047,17 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal$serviceLabels = $serviceLabels->merge($defaultLabels);if (!$isDatabase && $fqdns->count() > 0) {if ($fqdns) {- $serviceLabels = $serviceLabels->merge(fqdnLabelsForTraefik($resource->uuid, $fqdns, true, serviceLabels: $serviceLabels, is_gzip_enabled: $savedService->isGzipEnabled(), service_name: $serviceName));+ $serviceLabels = $serviceLabels->merge(fqdnLabelsForTraefik(+ uuid: $resource->uuid,+ domains: $fqdns,+ is_force_https_enabled: true,+ serviceLabels: $serviceLabels,+ is_gzip_enabled: $savedService->is_gzip_enabled(),+ is_stripprefix_enabled: $savedService->is_stripprefix_enabled(),+ service_name: $serviceName));}}- if ($resource->server->isLogDrainEnabled() && $savedService->isLogDrainEnabled()) {+ if ($resource->server->is_log_drain_enabled() && $savedService->is_log_drain_enabled()) {data_set($service, 'logging', ['driver' => 'fluentd','options' => [@@ -1494,7 +1501,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal$defaultLabels = defaultLabels($resource->id, $containerName, $pull_request_id, type: 'application');$serviceLabels = $serviceLabels->merge($defaultLabels);- if ($server->isLogDrainEnabled() && $resource->isLogDrainEnabled()) {+ if ($server->is_log_drain_enabled() && $resource->is_log_drain_enabled()) {data_set($service, 'logging', ['driver' => 'fluentd','options' => [diff --git a/database/migrations/2024_03_04_092244_add_gzip_enabled_and_stripprefix_settings.php b/database/migrations/2024_03_04_092244_add_gzip_enabled_and_stripprefix_settings.phpnew file mode 100644index 0000000000..1787a07ebc--- /dev/null+++ b/database/migrations/2024_03_04_092244_add_gzip_enabled_and_stripprefix_settings.php@@ -0,0 +1,36 @@+<?php++use Illuminate\Database\Migrations\Migration;+use Illuminate\Database\Schema\Blueprint;+use Illuminate\Support\Facades\Schema;++return new class extends Migration+{+ /**+ * Run the migrations.+ */+ public function up(): void+ {+ Schema::table('application_settings', function (Blueprint $table) {+ $table->boolean('is_gzip_enabled')->default(true);+ $table->boolean('is_stripprefix_enabled')->default(true);+ });+ Schema::table('service_applications', function (Blueprint $table) {+ $table->boolean('is_stripprefix_enabled')->default(true);+ });+ }++ /**+ * Reverse the migrations.+ */+ public function down(): void+ {+ Schema::table('application_settings', function (Blueprint $table) {+ $table->dropColumn('is_gzip_enabled');+ $table->dropColumn('is_stripprefix_enabled');+ });+ Schema::table('service_applications', function (Blueprint $table) {+ $table->dropColumn('is_stripprefix_enabled');+ });+ }+};diff --git a/resources/views/livewire/project/application/advanced.blade.php b/resources/views/livewire/project/application/advanced.blade.phpindex e88fb8a27d..d4566a2b25 100644--- a/resources/views/livewire/project/application/advanced.blade.php+++ b/resources/views/livewire/project/application/advanced.blade.php@@ -20,6 +20,11 @@helper="The deployed container will have the same name ({{ $application->uuid }}). <span class='font-bold text-warning'>You will lose the rolling update feature!</span>"instantSave id="application.settings.is_consistent_container_name_enabled"label="Consistent Container Names" />+ <x-forms.checkbox label="Enable gzip compression"+ helper="You can disable gzip compression if you want. Some services are compressing data by default. In this case, you do not need this."+ instantSave id="is_gzip_enabled" />+ <x-forms.checkbox helper="Strip Prefix is used to remove prefixes from paths. Like /api/ to /api."+ instantSave id="is_stripprefix_enabled" label="Strip Prefixes" /><h3>Logs</h3>@if (!$application->settings->is_raw_compose_deployment_enabled)<x-forms.checkbox helper="Drain logs to your configured log drain endpoint in your Server settings."diff --git a/resources/views/livewire/project/service/service-application-view.blade.php b/resources/views/livewire/project/service/service-application-view.blade.phpindex a696533852..5c792b048e 100644--- a/resources/views/livewire/project/service/service-application-view.blade.php+++ b/resources/views/livewire/project/service/service-application-view.blade.php@@ -34,7 +34,9 @@<h3 class="pt-2">Advanced</h3><div class="w-96"><x-forms.checkbox instantSave id="application.is_gzip_enabled" label="Enable gzip compression"- helper="You can disable gzip compression if you want. Some services are compressing data by default. In this case, you do not need this." />+ helper="You can disable gzip compression if you want. Some services are compressing data by default. In this case, you do not need this." />+ <x-forms.checkbox instantSave id="application.is_stripprefix_enabled" label="Strip Prefixes"+ helper="Strip Prefix is used to remove prefixes from paths. Like /api/ to /api." /><x-forms.checkbox instantSave label="Exclude from service status"helper="If you do not need to monitor this resource, enable. Useful if this service is optional."id="application.exclude_from_status"></x-forms.checkbox>diff --git a/resources/views/livewire/server/log-drains.blade.php b/resources/views/livewire/server/log-drains.blade.phpindex 496f603697..3936bf5f9a 100644--- a/resources/views/livewire/server/log-drains.blade.php+++ b/resources/views/livewire/server/log-drains.blade.php@@ -12,7 +12,7 @@</div><div class="flex flex-col gap-4"><div class="flex flex-col w-full gap-2 xl:flex-row">- @if ($server->isLogDrainEnabled())+ @if ($server->is_log_drain_enabled())<x-forms.input disabled type="password" requiredid="server.settings.logdrain_newrelic_license_key" label="License Key" /><x-forms.input disabled required id="server.settings.logdrain_newrelic_base_uri"@@ -44,7 +44,7 @@<form wire:submit='submit("axiom")' class="flex flex-col"><div class="flex flex-col gap-4"><div class="flex flex-col w-full gap-2 xl:flex-row">- @if ($server->isLogDrainEnabled())+ @if ($server->is_log_drain_enabled())<x-forms.input disabled type="password" required id="server.settings.logdrain_axiom_api_key"label="API Key" /><x-forms.input disabled required id="server.settings.logdrain_axiom_dataset_name"@@ -88,7 +88,7 @@</div><form wire:submit='submit("custom")' class="flex flex-col"><div class="flex flex-col gap-4">- @if ($server->isLogDrainEnabled())+ @if ($server->is_log_drain_enabled())<x-forms.textarea disabled rows="6" required id="server.settings.logdrain_custom_config"label="Custom FluentBit Configuration" /><x-forms.textarea disabled id="server.settings.logdrain_custom_config_parser"