Merge branch 'next' of github.com:coollabsio/coolify into next

This commit is contained in:
Andras Bacsai
2024-10-17 10:04:54 +02:00
5 changed files with 38 additions and 33 deletions

View File

@@ -63,6 +63,7 @@ class PushServerUpdateJob implements ShouldQueue
public Collection $foundApplicationPreviewsIds;
public bool $foundProxy = false;
public bool $foundLogDrainContainer = false;
public function backoff(): int
@@ -204,7 +205,8 @@ class PushServerUpdateJob implements ShouldQueue
}
private function serverStatus(){
private function serverStatus()
{
if ($this->server->isFunctional() === false) {
throw new \Exception('Server is not ready.');
}
@@ -212,6 +214,7 @@ class PushServerUpdateJob implements ShouldQueue
throw new \Exception('Server is not reachable.');
}
}
private function updateApplicationStatus(string $applicationId, string $containerStatus)
{
$application = $this->applications->where('id', $applicationId)->first();
@@ -278,7 +281,6 @@ class PushServerUpdateJob implements ShouldQueue
StartProxy::run($this->server, false);
}
} catch (\Throwable $e) {
logger()->error($e);
}
} else {
$connectProxyToDockerNetworks = connectProxyToNetworks($this->server);
@@ -396,7 +398,8 @@ class PushServerUpdateJob implements ShouldQueue
return str($containerStatus)->contains('running');
}
private function checkLogDrainContainer(){
private function checkLogDrainContainer()
{
if ($this->server->isLogDrainEnabled() && $this->foundLogDrainContainer === false) {
InstallLogDrain::dispatch($this->server);
}

View File

@@ -1427,9 +1427,11 @@ class Application extends BaseModel
$parsedCollection = collect($metrics)->map(function ($metric) {
return [(int) $metric['time'], (float) $metric['percent']];
});
return $parsedCollection->toArray();
}
}
public function getMemoryMetrics(int $mins = 5)
{
$server = $this->destination->server;
@@ -1455,9 +1457,9 @@ class Application extends BaseModel
}
$metrics = json_decode($metrics, true);
$parsedCollection = collect($metrics)->map(function ($metric) {
logger($metric);
return [(int) $metric['time'], (float) $metric['used']];
});
return $parsedCollection->toArray();
}
}
@@ -1492,6 +1494,7 @@ class Application extends BaseModel
return $config;
}
public function setConfig($config)
{

View File

@@ -17,7 +17,6 @@ class SentinelSeeder extends Seeder
}
if (str($server->settings->sentinel_custom_url)->isEmpty()) {
$url = $server->generateSentinelUrl();
logger()->info("Setting sentinel custom url for server {$server->id} to {$url}");
$server->settings->sentinel_custom_url = $url;
$server->settings->save();
}

View File

@@ -148,12 +148,12 @@ Route::group([
return response()->json(['message' => 'Server not found'], 404);
}
if ($server->settings->sentinel_token !== $naked_token) {
logger('Unauthorized');
return response()->json(['message' => 'Unauthorized'], 401);
}
$data = request()->all();
PushServerUpdateJob::dispatch($server, $data);
return response()->json(['message' => 'ok'], 200);
});
});

View File

@@ -12,9 +12,9 @@ services:
- SERVICE_FQDN_PLAUSIBLE
- DATABASE_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@plausible-db:5432/${POSTGRES_DB:-plausible-db}
- CLICKHOUSE_DATABASE_URL=http://plausible-events-db:8123/plausible_events_db
- BASE_URL=$SERVICE_FQDN_PLAUSIBLE
- SECRET_KEY_BASE=$SERVICE_BASE64_64_PLAUSIBLE
- TOTP_VAULT_KEY=$SERVICE_REALBASE64_32_TOTP
- BASE_URL=${SERVICE_FQDN_PLAUSIBLE}
- SECRET_KEY_BASE=${SERVICE_BASE64_64_PLAUSIBLE}
- TOTP_VAULT_KEY=${SERVICE_REALBASE64_32_TOTP}
depends_on:
plausible-db:
condition: service_healthy
@@ -30,7 +30,7 @@ services:
"--no-verbose",
"--tries=1",
"--spider",
"http://127.0.0.1:8000/ping",
"http://127.0.0.1:8000/api/health",
]
interval: 10s
timeout: 5s