send new vars to logdrain
This commit is contained in:
@@ -85,6 +85,7 @@ class StartClickhouse
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class StartDragonfly
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ class StartKeydb
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class StartMariadb
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ class StartMongodb
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class StartMysql
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class StartPostgresql
|
|||||||
{
|
{
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
$container_name = $this->database->uuid;
|
$container_name = $this->database->uuid;
|
||||||
$this->configuration_dir = database_configuration_dir().'/'.$container_name;
|
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
|
||||||
|
|
||||||
$this->commands = [
|
$this->commands = [
|
||||||
"echo 'Starting {$database->name}.'",
|
"echo 'Starting {$database->name}.'",
|
||||||
@@ -87,6 +87,7 @@ class StartPostgresql
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -109,7 +110,7 @@ class StartPostgresql
|
|||||||
$docker_compose['services'][$container_name]['volumes'][] = [
|
$docker_compose['services'][$container_name]['volumes'][] = [
|
||||||
'type' => 'bind',
|
'type' => 'bind',
|
||||||
'source' => $init_script,
|
'source' => $init_script,
|
||||||
'target' => '/docker-entrypoint-initdb.d/'.basename($init_script),
|
'target' => '/docker-entrypoint-initdb.d/' . basename($init_script),
|
||||||
'read_only' => true,
|
'read_only' => true,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -117,7 +118,7 @@ class StartPostgresql
|
|||||||
if (! is_null($this->database->postgres_conf) && ! empty($this->database->postgres_conf)) {
|
if (! is_null($this->database->postgres_conf) && ! empty($this->database->postgres_conf)) {
|
||||||
$docker_compose['services'][$container_name]['volumes'][] = [
|
$docker_compose['services'][$container_name]['volumes'][] = [
|
||||||
'type' => 'bind',
|
'type' => 'bind',
|
||||||
'source' => $this->configuration_dir.'/custom-postgres.conf',
|
'source' => $this->configuration_dir . '/custom-postgres.conf',
|
||||||
'target' => '/etc/postgresql/postgresql.conf',
|
'target' => '/etc/postgresql/postgresql.conf',
|
||||||
'read_only' => true,
|
'read_only' => true,
|
||||||
];
|
];
|
||||||
@@ -149,10 +150,10 @@ class StartPostgresql
|
|||||||
$local_persistent_volumes = [];
|
$local_persistent_volumes = [];
|
||||||
foreach ($this->database->persistentStorages as $persistentStorage) {
|
foreach ($this->database->persistentStorages as $persistentStorage) {
|
||||||
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
||||||
$local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
|
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
|
||||||
} else {
|
} else {
|
||||||
$volume_name = $persistentStorage->name;
|
$volume_name = $persistentStorage->name;
|
||||||
$local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
|
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,18 +184,18 @@ class StartPostgresql
|
|||||||
$environment_variables->push("$env->key=$env->real_value");
|
$environment_variables->push("$env->key=$env->real_value");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($environment_variables->filter(fn ($env) => str($env)->contains('POSTGRES_USER'))->isEmpty()) {
|
if ($environment_variables->filter(fn($env) => str($env)->contains('POSTGRES_USER'))->isEmpty()) {
|
||||||
$environment_variables->push("POSTGRES_USER={$this->database->postgres_user}");
|
$environment_variables->push("POSTGRES_USER={$this->database->postgres_user}");
|
||||||
}
|
}
|
||||||
if ($environment_variables->filter(fn ($env) => str($env)->contains('PGUSER'))->isEmpty()) {
|
if ($environment_variables->filter(fn($env) => str($env)->contains('PGUSER'))->isEmpty()) {
|
||||||
$environment_variables->push("PGUSER={$this->database->postgres_user}");
|
$environment_variables->push("PGUSER={$this->database->postgres_user}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($environment_variables->filter(fn ($env) => str($env)->contains('POSTGRES_PASSWORD'))->isEmpty()) {
|
if ($environment_variables->filter(fn($env) => str($env)->contains('POSTGRES_PASSWORD'))->isEmpty()) {
|
||||||
$environment_variables->push("POSTGRES_PASSWORD={$this->database->postgres_password}");
|
$environment_variables->push("POSTGRES_PASSWORD={$this->database->postgres_password}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($environment_variables->filter(fn ($env) => str($env)->contains('POSTGRES_DB'))->isEmpty()) {
|
if ($environment_variables->filter(fn($env) => str($env)->contains('POSTGRES_DB'))->isEmpty()) {
|
||||||
$environment_variables->push("POSTGRES_DB={$this->database->postgres_db}");
|
$environment_variables->push("POSTGRES_DB={$this->database->postgres_db}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ class StartRedis
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class InstallLogDrain
|
|||||||
Name forward
|
Name forward
|
||||||
Buffer_Chunk_Size 1M
|
Buffer_Chunk_Size 1M
|
||||||
Buffer_Max_Size 6M
|
Buffer_Max_Size 6M
|
||||||
|
Tag docker.*
|
||||||
[FILTER]
|
[FILTER]
|
||||||
Name grep
|
Name grep
|
||||||
Match *
|
Match *
|
||||||
@@ -48,6 +49,10 @@ class InstallLogDrain
|
|||||||
Name modify
|
Name modify
|
||||||
Match *
|
Match *
|
||||||
Set server_name {$server->name}
|
Set server_name {$server->name}
|
||||||
|
Rename COOLIFY_APP_NAME coolify.app_name
|
||||||
|
Rename COOLIFY_PROJECT_NAME coolify.project_name
|
||||||
|
Rename COOLIFY_SERVER_IP coolify.server_ip
|
||||||
|
Rename COOLIFY_ENVIRONMENT_NAME coolify.environment_name
|
||||||
[OUTPUT]
|
[OUTPUT]
|
||||||
Name nrlogs
|
Name nrlogs
|
||||||
Match *
|
Match *
|
||||||
@@ -71,6 +76,7 @@ class InstallLogDrain
|
|||||||
tag ${HIGHLIGHT_PROJECT_ID}
|
tag ${HIGHLIGHT_PROJECT_ID}
|
||||||
Buffer_Chunk_Size 1M
|
Buffer_Chunk_Size 1M
|
||||||
Buffer_Max_Size 6M
|
Buffer_Max_Size 6M
|
||||||
|
Tag docker.*
|
||||||
[OUTPUT]
|
[OUTPUT]
|
||||||
Name forward
|
Name forward
|
||||||
Match *
|
Match *
|
||||||
@@ -91,6 +97,7 @@ class InstallLogDrain
|
|||||||
Name forward
|
Name forward
|
||||||
Buffer_Chunk_Size 1M
|
Buffer_Chunk_Size 1M
|
||||||
Buffer_Max_Size 6M
|
Buffer_Max_Size 6M
|
||||||
|
Tag docker.*
|
||||||
[FILTER]
|
[FILTER]
|
||||||
Name grep
|
Name grep
|
||||||
Match *
|
Match *
|
||||||
@@ -99,6 +106,10 @@ class InstallLogDrain
|
|||||||
Name modify
|
Name modify
|
||||||
Match *
|
Match *
|
||||||
Set server_name {$server->name}
|
Set server_name {$server->name}
|
||||||
|
Rename COOLIFY_APP_NAME coolify.app_name
|
||||||
|
Rename COOLIFY_PROJECT_NAME coolify.project_name
|
||||||
|
Rename COOLIFY_SERVER_IP coolify.server_ip
|
||||||
|
Rename COOLIFY_ENVIRONMENT_NAME coolify.environment_name
|
||||||
[OUTPUT]
|
[OUTPUT]
|
||||||
Name http
|
Name http
|
||||||
Match *
|
Match *
|
||||||
@@ -157,11 +168,11 @@ Files:
|
|||||||
$base_uri = $server->settings->logdrain_newrelic_base_uri;
|
$base_uri = $server->settings->logdrain_newrelic_base_uri;
|
||||||
$base_path = config('coolify.base_config_path');
|
$base_path = config('coolify.base_config_path');
|
||||||
|
|
||||||
$config_path = $base_path.'/log-drains';
|
$config_path = $base_path . '/log-drains';
|
||||||
$fluent_bit_config = $config_path.'/fluent-bit.conf';
|
$fluent_bit_config = $config_path . '/fluent-bit.conf';
|
||||||
$parsers_config = $config_path.'/parsers.conf';
|
$parsers_config = $config_path . '/parsers.conf';
|
||||||
$compose_path = $config_path.'/docker-compose.yml';
|
$compose_path = $config_path . '/docker-compose.yml';
|
||||||
$readme_path = $config_path.'/README.md';
|
$readme_path = $config_path . '/README.md';
|
||||||
$command = [
|
$command = [
|
||||||
"echo 'Saving configuration'",
|
"echo 'Saving configuration'",
|
||||||
"mkdir -p $config_path",
|
"mkdir -p $config_path",
|
||||||
|
|||||||
@@ -1756,6 +1756,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,27 +63,27 @@ function base_configuration_dir(): string
|
|||||||
}
|
}
|
||||||
function application_configuration_dir(): string
|
function application_configuration_dir(): string
|
||||||
{
|
{
|
||||||
return base_configuration_dir().'/applications';
|
return base_configuration_dir() . '/applications';
|
||||||
}
|
}
|
||||||
function service_configuration_dir(): string
|
function service_configuration_dir(): string
|
||||||
{
|
{
|
||||||
return base_configuration_dir().'/services';
|
return base_configuration_dir() . '/services';
|
||||||
}
|
}
|
||||||
function database_configuration_dir(): string
|
function database_configuration_dir(): string
|
||||||
{
|
{
|
||||||
return base_configuration_dir().'/databases';
|
return base_configuration_dir() . '/databases';
|
||||||
}
|
}
|
||||||
function database_proxy_dir($uuid): string
|
function database_proxy_dir($uuid): string
|
||||||
{
|
{
|
||||||
return base_configuration_dir()."/databases/$uuid/proxy";
|
return base_configuration_dir() . "/databases/$uuid/proxy";
|
||||||
}
|
}
|
||||||
function backup_dir(): string
|
function backup_dir(): string
|
||||||
{
|
{
|
||||||
return base_configuration_dir().'/backups';
|
return base_configuration_dir() . '/backups';
|
||||||
}
|
}
|
||||||
function metrics_dir(): string
|
function metrics_dir(): string
|
||||||
{
|
{
|
||||||
return base_configuration_dir().'/metrics';
|
return base_configuration_dir() . '/metrics';
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_readme_file(string $name, string $updated_at): string
|
function generate_readme_file(string $name, string $updated_at): string
|
||||||
@@ -118,8 +118,8 @@ function refreshSession(?Team $team = null): void
|
|||||||
$team = User::find(auth()->user()->id)->teams->first();
|
$team = User::find(auth()->user()->id)->teams->first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Cache::forget('team:'.auth()->user()->id);
|
Cache::forget('team:' . auth()->user()->id);
|
||||||
Cache::remember('team:'.auth()->user()->id, 3600, function () use ($team) {
|
Cache::remember('team:' . auth()->user()->id, 3600, function () use ($team) {
|
||||||
return $team;
|
return $team;
|
||||||
});
|
});
|
||||||
session(['currentTeam' => $team]);
|
session(['currentTeam' => $team]);
|
||||||
@@ -148,7 +148,7 @@ function handleError(?Throwable $error = null, ?Livewire\Component $livewire = n
|
|||||||
$message = null;
|
$message = null;
|
||||||
}
|
}
|
||||||
if ($customErrorMessage) {
|
if ($customErrorMessage) {
|
||||||
$message = $customErrorMessage.' '.$message;
|
$message = $customErrorMessage . ' ' . $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($livewire)) {
|
if (isset($livewire)) {
|
||||||
@@ -393,7 +393,7 @@ function send_user_an_email(MailMessage $mail, string $email, ?string $cc = null
|
|||||||
Mail::send(
|
Mail::send(
|
||||||
[],
|
[],
|
||||||
[],
|
[],
|
||||||
fn (Message $message) => $message
|
fn(Message $message) => $message
|
||||||
->to($email)
|
->to($email)
|
||||||
->replyTo($email)
|
->replyTo($email)
|
||||||
->cc($cc)
|
->cc($cc)
|
||||||
@@ -404,7 +404,7 @@ function send_user_an_email(MailMessage $mail, string $email, ?string $cc = null
|
|||||||
Mail::send(
|
Mail::send(
|
||||||
[],
|
[],
|
||||||
[],
|
[],
|
||||||
fn (Message $message) => $message
|
fn(Message $message) => $message
|
||||||
->to($email)
|
->to($email)
|
||||||
->subject($mail->subject)
|
->subject($mail->subject)
|
||||||
->html((string) $mail->render())
|
->html((string) $mail->render())
|
||||||
@@ -627,19 +627,19 @@ function queryResourcesByUuid(string $uuid)
|
|||||||
function generatTagDeployWebhook($tag_name)
|
function generatTagDeployWebhook($tag_name)
|
||||||
{
|
{
|
||||||
$baseUrl = base_url();
|
$baseUrl = base_url();
|
||||||
$api = Url::fromString($baseUrl).'/api/v1';
|
$api = Url::fromString($baseUrl) . '/api/v1';
|
||||||
$endpoint = "/deploy?tag=$tag_name";
|
$endpoint = "/deploy?tag=$tag_name";
|
||||||
$url = $api.$endpoint;
|
$url = $api . $endpoint;
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
function generateDeployWebhook($resource)
|
function generateDeployWebhook($resource)
|
||||||
{
|
{
|
||||||
$baseUrl = base_url();
|
$baseUrl = base_url();
|
||||||
$api = Url::fromString($baseUrl).'/api/v1';
|
$api = Url::fromString($baseUrl) . '/api/v1';
|
||||||
$endpoint = '/deploy';
|
$endpoint = '/deploy';
|
||||||
$uuid = data_get($resource, 'uuid');
|
$uuid = data_get($resource, 'uuid');
|
||||||
$url = $api.$endpoint."?uuid=$uuid&force=false";
|
$url = $api . $endpoint . "?uuid=$uuid&force=false";
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
@@ -650,7 +650,7 @@ function generateGitManualWebhook($resource, $type)
|
|||||||
}
|
}
|
||||||
if ($resource->getMorphClass() === 'App\Models\Application') {
|
if ($resource->getMorphClass() === 'App\Models\Application') {
|
||||||
$baseUrl = base_url();
|
$baseUrl = base_url();
|
||||||
$api = Url::fromString($baseUrl)."/webhooks/source/$type/events/manual";
|
$api = Url::fromString($baseUrl) . "/webhooks/source/$type/events/manual";
|
||||||
|
|
||||||
return $api;
|
return $api;
|
||||||
}
|
}
|
||||||
@@ -1819,7 +1819,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
|
|
||||||
if (! $isDatabase) {
|
if (! $isDatabase) {
|
||||||
if ($savedService->fqdn) {
|
if ($savedService->fqdn) {
|
||||||
data_set($savedService, 'fqdn', $savedService->fqdn.','.$fqdn);
|
data_set($savedService, 'fqdn', $savedService->fqdn . ',' . $fqdn);
|
||||||
} else {
|
} else {
|
||||||
data_set($savedService, 'fqdn', $fqdn);
|
data_set($savedService, 'fqdn', $fqdn);
|
||||||
}
|
}
|
||||||
@@ -1879,7 +1879,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
if (Str::lower($forService) === $serviceName) {
|
if (Str::lower($forService) === $serviceName) {
|
||||||
$fqdn = generateFqdn($resource->server, $containerName);
|
$fqdn = generateFqdn($resource->server, $containerName);
|
||||||
} else {
|
} else {
|
||||||
$fqdn = generateFqdn($resource->server, Str::lower($forService).'-'.$resource->uuid);
|
$fqdn = generateFqdn($resource->server, Str::lower($forService) . '-' . $resource->uuid);
|
||||||
}
|
}
|
||||||
if ($port) {
|
if ($port) {
|
||||||
$fqdn = "$fqdn:$port";
|
$fqdn = "$fqdn:$port";
|
||||||
@@ -2056,6 +2056,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -2083,7 +2084,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
updateCompose($savedService);
|
updateCompose($savedService);
|
||||||
|
|
||||||
return $service;
|
return $service;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$envs_from_coolify = $resource->environment_variables()->get();
|
$envs_from_coolify = $resource->environment_variables()->get();
|
||||||
@@ -2215,7 +2215,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$name = $volume->before(':');
|
$name = $volume->before(':');
|
||||||
$mount = $volume->after(':');
|
$mount = $volume->after(':');
|
||||||
if ($name->startsWith('.') || $name->startsWith('~')) {
|
if ($name->startsWith('.') || $name->startsWith('~')) {
|
||||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
$dir = base_configuration_dir() . '/applications/' . $resource->uuid;
|
||||||
if ($name->startsWith('.')) {
|
if ($name->startsWith('.')) {
|
||||||
$name = $name->replaceFirst('.', $dir);
|
$name = $name->replaceFirst('.', $dir);
|
||||||
}
|
}
|
||||||
@@ -2223,12 +2223,12 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$name = $name->replaceFirst('~', $dir);
|
$name = $name->replaceFirst('~', $dir);
|
||||||
}
|
}
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
$name = $name."-pr-$pull_request_id";
|
$name = $name . "-pr-$pull_request_id";
|
||||||
}
|
}
|
||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
} else {
|
} else {
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
$name = $name."-pr-$pull_request_id";
|
$name = $name . "-pr-$pull_request_id";
|
||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
if ($topLevelVolumes->has($name)) {
|
if ($topLevelVolumes->has($name)) {
|
||||||
$v = $topLevelVolumes->get($name);
|
$v = $topLevelVolumes->get($name);
|
||||||
@@ -2267,7 +2267,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$name = $volume->before(':');
|
$name = $volume->before(':');
|
||||||
$mount = $volume->after(':');
|
$mount = $volume->after(':');
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
$name = $name."-pr-$pull_request_id";
|
$name = $name . "-pr-$pull_request_id";
|
||||||
}
|
}
|
||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
}
|
}
|
||||||
@@ -2278,7 +2278,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$read_only = data_get($volume, 'read_only');
|
$read_only = data_get($volume, 'read_only');
|
||||||
if ($source && $target) {
|
if ($source && $target) {
|
||||||
if ((str($source)->startsWith('.') || str($source)->startsWith('~'))) {
|
if ((str($source)->startsWith('.') || str($source)->startsWith('~'))) {
|
||||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
$dir = base_configuration_dir() . '/applications/' . $resource->uuid;
|
||||||
if (str($source, '.')) {
|
if (str($source, '.')) {
|
||||||
$source = str($source)->replaceFirst('.', $dir);
|
$source = str($source)->replaceFirst('.', $dir);
|
||||||
}
|
}
|
||||||
@@ -2286,21 +2286,21 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$source = str($source)->replaceFirst('~', $dir);
|
$source = str($source)->replaceFirst('~', $dir);
|
||||||
}
|
}
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
$source = $source."-pr-$pull_request_id";
|
$source = $source . "-pr-$pull_request_id";
|
||||||
}
|
}
|
||||||
if ($read_only) {
|
if ($read_only) {
|
||||||
data_set($volume, 'source', $source.':'.$target.':ro');
|
data_set($volume, 'source', $source . ':' . $target . ':ro');
|
||||||
} else {
|
} else {
|
||||||
data_set($volume, 'source', $source.':'.$target);
|
data_set($volume, 'source', $source . ':' . $target);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
$source = $source."-pr-$pull_request_id";
|
$source = $source . "-pr-$pull_request_id";
|
||||||
}
|
}
|
||||||
if ($read_only) {
|
if ($read_only) {
|
||||||
data_set($volume, 'source', $source.':'.$target.':ro');
|
data_set($volume, 'source', $source . ':' . $target . ':ro');
|
||||||
} else {
|
} else {
|
||||||
data_set($volume, 'source', $source.':'.$target);
|
data_set($volume, 'source', $source . ':' . $target);
|
||||||
}
|
}
|
||||||
if (! str($source)->startsWith('/')) {
|
if (! str($source)->startsWith('/')) {
|
||||||
if ($topLevelVolumes->has($source)) {
|
if ($topLevelVolumes->has($source)) {
|
||||||
@@ -2339,7 +2339,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$name = $volume->before(':');
|
$name = $volume->before(':');
|
||||||
$mount = $volume->after(':');
|
$mount = $volume->after(':');
|
||||||
if ($name->startsWith('.') || $name->startsWith('~')) {
|
if ($name->startsWith('.') || $name->startsWith('~')) {
|
||||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
$dir = base_configuration_dir() . '/applications/' . $resource->uuid;
|
||||||
if ($name->startsWith('.')) {
|
if ($name->startsWith('.')) {
|
||||||
$name = $name->replaceFirst('.', $dir);
|
$name = $name->replaceFirst('.', $dir);
|
||||||
}
|
}
|
||||||
@@ -2347,13 +2347,13 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$name = $name->replaceFirst('~', $dir);
|
$name = $name->replaceFirst('~', $dir);
|
||||||
}
|
}
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
$name = $name."-pr-$pull_request_id";
|
$name = $name . "-pr-$pull_request_id";
|
||||||
}
|
}
|
||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
} else {
|
} else {
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
$uuid = $resource->uuid;
|
$uuid = $resource->uuid;
|
||||||
$name = $uuid."-$name-pr-$pull_request_id";
|
$name = $uuid . "-$name-pr-$pull_request_id";
|
||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
if ($topLevelVolumes->has($name)) {
|
if ($topLevelVolumes->has($name)) {
|
||||||
$v = $topLevelVolumes->get($name);
|
$v = $topLevelVolumes->get($name);
|
||||||
@@ -2372,7 +2372,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$uuid = $resource->uuid;
|
$uuid = $resource->uuid;
|
||||||
$name = str($uuid."-$name");
|
$name = str($uuid . "-$name");
|
||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
if ($topLevelVolumes->has($name->value())) {
|
if ($topLevelVolumes->has($name->value())) {
|
||||||
$v = $topLevelVolumes->get($name->value());
|
$v = $topLevelVolumes->get($name->value());
|
||||||
@@ -2395,7 +2395,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$name = $volume->before(':');
|
$name = $volume->before(':');
|
||||||
$mount = $volume->after(':');
|
$mount = $volume->after(':');
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
$name = $name."-pr-$pull_request_id";
|
$name = $name . "-pr-$pull_request_id";
|
||||||
}
|
}
|
||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
}
|
}
|
||||||
@@ -2407,7 +2407,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
if ($source && $target) {
|
if ($source && $target) {
|
||||||
$uuid = $resource->uuid;
|
$uuid = $resource->uuid;
|
||||||
if ((str($source)->startsWith('.') || str($source)->startsWith('~') || str($source)->startsWith('/'))) {
|
if ((str($source)->startsWith('.') || str($source)->startsWith('~') || str($source)->startsWith('/'))) {
|
||||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
$dir = base_configuration_dir() . '/applications/' . $resource->uuid;
|
||||||
if (str($source, '.')) {
|
if (str($source, '.')) {
|
||||||
$source = str($source)->replaceFirst('.', $dir);
|
$source = str($source)->replaceFirst('.', $dir);
|
||||||
}
|
}
|
||||||
@@ -2415,20 +2415,20 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$source = str($source)->replaceFirst('~', $dir);
|
$source = str($source)->replaceFirst('~', $dir);
|
||||||
}
|
}
|
||||||
if ($read_only) {
|
if ($read_only) {
|
||||||
data_set($volume, 'source', $source.':'.$target.':ro');
|
data_set($volume, 'source', $source . ':' . $target . ':ro');
|
||||||
} else {
|
} else {
|
||||||
data_set($volume, 'source', $source.':'.$target);
|
data_set($volume, 'source', $source . ':' . $target);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($pull_request_id === 0) {
|
if ($pull_request_id === 0) {
|
||||||
$source = $uuid."-$source";
|
$source = $uuid . "-$source";
|
||||||
} else {
|
} else {
|
||||||
$source = $uuid."-$source-pr-$pull_request_id";
|
$source = $uuid . "-$source-pr-$pull_request_id";
|
||||||
}
|
}
|
||||||
if ($read_only) {
|
if ($read_only) {
|
||||||
data_set($volume, 'source', $source.':'.$target.':ro');
|
data_set($volume, 'source', $source . ':' . $target . ':ro');
|
||||||
} else {
|
} else {
|
||||||
data_set($volume, 'source', $source.':'.$target);
|
data_set($volume, 'source', $source . ':' . $target);
|
||||||
}
|
}
|
||||||
if (! str($source)->startsWith('/')) {
|
if (! str($source)->startsWith('/')) {
|
||||||
if ($topLevelVolumes->has($source)) {
|
if ($topLevelVolumes->has($source)) {
|
||||||
@@ -2463,7 +2463,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
|
|
||||||
if ($pull_request_id !== 0 && count($serviceDependencies) > 0) {
|
if ($pull_request_id !== 0 && count($serviceDependencies) > 0) {
|
||||||
$serviceDependencies = $serviceDependencies->map(function ($dependency) use ($pull_request_id) {
|
$serviceDependencies = $serviceDependencies->map(function ($dependency) use ($pull_request_id) {
|
||||||
return $dependency."-pr-$pull_request_id";
|
return $dependency . "-pr-$pull_request_id";
|
||||||
});
|
});
|
||||||
data_set($service, 'depends_on', $serviceDependencies->toArray());
|
data_set($service, 'depends_on', $serviceDependencies->toArray());
|
||||||
}
|
}
|
||||||
@@ -2634,7 +2634,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
if (Str::lower($forService) === $serviceName) {
|
if (Str::lower($forService) === $serviceName) {
|
||||||
$fqdn = generateFqdn($server, $containerName);
|
$fqdn = generateFqdn($server, $containerName);
|
||||||
} else {
|
} else {
|
||||||
$fqdn = generateFqdn($server, Str::lower($forService).'-'.$resource->uuid);
|
$fqdn = generateFqdn($server, Str::lower($forService) . '-' . $resource->uuid);
|
||||||
}
|
}
|
||||||
if ($port) {
|
if ($port) {
|
||||||
$fqdn = "$fqdn:$port";
|
$fqdn = "$fqdn:$port";
|
||||||
@@ -2820,6 +2820,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
'fluentd-address' => 'tcp://127.0.0.1:24224',
|
||||||
'fluentd-async' => 'true',
|
'fluentd-async' => 'true',
|
||||||
'fluentd-sub-second-precision' => 'true',
|
'fluentd-sub-second-precision' => 'true',
|
||||||
|
'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -2843,7 +2844,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
});
|
});
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
$services->each(function ($service, $serviceName) use ($pull_request_id, $services) {
|
$services->each(function ($service, $serviceName) use ($pull_request_id, $services) {
|
||||||
$services[$serviceName."-pr-$pull_request_id"] = $service;
|
$services[$serviceName . "-pr-$pull_request_id"] = $service;
|
||||||
data_forget($services, $serviceName);
|
data_forget($services, $serviceName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user