Skip to content

Commit 894f2c6

Browse files
authored
Merge branch 'coollabsio:main' into add-debugbar
2 parents baa236f + 7ac45aa commit 894f2c6

25 files changed

+741
-339
lines changed

.env.development.example

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ APP_KEY=
66
APP_URL=http://localhost
77
APP_PORT=8000
88
APP_DEBUG=true
9-
MUX_ENABLED=false
10-
11-
# Enable Laravel Telescope for debugging
12-
TELESCOPE_ENABLED=false
13-
14-
# Selenium Driver URL for Dusk
15-
DUSK_DRIVER_URL=http://selenium:4444
9+
SSH_MUX_ENABLED=false
1610

1711
# PostgreSQL Database Configuration
1812
DB_DATABASE=coolify
@@ -27,6 +21,16 @@ RAY_ENABLED=false
2721
# Set custom ray port
2822
RAY_PORT=
2923

24+
# Clockwork Configuration
25+
CLOCKWORK_ENABLED=false
26+
CLOCKWORK_QUEUE_COLLECT=true
27+
28+
# Enable Laravel Telescope for debugging
29+
TELESCOPE_ENABLED=false
30+
31+
# Selenium Driver URL for Dusk
32+
DUSK_DRIVER_URL=http://selenium:4444
33+
3034
# Special Keys for Andras
3135
# For cache purging
3236
BUNNY_API_KEY=

.github/workflows/pr-build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ env:
1616
jobs:
1717
amd64:
1818
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
attestations: write
23+
id-token: write
1924
steps:
2025
- uses: actions/checkout@v4
2126
- name: Login to ghcr.io
@@ -37,6 +42,8 @@ jobs:
3742
permissions:
3843
contents: read
3944
packages: write
45+
attestations: write
46+
id-token: write
4047
steps:
4148
- uses: actions/checkout@v4
4249
- name: Login to ghcr.io
@@ -58,6 +65,8 @@ jobs:
5865
permissions:
5966
contents: read
6067
packages: write
68+
attestations: write
69+
id-token: write
6170
needs: [amd64, aarch64]
6271
steps:
6372
- name: Checkout

RELEASE.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Coolify Release Guide
2+
3+
This guide outlines the release process for Coolify, intended for developers and those interested in understanding how releases are managed and deployed.
4+
5+
## Release Process
6+
7+
1. **Development on `next` or separate branches**
8+
- Changes, fixes and new features are developed on the `next` or even separate branches.
9+
10+
2. **Merging to `main`**
11+
- Once changes are ready, they are merged from `next` into the `main` branch.
12+
13+
3. **Building the release**
14+
- After merging to `main`, a new release is built.
15+
- Note: A push to `main` does not automatically mean a new version is released.
16+
17+
4. **Creating a GitHub release**
18+
- A new release is created on GitHub with the new version details.
19+
20+
5. **Updating the CDN**
21+
- The final step is updating the version information on the CDN:
22+
[https://cdn.coollabs.io/coolify/versions.json](https://cdn.coollabs.io/coolify/versions.json)
23+
24+
> [!NOTE]
25+
> The CDN update may not occur immediately after the GitHub release. It can happen hours or even days later due to additional testing, stability checks, or potential hotfixes.
26+
27+
28+
## Version Availability
29+
30+
It's important to understand that a new version released on GitHub may not immediately become available for users to update (through manual or auto-update).
31+
32+
> [!IMPORTANT]
33+
> If you see a new release on GitHub but haven't received the update, it's likely because the CDN hasn't been updated yet. This is intentional and ensures stability and allows for hotfixes before the new version is officially released.
34+
35+
## Manually Update to Specific Versions
36+
37+
> [!CAUTION]
38+
> Updating to unreleased versions is not recommended and may cause issues. Use at your own risk!
39+
40+
To update your Coolify instance to a specific (unreleased) version, use the following command:
41+
42+
```bash
43+
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash -s <version>
44+
```
45+
-> Replace `<version>` with the version you want to update to (for example `4.0.0-beta.332`).

app/Jobs/DatabaseBackupJob.php

Lines changed: 10 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use Illuminate\Queue\Middleware\WithoutOverlapping;
2626
use Illuminate\Queue\SerializesModels;
2727
use Illuminate\Support\Str;
28-
use App\Models\InstanceSettings;
28+
use Visus\Cuid2\Cuid2;
2929

3030
class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
3131
{
@@ -399,6 +399,7 @@ private function backup_standalone_postgresql(string $database): void
399399
$backupCommand .= " $this->container_name pg_dump --format=custom --no-acl --no-owner --username {$this->database->postgres_user} $database > $this->backup_location";
400400

401401
$commands[] = $backupCommand;
402+
ray($commands);
402403
$this->backup_output = instant_remote_process($commands, $this->server);
403404
$this->backup_output = trim($this->backup_output);
404405
if ($this->backup_output === '') {
@@ -480,6 +481,7 @@ private function remove_old_backups(): void
480481
private function upload_to_s3(): void
481482
{
482483
try {
484+
ray($this->backup_location);
483485
if (is_null($this->s3)) {
484486
return;
485487
}
@@ -489,62 +491,20 @@ private function upload_to_s3(): void
489491
$bucket = $this->s3->bucket;
490492
$endpoint = $this->s3->endpoint;
491493
$this->s3->testConnection(shouldSave: true);
492-
if (data_get($this->backup, 'database_type') === 'App\Models\ServiceDatabase') {
493-
$network = $this->database->service->destination->network;
494-
} else {
495-
$network = $this->database->destination->network;
496-
}
497-
498-
$this->ensureHelperImageAvailable();
494+
$configName = new Cuid2;
499495

500-
$fullImageName = $this->getFullImageName();
501-
$commands[] = "docker run -d --network {$network} --name backup-of-{$this->backup->uuid} --rm -v $this->backup_location:$this->backup_location:ro {$fullImageName}";
502-
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret";
503-
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc cp $this->backup_location temporary/$bucket{$this->backup_dir}/";
496+
$s3_copy_dir = str($this->backup_location)->replace(backup_dir(), '/var/www/html/storage/app/backups/');
497+
$commands[] = "docker exec coolify bash -c 'mc config host add {$configName} {$endpoint} $key $secret'";
498+
$commands[] = "docker exec coolify bash -c 'mc cp $s3_copy_dir {$configName}/{$bucket}{$this->backup_dir}/'";
504499
instant_remote_process($commands, $this->server);
505500
$this->add_to_backup_output('Uploaded to S3.');
506501
} catch (\Throwable $e) {
507502
$this->add_to_backup_output($e->getMessage());
508503
throw $e;
509504
} finally {
510-
$command = "docker rm -f backup-of-{$this->backup->uuid}";
511-
instant_remote_process([$command], $this->server);
512-
}
513-
}
514-
515-
private function ensureHelperImageAvailable(): void
516-
{
517-
$fullImageName = $this->getFullImageName();
518-
519-
$imageExists = $this->checkImageExists($fullImageName);
520-
521-
if (!$imageExists) {
522-
$this->pullHelperImage($fullImageName);
505+
$removeConfigCommands[] = "docker exec coolify bash -c 'mc config remove {$configName}'";
506+
$removeConfigCommands[] = "docker exec coolify bash -c 'mc alias rm {$configName}'";
507+
instant_remote_process($removeConfigCommands, $this->server, false);
523508
}
524509
}
525-
526-
private function checkImageExists(string $fullImageName): bool
527-
{
528-
$result = instant_remote_process(["docker image inspect {$fullImageName} >/dev/null 2>&1 && echo 'exists' || echo 'not exists'"], $this->server, false);
529-
return trim($result) === 'exists';
530-
}
531-
532-
private function pullHelperImage(string $fullImageName): void
533-
{
534-
try {
535-
instant_remote_process(["docker pull {$fullImageName}"], $this->server);
536-
} catch (\Exception $e) {
537-
$errorMessage = "Failed to pull helper image: " . $e->getMessage();
538-
$this->add_to_backup_output($errorMessage);
539-
throw new \RuntimeException($errorMessage);
540-
}
541-
}
542-
543-
private function getFullImageName(): string
544-
{
545-
$settings = InstanceSettings::get();
546-
$helperImage = config('coolify.helper_image');
547-
$latestVersion = $settings->helper_version;
548-
return "{$helperImage}:{$latestVersion}";
549-
}
550510
}

app/Livewire/Boarding/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public function installServer()
282282
public function validateServer()
283283
{
284284
try {
285-
config()->set('coolify.mux_enabled', false);
285+
config()->set('constants.ssh.mux_enabled', false);
286286

287287
// EC2 does not have `uptime` command, lol
288288
instant_remote_process(['ls /'], $this->createdServer, true);

app/Livewire/Server/Form.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ class Form extends Component
2424

2525
public $timezones;
2626

27-
protected $listeners = ['serverInstalled', 'revalidate' => '$refresh'];
27+
protected $listeners = [
28+
'serverInstalled',
29+
'refreshServerShow' => 'serverInstalled',
30+
'revalidate' => '$refresh',
31+
];
2832

2933
protected $rules = [
3034
'server.name' => 'required',

app/Livewire/Server/New/ByIp.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace App\Livewire\Server\New;
44

5-
use App\Enums\ProxyStatus;
65
use App\Enums\ProxyTypes;
76
use App\Models\Server;
87
use App\Models\Team;
8+
use Illuminate\Support\Collection;
99
use Livewire\Component;
1010

1111
class ByIp extends Component
@@ -40,7 +40,7 @@ class ByIp extends Component
4040

4141
public bool $is_build_server = false;
4242

43-
public $swarm_managers = [];
43+
public Collection $swarm_managers;
4444

4545
protected $rules = [
4646
'name' => 'required|string',
@@ -102,11 +102,6 @@ public function submit()
102102
'port' => $this->port,
103103
'team_id' => currentTeam()->id,
104104
'private_key_id' => $this->private_key_id,
105-
'proxy' => [
106-
// set default proxy type to traefik v2
107-
'type' => ProxyTypes::TRAEFIK->value,
108-
'status' => ProxyStatus::EXITED->value,
109-
],
110105
];
111106
if ($this->is_swarm_worker) {
112107
$payload['swarm_cluster'] = $this->selected_swarm_cluster;
@@ -115,6 +110,9 @@ public function submit()
115110
data_forget($payload, 'proxy');
116111
}
117112
$server = Server::create($payload);
113+
$server->proxy->set('status', 'exited');
114+
$server->proxy->set('type', ProxyTypes::TRAEFIK->value);
115+
$server->save();
118116
if ($this->is_build_server) {
119117
$this->is_swarm_manager = false;
120118
$this->is_swarm_worker = false;

app/Livewire/Server/Show.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Show extends Component
1414

1515
public $parameters = [];
1616

17-
protected $listeners = ['refreshServerShow' => '$refresh'];
17+
protected $listeners = ['refreshServerShow'];
1818

1919
public function mount()
2020
{
@@ -29,6 +29,12 @@ public function mount()
2929
}
3030
}
3131

32+
public function refreshServerShow()
33+
{
34+
$this->server->refresh();
35+
$this->dispatch('$refresh');
36+
}
37+
3238
public function submit()
3339
{
3440
$this->dispatch('serverRefresh', false);

app/Models/Server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ public function isSwarmWorker()
967967

968968
public function validateConnection()
969969
{
970-
config()->set('coolify.mux_enabled', false);
970+
config()->set('constants.ssh.mux_enabled', false);
971971

972972
$server = Server::find($this->id);
973973
if (! $server) {

app/Models/Service.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ public function extraFields()
667667
}
668668
$data = $data->merge([
669669
'Root User' => [
670-
'key' => 'N/A',
670+
'key' => 'GITLAB_ROOT_USER',
671671
'value' => 'root',
672672
'rules' => 'required',
673673
'isPassword' => true,

0 commit comments

Comments
 (0)