Skip to content

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.

Add fluentd logging configuration for database & services

Andras Bacsai57738198ad67
diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.php
index d42b53c09c..3e32c24816 100644
--- a/app/Actions/Database/StartMariadb.php
+++ b/app/Actions/Database/StartMariadb.php
@@ -69,6 +69,16 @@ class StartMariadb
]
]
];
+ if ($this->database->destination->server->isDrainLogActivated()) {
+ $docker_compose['services'][$container_name]['logging'] = [
+ 'driver' => 'fluentd',
+ 'options' => [
+ 'fluentd-address' => "tcp://127.0.0.1:24224",
+ 'fluentd-async' => "true",
+ 'fluentd-sub-second-precision' => "true",
+ ]
+ ];
+ }
if (count($this->database->ports_mappings_array) > 0) {
$docker_compose['services'][$container_name]['ports'] = $this->database->ports_mappings_array;
}
diff --git a/app/Actions/Database/StartMongodb.php b/app/Actions/Database/StartMongodb.php
index c1f1b71df4..4ebbb9ec42 100644
--- a/app/Actions/Database/StartMongodb.php
+++ b/app/Actions/Database/StartMongodb.php
@@ -76,6 +76,16 @@ class StartMongodb
]
]
];
+ if ($this->database->destination->server->isDrainLogActivated()) {
+ $docker_compose['services'][$container_name]['logging'] = [
+ 'driver' => 'fluentd',
+ 'options' => [
+ 'fluentd-address' => "tcp://127.0.0.1:24224",
+ 'fluentd-async' => "true",
+ 'fluentd-sub-second-precision' => "true",
+ ]
+ ];
+ }
if (count($this->database->ports_mappings_array) > 0) {
$docker_compose['services'][$container_name]['ports'] = $this->database->ports_mappings_array;
}
diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.php
index 4cf4282b61..c3f04dc9f6 100644
--- a/app/Actions/Database/StartMysql.php
+++ b/app/Actions/Database/StartMysql.php
@@ -69,6 +69,16 @@ class StartMysql
]
]
];
+ if ($this->database->destination->server->isDrainLogActivated()) {
+ $docker_compose['services'][$container_name]['logging'] = [
+ 'driver' => 'fluentd',
+ 'options' => [
+ 'fluentd-address' => "tcp://127.0.0.1:24224",
+ 'fluentd-async' => "true",
+ 'fluentd-sub-second-precision' => "true",
+ ]
+ ];
+ }
if (count($this->database->ports_mappings_array) > 0) {
$docker_compose['services'][$container_name]['ports'] = $this->database->ports_mappings_array;
}
diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php
index 6eefd45ffa..1acdcf9572 100644
--- a/app/Actions/Database/StartPostgresql.php
+++ b/app/Actions/Database/StartPostgresql.php
@@ -79,6 +79,16 @@ class StartPostgresql
]
]
];
+ if ($this->database->destination->server->isDrainLogActivated()) {
+ $docker_compose['services'][$container_name]['logging'] = [
+ 'driver' => 'fluentd',
+ 'options' => [
+ 'fluentd-address' => "tcp://127.0.0.1:24224",
+ 'fluentd-async' => "true",
+ 'fluentd-sub-second-precision' => "true",
+ ]
+ ];
+ }
if (count($this->database->ports_mappings_array) > 0) {
$docker_compose['services'][$container_name]['ports'] = $this->database->ports_mappings_array;
}
diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.php
index a585678b34..0cbd01f63f 100644
--- a/app/Actions/Database/StartRedis.php
+++ b/app/Actions/Database/StartRedis.php
@@ -78,6 +78,16 @@ class StartRedis
]
]
];
+ if ($this->database->destination->server->isDrainLogActivated()) {
+ $docker_compose['services'][$container_name]['logging'] = [
+ 'driver' => 'fluentd',
+ 'options' => [
+ 'fluentd-address' => "tcp://127.0.0.1:24224",
+ 'fluentd-async' => "true",
+ 'fluentd-sub-second-precision' => "true",
+ ]
+ ];
+ }
if (count($this->database->ports_mappings_array) > 0) {
$docker_compose['services'][$container_name]['ports'] = $this->database->ports_mappings_array;
}
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 55dbefeddd..25c6c879c7 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -864,7 +864,6 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
]
]
];
- ray($this->server->isDrainLogActivated());
if ($this->server->isDrainLogActivated()) {
$docker_compose['services'][$this->container_name]['logging'] = [
'driver' => 'fluentd',
diff --git a/app/Models/Service.php b/app/Models/Service.php
index 320d53dedd..76c88eb856 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -797,6 +797,16 @@ class Service extends BaseModel
$serviceLabels = $serviceLabels->merge(fqdnLabelsForTraefik($this->uuid, $fqdns, true));
}
}
+ if ($this->server->isDrainLogActivated()) {
+ data_set($service, 'logging', [
+ 'driver' => 'fluentd',
+ 'options' => [
+ 'fluentd-address' => "tcp://127.0.0.1:24224",
+ 'fluentd-async' => "true",
+ 'fluentd-sub-second-precision' => "true",
+ ]
+ ]);
+ }
data_set($service, 'labels', $serviceLabels->toArray());
data_forget($service, 'is_database');
data_set($service, 'restart', RESTART_MODE);