Skip to content

Commit de7380f

Browse files
authored
Merge pull request coollabsio#2423 from coollabsio/next
v4.0.0-beta.297
2 parents cc8f09f + 35bf4a1 commit de7380f

File tree

454 files changed

+5594
-3279
lines changed

Some content is hidden

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

454 files changed

+5594
-3279
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Fix PHP code style issues
2+
3+
on: [push]
4+
5+
permissions:
6+
contents: write
7+
8+
jobs:
9+
php-code-styling:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.head_ref }}
18+
19+
- name: Fix PHP code style issues
20+
uses: aglipanci/[email protected]
21+
22+
- name: Commit changes
23+
uses: stefanzweifel/git-auto-commit-action@v5
24+
with:
25+
commit_message: Fix styling

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,19 @@ https://coolify.io/sponsorships
3131

3232
Thank you so much!
3333

34-
Special thanks to our biggest sponsor, [CCCareers](https://cccareers.org/)!
34+
Special thanks to our biggest sponsors!
3535

3636
<a href="https://cccareers.org/" target="_blank"><img src="./other/logos/ccc-logo.webp" alt="cccareers logo" width="200"/></a>
37+
<a href="http://htznr.li/CoolifyXHetzner" target="_blank"><img src="./other/logos/hetzner.jpg" alt="hetzner logo" width="200"/></a>
38+
<a href="https://logto.io/?ref=coolify" target="_blank"><img src="./other/logos/logto.webp" alt="logto logo" width="200"/></a>
39+
<a href="https://bc.direct/?utm_source=coolify.io" target="_blank"><img src="./other/logos/bc.png" alt="bc direct logo" width="200"/></a>
40+
<a href="https://www.quantcdn.io/?utm_source=coolify.io" target="_blank"><img src="./other/logos/quant.svg" alt="quantcdn logo" width="200"/></a>
41+
<a href="https://arcjet.com/?utm_source=coolify.io" target="_blank"><img src="./other/logos/arcjet.svg" alt="arcjet logo" width="200"/></a>
42+
3743

3844
## Github Sponsors ($40+)
39-
<a href="https://bc.direct"><img width="60px" alt="BC Direct" src="https://github.com/coollabsio/coolify/assets/5845193/a4063c41-95ed-4a32-8814-cd1475572e37"/></a>
4045
<a href="https://serpapi.com/?utm_source=coolify.io"><img width="60px" alt="SerpAPI" src="https://github.com/serpapi.png"/></a>
4146
<a href="https://typebot.io/?utm_source=coolify.io"><img src="https://pbs.twimg.com/profile_images/1509194008366657543/9I-C7uWT_400x400.jpg" width="60px" alt="typebot"/></a>
42-
<a href="https://www.quantcdn.io/?utm_source=coolify.io"><img src="https://github.com/quantcdn.png" width="60px" alt="QuantCDN"/></a>
4347
<a href="https://www.runpod.io/?utm_source=coolify.io">
4448
<svg style="width:60px;height:60px;background:#fff;" xmlns="http://www.w3.org/2000/svg" version="1.0" viewBox="0 0 200 200"><g><path d="M74.5 51.1c-25.4 14.9-27 16-29.6 20.2-1.8 3-1.9 5.3-1.9 32.3 0 21.7.3 29.4 1.3 30.6 1.9 2.5 46.7 27.9 48.5 27.6 1.5-.3 1.7-3.1 2-27.7.2-21.9 0-27.8-1.1-29.5-.8-1.2-9.9-6.8-20.2-12.6-10.3-5.8-19.4-11.5-20.2-12.7-1.8-2.6-.9-5.9 1.8-7.4 1.6-.8 6.3 0 21.8 4C87.8 78.7 98 81 99.6 81c4.4 0 49.9-25.9 49.9-28.4 0-1.6-3.4-2.8-24-8.2-13.2-3.5-25.1-6.3-26.5-6.3-1.4.1-12.4 5.9-24.5 13z"></path><path d="m137.2 68.1-3.3 2.1 6.3 3.7c3.5 2 6.3 4.3 6.3 5.1 0 .9-8 6.1-19.4 12.6-10.6 6-20 11.9-20.7 12.9-1.2 1.6-1.4 7.2-1.2 29.4.3 24.8.5 27.6 2 27.9 1.8.3 46.6-25.1 48.6-27.6.9-1.2 1.2-8.8 1.2-30.2s-.3-29-1.2-30.2c-1.6-1.9-12.1-7.8-13.9-7.8-.8 0-2.9 1-4.7 2.1z"></path></g></svg></a>
4549
<a href="https://lightspeed.run/?utm_source=coolify.io"><img src="https://github.com/lightspeedrun.png" width="60px" alt="Lightspeed.run"/></a>

app/Actions/Application/StopApplication.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
namespace App\Actions\Application;
44

55
use App\Models\Application;
6-
use App\Models\StandaloneDocker;
7-
use App\Notifications\Application\StatusChanged;
86
use Lorisleiva\Actions\Concerns\AsAction;
97

108
class StopApplication
119
{
1210
use AsAction;
11+
1312
public function handle(Application $application)
1413
{
1514
if ($application->destination->server->isSwarm()) {
1615
instant_remote_process(["docker stack rm {$application->uuid}"], $application->destination->server);
16+
1717
return;
1818
}
1919

@@ -23,7 +23,7 @@ public function handle(Application $application)
2323
$servers->push($server);
2424
});
2525
foreach ($servers as $server) {
26-
if (!$server->isFunctional()) {
26+
if (! $server->isFunctional()) {
2727
return 'Server is not functional';
2828
}
2929
$containers = getCurrentApplicationContainerStatus($server, $application->id, 0);

app/Actions/Application/StopApplicationOneServer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
class StopApplicationOneServer
1010
{
1111
use AsAction;
12+
1213
public function handle(Application $application, Server $server)
1314
{
1415
if ($application->destination->server->isSwarm()) {
1516
return;
1617
}
17-
if (!$server->isFunctional()) {
18+
if (! $server->isFunctional()) {
1819
return 'Server is not functional';
1920
}
2021
try {
@@ -32,6 +33,7 @@ public function handle(Application $application, Server $server)
3233
}
3334
} catch (\Exception $e) {
3435
ray($e->getMessage());
36+
3537
return $e->getMessage();
3638
}
3739
}

app/Actions/CoolifyTask/PrepareCoolifyTask.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
class PrepareCoolifyTask
1515
{
1616
protected Activity $activity;
17+
1718
protected CoolifyTaskArgs $remoteProcessArgs;
1819

1920
public function __construct(CoolifyTaskArgs $remoteProcessArgs)
@@ -28,12 +29,12 @@ public function __construct(CoolifyTaskArgs $remoteProcessArgs)
2829
->withProperties($properties)
2930
->performedOn($remoteProcessArgs->model)
3031
->event($remoteProcessArgs->type)
31-
->log("[]");
32+
->log('[]');
3233
} else {
3334
$this->activity = activity()
3435
->withProperties($remoteProcessArgs->toArray())
3536
->event($remoteProcessArgs->type)
36-
->log("[]");
37+
->log('[]');
3738
}
3839
}
3940

@@ -42,6 +43,7 @@ public function __invoke(): Activity
4243
$job = new CoolifyTask($this->activity, ignore_errors: $this->remoteProcessArgs->ignore_errors, call_event_on_finish: $this->remoteProcessArgs->call_event_on_finish, call_event_data: $this->remoteProcessArgs->call_event_data);
4344
dispatch($job);
4445
$this->activity->refresh();
46+
4547
return $this->activity;
4648
}
4749
}

app/Actions/CoolifyTask/RunRemoteProcess.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static function decodeOutput(?Activity $activity = null): string
6969
return collect($decoded)
7070
->sortBy(fn ($i) => $i['order'])
7171
->map(fn ($i) => $i['output'])
72-
->implode("");
72+
->implode('');
7373
}
7474

7575
public function __invoke(): ProcessResult
@@ -91,7 +91,7 @@ public function __invoke(): ProcessResult
9191
if ($processResult->exitCode() == 0) {
9292
$status = ProcessStatus::FINISHED;
9393
}
94-
if ($processResult->exitCode() != 0 && !$this->ignore_errors) {
94+
if ($processResult->exitCode() != 0 && ! $this->ignore_errors) {
9595
$status = ProcessStatus::ERROR;
9696
}
9797
// if (($processResult->exitCode() == 0 && $this->is_finished) || $this->activity->properties->get('status') === ProcessStatus::FINISHED->value) {
@@ -109,14 +109,14 @@ public function __invoke(): ProcessResult
109109
'status' => $status->value,
110110
]);
111111
$this->activity->save();
112-
if ($processResult->exitCode() != 0 && !$this->ignore_errors) {
112+
if ($processResult->exitCode() != 0 && ! $this->ignore_errors) {
113113
throw new \RuntimeException($processResult->errorOutput(), $processResult->exitCode());
114114
}
115115
if ($this->call_event_on_finish) {
116116
try {
117117
if ($this->call_event_data) {
118118
event(resolve("App\\Events\\$this->call_event_on_finish", [
119-
"data" => $this->call_event_data,
119+
'data' => $this->call_event_data,
120120
]));
121121
} else {
122122
event(resolve("App\\Events\\$this->call_event_on_finish", [
@@ -127,6 +127,7 @@ public function __invoke(): ProcessResult
127127
ray($e);
128128
}
129129
}
130+
130131
return $processResult;
131132
}
132133

@@ -182,6 +183,7 @@ protected function getLatestCounter(): int
182183
if ($description === null || count($description) === 0) {
183184
return 1;
184185
}
186+
185187
return end($description)['order'] + 1;
186188
}
187189

app/Actions/Database/StartClickhouse.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@
44

55
use App\Models\StandaloneClickhouse;
66
use Illuminate\Support\Str;
7-
use Symfony\Component\Yaml\Yaml;
87
use Lorisleiva\Actions\Concerns\AsAction;
8+
use Symfony\Component\Yaml\Yaml;
99

1010
class StartClickhouse
1111
{
1212
use AsAction;
1313

1414
public StandaloneClickhouse $database;
15+
1516
public array $commands = [];
17+
1618
public string $configuration_dir;
1719

1820
public function handle(StandaloneClickhouse $database)
1921
{
2022
$this->database = $database;
2123

22-
2324
$container_name = $this->database->uuid;
24-
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
25+
$this->configuration_dir = database_configuration_dir().'/'.$container_name;
2526

2627
$this->commands = [
2728
"echo 'Starting {$database->name}.'",
@@ -57,35 +58,35 @@ public function handle(StandaloneClickhouse $database)
5758
'interval' => '5s',
5859
'timeout' => '5s',
5960
'retries' => 10,
60-
'start_period' => '5s'
61+
'start_period' => '5s',
6162
],
6263
'mem_limit' => $this->database->limits_memory,
6364
'memswap_limit' => $this->database->limits_memory_swap,
6465
'mem_swappiness' => $this->database->limits_memory_swappiness,
6566
'mem_reservation' => $this->database->limits_memory_reservation,
6667
'cpus' => (float) $this->database->limits_cpus,
6768
'cpu_shares' => $this->database->limits_cpu_shares,
68-
]
69+
],
6970
],
7071
'networks' => [
7172
$this->database->destination->network => [
7273
'external' => true,
7374
'name' => $this->database->destination->network,
7475
'attachable' => true,
75-
]
76-
]
76+
],
77+
],
7778
];
78-
if (!is_null($this->database->limits_cpuset)) {
79+
if (! is_null($this->database->limits_cpuset)) {
7980
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
8081
}
8182
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
8283
$docker_compose['services'][$container_name]['logging'] = [
8384
'driver' => 'fluentd',
8485
'options' => [
85-
'fluentd-address' => "tcp://127.0.0.1:24224",
86-
'fluentd-async' => "true",
87-
'fluentd-sub-second-precision' => "true",
88-
]
86+
'fluentd-address' => 'tcp://127.0.0.1:24224',
87+
'fluentd-async' => 'true',
88+
'fluentd-sub-second-precision' => 'true',
89+
],
8990
];
9091
}
9192
if (count($this->database->ports_mappings_array) > 0) {
@@ -111,6 +112,7 @@ public function handle(StandaloneClickhouse $database)
111112
$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml pull";
112113
$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml up -d";
113114
$this->commands[] = "echo 'Database started.'";
115+
114116
return remote_process($this->commands, $database->destination->server, callEventOnFinish: 'DatabaseStatusChanged');
115117
}
116118

@@ -119,12 +121,13 @@ private function generate_local_persistent_volumes()
119121
$local_persistent_volumes = [];
120122
foreach ($this->database->persistentStorages as $persistentStorage) {
121123
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
122-
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
124+
$local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
123125
} else {
124126
$volume_name = $persistentStorage->name;
125-
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
127+
$local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
126128
}
127129
}
130+
128131
return $local_persistent_volumes;
129132
}
130133

@@ -141,6 +144,7 @@ private function generate_local_persistent_volumes_only_volume_names()
141144
'external' => false,
142145
];
143146
}
147+
144148
return $local_persistent_volumes_names;
145149
}
146150

app/Actions/Database/StartDatabaseProxy.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,19 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St
6969
}
7070
if ($type === 'App\Models\StandaloneRedis') {
7171
$internalPort = 6379;
72-
} else if ($type === 'App\Models\StandalonePostgresql') {
72+
} elseif ($type === 'App\Models\StandalonePostgresql') {
7373
$internalPort = 5432;
74-
} else if ($type === 'App\Models\StandaloneMongodb') {
74+
} elseif ($type === 'App\Models\StandaloneMongodb') {
7575
$internalPort = 27017;
76-
} else if ($type === 'App\Models\StandaloneMysql') {
76+
} elseif ($type === 'App\Models\StandaloneMysql') {
7777
$internalPort = 3306;
78-
} else if ($type === 'App\Models\StandaloneMariadb') {
78+
} elseif ($type === 'App\Models\StandaloneMariadb') {
7979
$internalPort = 3306;
80-
} else if ($type === 'App\Models\StandaloneKeydb') {
80+
} elseif ($type === 'App\Models\StandaloneKeydb') {
8181
$internalPort = 6379;
82-
} else if ($type === 'App\Models\StandaloneDragonfly') {
82+
} elseif ($type === 'App\Models\StandaloneDragonfly') {
8383
$internalPort = 6379;
84-
} else if ($type === 'App\Models\StandaloneClickhouse') {
84+
} elseif ($type === 'App\Models\StandaloneClickhouse') {
8585
$internalPort = 9000;
8686
}
8787
$configuration_dir = database_proxy_dir($database->uuid);
@@ -101,7 +101,7 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St
101101
}
102102
}
103103
EOF;
104-
$dockerfile = <<< EOF
104+
$dockerfile = <<< 'EOF'
105105
FROM nginx:stable-alpine
106106
107107
COPY nginx.conf /etc/nginx/nginx.conf
@@ -113,7 +113,7 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St
113113
'context' => $configuration_dir,
114114
'dockerfile' => 'Dockerfile',
115115
],
116-
'image' => "nginx:stable-alpine",
116+
'image' => 'nginx:stable-alpine',
117117
'container_name' => $proxyContainerName,
118118
'restart' => RESTART_MODE,
119119
'ports' => [
@@ -130,17 +130,17 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St
130130
'interval' => '5s',
131131
'timeout' => '5s',
132132
'retries' => 3,
133-
'start_period' => '1s'
133+
'start_period' => '1s',
134134
],
135-
]
135+
],
136136
],
137137
'networks' => [
138138
$network => [
139139
'external' => true,
140140
'name' => $network,
141141
'attachable' => true,
142-
]
143-
]
142+
],
143+
],
144144
];
145145
$dockercompose_base64 = base64_encode(Yaml::dump($docker_compose, 4, 2));
146146
$nginxconf_base64 = base64_encode($nginxconf);

0 commit comments

Comments
 (0)