This commit is contained in:
Andras Bacsai
2024-10-17 22:08:23 +02:00
parent 9044c655b8
commit b75c2dc604
18 changed files with 62 additions and 51 deletions

View File

@@ -12,6 +12,7 @@ class GenerateConfig
public function handle(Application $application, bool $is_json = false)
{
ray()->clearAll();
return $application->generateConfig(is_json: $is_json);
}
}

View File

@@ -2,7 +2,6 @@
namespace App\Actions\Server;
use App\Models\InstanceSettings;
use App\Models\Server;
use Lorisleiva\Actions\Concerns\AsAction;

View File

@@ -3,7 +3,6 @@
namespace App\Actions\Server;
use App\Models\Server;
use Carbon\Carbon;
use Lorisleiva\Actions\Concerns\AsAction;
class StopSentinel

View File

@@ -241,7 +241,6 @@ class General extends Component
}
}
public function updatedApplicationBuildPack()
{
if ($this->application->build_pack !== 'nixpacks') {
@@ -335,6 +334,7 @@ class General extends Component
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
Url::fromString($domain, ['http', 'https']);
return str($domain)->trim()->lower();
});
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
@@ -409,11 +409,13 @@ class General extends Component
if ($originalFqdn !== $this->application->fqdn) {
$this->application->fqdn = $originalFqdn;
}
return handleError($e, $this);
} finally {
$this->dispatch('configurationChanged');
}
}
public function downloadConfig()
{
$config = GenerateConfig::run($this->application, true);

View File

@@ -317,6 +317,7 @@ class PublicGitRepository extends Component
// $application->setConfig($config);
// }
}
return redirect()->route('project.application.configuration', [
'application_uuid' => $application->uuid,
'environment_name' => $environment->name,

View File

@@ -21,6 +21,7 @@ class EditDomain extends Component
{
$this->application = ServiceApplication::find($this->applicationId);
}
public function submit()
{
try {
@@ -28,6 +29,7 @@ class EditDomain extends Component
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
Url::fromString($domain, ['http', 'https']);
return str($domain)->trim()->lower();
});
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
@@ -48,6 +50,7 @@ class EditDomain extends Component
if ($originalFqdn !== $this->application->fqdn) {
$this->application->fqdn = $originalFqdn;
}
return handleError($e, $this);
}
}

View File

@@ -39,7 +39,7 @@ class Navbar extends Component
return [
"echo-private:user.{$userId},ServiceStatusChanged" => 'serviceStarted',
"envsUpdated" => '$refresh',
'envsUpdated' => '$refresh',
];
}

View File

@@ -30,10 +30,7 @@ class ServiceApplicationView extends Component
'application.is_stripprefix_enabled' => 'nullable|boolean',
];
public function updatedApplicationFqdn()
{
}
public function updatedApplicationFqdn() {}
public function instantSave()
{
@@ -82,6 +79,7 @@ class ServiceApplicationView extends Component
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
Url::fromString($domain, ['http', 'https']);
return str($domain)->trim()->lower();
});
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
@@ -101,6 +99,7 @@ class ServiceApplicationView extends Component
if ($originalFqdn !== $this->application->fqdn) {
$this->application->fqdn = $originalFqdn;
}
return handleError($e, $this);
}
}

View File

@@ -8,8 +8,11 @@ use Livewire\Component;
class UploadConfig extends Component
{
public $config;
public $applicationId;
public function mount() {
public function mount()
{
if (isDev()) {
$this->config = '{
"build_pack": "nixpacks",
@@ -22,6 +25,7 @@ class UploadConfig extends Component
}';
}
}
public function uploadConfig()
{
try {
@@ -30,10 +34,12 @@ class UploadConfig extends Component
$this->dispatch('success', 'Application settings updated');
} catch (\Exception $e) {
$this->dispatch('error', $e->getMessage());
return;
}
}
public function render()
{
return view('livewire.project.shared.upload-config');

View File

@@ -29,7 +29,6 @@ class CloudflareTunnels extends Component
}
}
public function manualCloudflareConfig()
{
$this->server->settings->is_cloudflare_tunnel = true;

View File

@@ -30,6 +30,7 @@ class Delete extends Component
}
$this->server->delete();
DeleteServer::dispatch($this->server);
return redirect()->route('server.index');
} catch (\Throwable $e) {
return handleError($e, $this);

View File

@@ -47,6 +47,7 @@ class ShowPrivateKey extends Component
$this->dispatch('success', 'Server is reachable.');
} else {
$this->dispatch('error', 'Server is not reachable.<br><br>Check this <a target="_blank" class="underline" href="https://coolify.io/docs/knowledge-base/server/openssh">documentation</a> for further help.<br><br>Error: '.$error);
return;
}
} catch (\Throwable $e) {
@@ -56,6 +57,4 @@ class ShowPrivateKey extends Component
$this->server->refresh();
}
}
}

View File

@@ -28,6 +28,7 @@ class Index extends Component
protected string $dynamic_config_path = '/data/coolify/proxy/dynamic';
protected Server $server;
public $timezones;
protected $rules = [
@@ -57,7 +58,6 @@ class Index extends Component
'settings.instance_timezone' => 'Instance Timezone',
];
public function mount()
{
if (isInstanceAdmin()) {
@@ -171,7 +171,6 @@ class Index extends Component
}
}
public function render()
{
return view('livewire.settings.index');

View File

@@ -51,7 +51,6 @@ class ScheduledDatabaseBackup extends BaseModel
}
}
return null;
}
}

View File

@@ -528,12 +528,12 @@ $schema://$host {
Storage::disk('ssh-mux')->delete($this->muxFilename());
}
public function sentinelHeartbeat(bool $isReset = false)
{
$this->sentinel_updated_at = $isReset ? now()->subMinutes(6000) : now();
$this->save();
}
public function isSentinelLive()
{
return Carbon::parse($this->sentinel_updated_at)->isAfter(now()->subMinutes(4));
@@ -613,6 +613,7 @@ $schema://$host {
$parsedCollection = collect($cpu)->map(function ($metric) {
return [(int) $metric['time'], (float) $metric['percent']];
});
return $parsedCollection;
}
@@ -1092,6 +1093,7 @@ $schema://$host {
return true;
}
public function validateConnection($isManualCheck = true)
{
config()->set('constants.ssh.mux_enabled', ! $isManualCheck);

View File

@@ -109,6 +109,7 @@ class ServerSetting extends Model
if ($save) {
$this->save();
}
return $domain;
}

View File

@@ -297,7 +297,7 @@ class Service extends BaseModel
'key' => 'CP_DISABLE_HTTPS',
'value' => data_get($disable_https, 'value'),
'rules' => 'required',
'customHelper' => "If you want to use https, set this to 0. Variable name: CP_DISABLE_HTTPS",
'customHelper' => 'If you want to use https, set this to 0. Variable name: CP_DISABLE_HTTPS',
],
]);
}
@@ -1326,9 +1326,9 @@ class Service extends BaseModel
return false;
}
}
return true;
}
);
}
}

View File

@@ -335,6 +335,7 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
if (preg_match('/coolify\.traefik\.middlewares=(.*)/', $item, $matches)) {
return explode(',', $matches[1]);
}
return null;
})->flatten()
->filter()