Skip to content

Commit cc7f741

Browse files
authored
Merge branch 'next' into feat/open-version-new-tab
2 parents b8bcfb0 + ee54ecd commit cc7f741

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3939
-80
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ yarn-error.log
2222
/_data
2323
.rnd
2424
/.ssh
25+
.ignition.json

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ _ide_helper_models.php
3232
.rnd
3333
/.ssh
3434
scripts/load-test/*
35+
.ignition.json

app/Console/Commands/ServicesGenerate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public function handle()
3939
$serviceTemplatesJson[$name] = $parsed;
4040
}
4141
}
42-
$serviceTemplatesJson = json_encode($serviceTemplatesJson);
43-
file_put_contents(base_path('templates/service-templates.json'), $serviceTemplatesJson);
42+
$serviceTemplatesJson = json_encode($serviceTemplatesJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
43+
file_put_contents(base_path('templates/service-templates.json'), $serviceTemplatesJson.PHP_EOL);
4444
}
4545

4646
private function process_file($file)

app/Enums/StaticImageTypes.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace App\Enums;
4+
5+
enum StaticImageTypes: string
6+
{
7+
case NGINX_ALPINE = 'nginx:alpine';
8+
}

app/Http/Controllers/Api/ApplicationsController.php

Lines changed: 47 additions & 31 deletions
Large diffs are not rendered by default.

app/Livewire/Project/Application/General.php

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,19 @@ public function updatedApplicationBaseDirectory()
244244

245245
public function updatedApplicationFqdn()
246246
{
247-
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
248-
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
249-
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
250-
return str($domain)->trim()->lower();
251-
});
252-
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
247+
try {
248+
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
249+
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
250+
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
251+
return str($domain)->trim()->lower();
252+
});
253+
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
254+
$this->application->save();
255+
} catch (\Throwable $e) {
256+
$originalFqdn = $this->application->getOriginal('fqdn');
257+
$this->application->fqdn = $originalFqdn;
258+
return handleError($e, $this);
259+
}
253260
$this->resetDefaultLabels();
254261
}
255262

@@ -288,18 +295,22 @@ public function getWildcardDomain()
288295

289296
public function resetDefaultLabels()
290297
{
291-
if ($this->application->settings->is_container_label_readonly_enabled) {
292-
return;
293-
}
294-
$this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n");
295-
$this->ports_exposes = $this->application->ports_exposes;
296-
$this->is_container_label_escape_enabled = $this->application->settings->is_container_label_escape_enabled;
297-
$this->application->custom_labels = base64_encode($this->customLabels);
298-
$this->application->save();
299-
if ($this->application->build_pack === 'dockercompose') {
300-
$this->loadComposeFile();
298+
try {
299+
if ($this->application->settings->is_container_label_readonly_enabled) {
300+
return;
301+
}
302+
$this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n");
303+
$this->ports_exposes = $this->application->ports_exposes;
304+
$this->is_container_label_escape_enabled = $this->application->settings->is_container_label_escape_enabled;
305+
$this->application->custom_labels = base64_encode($this->customLabels);
306+
$this->application->save();
307+
if ($this->application->build_pack === 'dockercompose') {
308+
$this->loadComposeFile();
309+
}
310+
$this->dispatch('configurationChanged');
311+
} catch (\Throwable $e) {
312+
return handleError($e, $this);
301313
}
302-
$this->dispatch('configurationChanged');
303314
}
304315

305316
public function checkFqdns($showToaster = true)

app/Livewire/Project/Service/EditDomain.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ public function mount()
2323

2424
public function updatedApplicationFqdn()
2525
{
26-
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
27-
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
28-
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
29-
return str($domain)->trim()->lower();
30-
});
31-
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
32-
$this->application->save();
26+
try {
27+
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
28+
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
29+
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
30+
return str($domain)->trim()->lower();
31+
});
32+
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
33+
$this->application->save();
34+
} catch(\Throwable $e) {
35+
return handleError($e, $this);
36+
}
3337
}
3438

3539
public function submit()

app/Livewire/Project/Service/StackForm.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ public function mount()
3434
$value = data_get($field, 'value');
3535
$rules = data_get($field, 'rules', 'nullable');
3636
$isPassword = data_get($field, 'isPassword', false);
37+
$customHelper = data_get($field, 'customHelper', false);
3738
$this->fields->put($key, [
3839
'serviceName' => $serviceName,
3940
'key' => $key,
4041
'name' => $fieldKey,
4142
'value' => $value,
4243
'isPassword' => $isPassword,
4344
'rules' => $rules,
45+
'customHelper' => $customHelper,
4446
]);
4547

4648
$this->rules["fields.$key.value"] = $rules;

app/Models/ScheduledDatabaseBackup.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,19 @@ public function get_last_days_backup_status($days = 7)
3939
public function server()
4040
{
4141
if ($this->database) {
42-
if ($this->database->destination && $this->database->destination->server) {
43-
$server = $this->database->destination->server;
44-
42+
if ($this->database instanceof ServiceDatabase) {
43+
$destination = data_get($this->database->service, 'destination');
44+
$server = data_get($destination, 'server');
45+
} else {
46+
$destination = data_get($this->database, 'destination');
47+
$server = data_get($destination, 'server');
48+
}
49+
if ($server) {
4550
return $server;
4651
}
4752
}
4853

54+
4955
return null;
5056
}
5157
}

app/Models/Service.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,21 @@ public function extraFields()
288288
continue;
289289
}
290290
switch ($image) {
291+
case $image->contains('castopod'):
292+
$data = collect([]);
293+
$disable_https = $this->environment_variables()->where('key', 'CP_DISABLE_HTTPS')->first();
294+
if ($disable_https) {
295+
$data = $data->merge([
296+
'Disable HTTPS' => [
297+
'key' => 'CP_DISABLE_HTTPS',
298+
'value' => data_get($disable_https, 'value'),
299+
'rules' => 'required',
300+
'customHelper' => "If you want to use https, set this to 0. Variable name: CP_DISABLE_HTTPS",
301+
],
302+
]);
303+
}
304+
$fields->put('Castopod', $data->toArray());
305+
break;
291306
case $image->contains('label-studio'):
292307
$data = collect([]);
293308
$username = $this->environment_variables()->where('key', 'LABEL_STUDIO_USERNAME')->first();
@@ -982,8 +997,8 @@ public function extraFields()
982997
break;
983998
case $image->contains('mysql'):
984999
$userVariables = ['SERVICE_USER_MYSQL', 'SERVICE_USER_WORDPRESS', 'MYSQL_USER'];
985-
$passwordVariables = ['SERVICE_PASSWORD_MYSQL', 'SERVICE_PASSWORD_WORDPRESS', 'MYSQL_PASSWORD'];
986-
$rootPasswordVariables = ['SERVICE_PASSWORD_MYSQLROOT', 'SERVICE_PASSWORD_ROOT'];
1000+
$passwordVariables = ['SERVICE_PASSWORD_MYSQL', 'SERVICE_PASSWORD_WORDPRESS', 'MYSQL_PASSWORD','SERVICE_PASSWORD_64_MYSQL'];
1001+
$rootPasswordVariables = ['SERVICE_PASSWORD_MYSQLROOT', 'SERVICE_PASSWORD_ROOT','SERVICE_PASSWORD_64_MYSQLROOT'];
9871002
$dbNameVariables = ['MYSQL_DATABASE'];
9881003
$mysql_user = $this->environment_variables()->whereIn('key', $userVariables)->first();
9891004
$mysql_password = $this->environment_variables()->whereIn('key', $passwordVariables)->first();
@@ -1093,6 +1108,7 @@ public function saveExtraFields($fields)
10931108
foreach ($fields as $field) {
10941109
$key = data_get($field, 'key');
10951110
$value = data_get($field, 'value');
1111+
ray($key, $value);
10961112
$found = $this->environment_variables()->where('key', $key)->first();
10971113
if ($found) {
10981114
$found->value = $value;

0 commit comments

Comments
 (0)