Skip to content

Commit 9a766ae

Browse files
authored
Merge branch 'next' into improve-cleanup
2 parents f9dbc30 + 96b8ddf commit 9a766ae

File tree

208 files changed

+3582
-2761
lines changed

Some content is hidden

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

208 files changed

+3582
-2761
lines changed

.env.development.example

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ APP_KEY=
66
APP_URL=http://localhost
77
APP_PORT=8000
88
APP_DEBUG=true
9-
SSH_MUX_ENABLED=false
9+
SSH_MUX_ENABLED=true
1010

1111
# PostgreSQL Database Configuration
1212
DB_DATABASE=coolify
@@ -19,11 +19,7 @@ DB_PORT=5432
1919
# Set to true to enable Ray
2020
RAY_ENABLED=false
2121
# Set custom ray port
22-
RAY_PORT=
23-
24-
# Clockwork Configuration
25-
CLOCKWORK_ENABLED=false
26-
CLOCKWORK_QUEUE_COLLECT=true
22+
# RAY_PORT=
2723

2824
# Enable Laravel Telescope for debugging
2925
TELESCOPE_ENABLED=false

.github/pull_request_template.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
> Always use `next` branch as destination branch for PRs, not `main`
1+
## Submit Checklist (REMOVE THIS SECTION BEFORE SUBMITTING)
2+
- [ ] I have selected the `next` branch as the destination for my PR, not `main`.
3+
- [ ] I have listed all changes in the `Changes` section.
4+
- [ ] I have filled out the `Issues` section with the issue/discussion link(s) (if applicable).
5+
- [ ] I have tested my changes.
6+
- [ ] I have considered backwards compatibility.
7+
- [ ] I have removed this checklist and any unused sections.
8+
9+
## Changes
10+
-
11+
12+
## Issues
13+
- fix #

.github/workflows/remove-labels-and-assignees-on-close.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
github-token: ${{ secrets.GITHUB_TOKEN }}
1919
script: |
2020
const { owner, repo } = context.repo;
21-
21+
2222
async function processIssue(issueNumber) {
2323
try {
2424
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
@@ -65,11 +65,14 @@ jobs:
6565
}
6666
6767
if (context.eventName === 'pull_request' || context.eventName === 'pull_request_target') {
68-
const { data: closedIssues } = await github.rest.search.issuesAndPullRequests({
69-
q: `repo:${owner}/${repo} is:issue is:closed linked:${context.payload.pull_request.number}`,
70-
per_page: 100
71-
});
72-
for (const issue of closedIssues.items) {
73-
await processIssue(issue.number);
68+
const pr = context.payload.pull_request;
69+
if (pr.body) {
70+
const issueReferences = pr.body.match(/#(\d+)/g);
71+
if (issueReferences) {
72+
for (const reference of issueReferences) {
73+
const issueNumber = parseInt(reference.substring(1));
74+
await processIssue(issueNumber);
75+
}
76+
}
7477
}
7578
}

CONTRIBUTING.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ You can ask for guidance anytime on our [Discord server](https://coollabs.io/dis
66

77
## Table of Contents
88

9-
1. [Setup Development Environment](#1-setup-development-environment)
10-
2. [Verify Installation](#2-verify-installation-optional)
11-
3. [Fork and Setup Local Repository](#3-fork-and-setup-local-repository)
12-
4. [Set up Environment Variables](#4-set-up-environment-variables)
13-
5. [Start Coolify](#5-start-coolify)
14-
6. [Start Development](#6-start-development)
15-
7. [Development Notes](#7-development-notes)
16-
8. [Create a Pull Request](#8-create-a-pull-request)
17-
9. [Additional Contribution Guidelines](#additional-contribution-guidelines)
9+
- [Contributing to Coolify](#contributing-to-coolify)
10+
- [Table of Contents](#table-of-contents)
11+
- [1. Setup Development Environment](#1-setup-development-environment)
12+
- [2. Verify Installation (Optional)](#2-verify-installation-optional)
13+
- [3. Fork and Setup Local Repository](#3-fork-and-setup-local-repository)
14+
- [4. Set up Environment Variables](#4-set-up-environment-variables)
15+
- [5. Start Coolify](#5-start-coolify)
16+
- [6. Start Development](#6-start-development)
17+
- [7. Development Notes](#7-development-notes)
18+
- [8. Create a Pull Request](#8-create-a-pull-request)
19+
- [Additional Contribution Guidelines](#additional-contribution-guidelines)
20+
- [Contributing a New Service](#contributing-a-new-service)
21+
- [Contributing to Documentation](#contributing-to-documentation)
1822

1923
## 1. Setup Development Environment
2024

RELEASE.md

Lines changed: 100 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,120 @@
22

33
This guide outlines the release process for Coolify, intended for developers and those interested in understanding how releases are managed and deployed.
44

5+
## Table of Contents
6+
- [Release Process](#release-process)
7+
- [Version Types](#version-types)
8+
- [Stable](#stable)
9+
- [Nightly](#nightly)
10+
- [Beta](#beta)
11+
- [Version Availability](#version-availability)
12+
- [Self-Hosted](#self-hosted)
13+
- [Cloud](#cloud)
14+
- [Manually Update to Specific Versions](#manually-update-to-specific-versions)
15+
516
## Release Process
617

7-
1. **Development on `next` or separate branches**
8-
- Changes, fixes and new features are developed on the `next` or even separate branches.
18+
1. **Development on `next` or Feature Branches**
19+
- Improvements, fixes, and new features are developed on the `next` branch or separate feature branches.
920

1021
2. **Merging to `main`**
11-
- Once changes are ready, they are merged from `next` into the `main` branch.
22+
- Once ready, changes are merged from the `next` branch into the `main` branch.
1223

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.
24+
3. **Building the Release**
25+
- After merging to `main`, GitHub Actions automatically builds release images for all architectures and pushes them to the GitHub Container Registry with the version tag and the `latest` tag.
1626

17-
4. **Creating a GitHub release**
18-
- A new release is created on GitHub with the new version details.
27+
4. **Creating a GitHub Release**
28+
- A new GitHub release is manually created with details of the changes made in the version.
1929

2030
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)
31+
- To make a new version publicly available, the version information on the CDN needs to be updated: [https://cdn.coollabs.io/coolify/versions.json](https://cdn.coollabs.io/coolify/versions.json)
2332

2433
> [!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-
34+
> The CDN update may not occur immediately after the GitHub release. It can take hours or even days due to additional testing, stability checks, or potential hotfixes. **The update becomes available only after the CDN is updated.**
35+
36+
## Version Types
37+
38+
<details>
39+
<summary><strong>Stable (coming soon)</strong></summary>
40+
41+
- **Stable**
42+
- The production version suitable for stable, production environments (generally recommended).
43+
- **Update Frequency:** Every 2 to 4 weeks, with more frequent possible hotfixes.
44+
- **Release Size:** Larger but less frequent releases. Multiple nightly versions are consolidated into a single stable release.
45+
- **Versioning Scheme:** Follows semantic versioning (e.g., `v4.0.0`).
46+
- **Installation Command:**
47+
```bash
48+
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash
49+
```
50+
51+
</details>
52+
53+
<details>
54+
<summary><strong>Nightly</strong></summary>
55+
56+
- **Nightly**
57+
- The latest development version, suitable for testing the latest changes and experimenting with new features.
58+
- **Update Frequency:** Daily or bi-weekly updates.
59+
- **Release Size:** Smaller, more frequent releases.
60+
- **Versioning Scheme:** TO BE DETERMINED
61+
- **Installation Command:**
62+
```bash
63+
curl -fsSL https://cdn.coollabs.io/coolify-nightly/install.sh | bash -s next
64+
```
65+
66+
</details>
67+
68+
<details>
69+
<summary><strong>Beta</strong></summary>
70+
71+
- **Beta**
72+
- Test releases for the upcoming stable version.
73+
- **Purpose:** Allows users to test and provide feedback on new features and changes before they become stable.
74+
- **Update Frequency:** Available if we think beta testing is necessary.
75+
- **Release Size:** Same size as stable release as it will become the next stabe release after some time.
76+
- **Versioning Scheme:** Follows semantic versioning (e.g., `4.1.0-beta.1`).
77+
- **Installation Command:**
78+
```bash
79+
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash
80+
```
81+
82+
</details>
83+
84+
> [!WARNING]
85+
> Do not use nightly/beta builds in production as there is no guarantee of stability.
2786

2887
## Version Availability
2988

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).
89+
When a new version is released and a new GitHub release is created, it doesn't immediately become available for your instance. Here's how version availability works for different instance types.
90+
91+
### Self-Hosted
92+
93+
- **Update Frequency:** More frequent updates, especially on the nightly release channel.
94+
- **Update Availability:** New versions are available once the CDN has been updated.
95+
- **Update Methods:**
96+
1. **Manual Update in Instance Settings:**
97+
- Go to `Settings > Update Check Frequency` and click the `Check Manually` button.
98+
- If an update is available, an upgrade button will appear on the sidebar.
99+
2. **Automatic Update:**
100+
- If enabled, the instance will update automatically at the time set in the settings.
101+
3. **Re-run Installation Script:**
102+
- Run the installation script again to upgrade to the latest version available on the CDN:
103+
```bash
104+
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash
105+
```
106+
107+
> [!IMPORTANT]
108+
> If a new release is available on GitHub but your instance hasn't updated yet or no upgrade button is shown in the UI, the CDN might not have been updated yet. This intentional delay ensures stability and allows for hotfixes before official release.
109+
110+
### Cloud
111+
112+
- **Update Frequency:** Less frequent as it's a managed service.
113+
- **Update Availability:** New versions are available once Andras has updated the cloud version manually.
114+
- **Update Method:**
115+
- Updates are managed by Andras, who ensures each cloud version is thoroughly tested and stable before releasing it.
31116

32117
> [!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.
118+
> The cloud version of Coolify may be several versions behind the latest GitHub releases even if the CDN is updated. This is intentional to ensure stability and reliability for cloud users and Andras will manully update the cloud version when the update is ready.
34119

35120
## Manually Update to Specific Versions
36121

@@ -42,4 +127,4 @@ To update your Coolify instance to a specific (unreleased) version, use the foll
42127
```bash
43128
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash -s <version>
44129
```
45-
-> Replace `<version>` with the version you want to update to (for example `4.0.0-beta.332`).
130+
Replace `<version>` with the version you want to update to (for example `4.0.0-beta.332`).

app/Actions/Application/StopApplication.php

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,43 @@
22

33
namespace App\Actions\Application;
44

5+
use App\Actions\Server\CleanupDocker;
56
use App\Models\Application;
67
use Lorisleiva\Actions\Concerns\AsAction;
78

89
class StopApplication
910
{
1011
use AsAction;
1112

12-
public function handle(Application $application, bool $previewDeployments = false)
13+
public function handle(Application $application, bool $previewDeployments = false, bool $dockerCleanup = true)
1314
{
14-
if ($application->destination->server->isSwarm()) {
15-
instant_remote_process(["docker stack rm {$application->uuid}"], $application->destination->server);
16-
17-
return;
18-
}
19-
20-
$servers = collect([]);
21-
$servers->push($application->destination->server);
22-
$application->additional_servers->map(function ($server) use ($servers) {
23-
$servers->push($server);
24-
});
25-
foreach ($servers as $server) {
15+
try {
16+
$server = $application->destination->server;
2617
if (! $server->isFunctional()) {
2718
return 'Server is not functional';
2819
}
29-
if ($previewDeployments) {
30-
$containers = getCurrentApplicationContainerStatus($server, $application->id, includePullrequests: true);
31-
} else {
32-
$containers = getCurrentApplicationContainerStatus($server, $application->id, 0);
33-
}
34-
if ($containers->count() > 0) {
35-
foreach ($containers as $container) {
36-
$containerName = data_get($container, 'Names');
37-
if ($containerName) {
38-
instant_remote_process(command: ["docker stop --time=30 $containerName"], server: $server, throwError: false);
39-
instant_remote_process(command: ["docker rm $containerName"], server: $server, throwError: false);
40-
instant_remote_process(command: ["docker rm -f {$containerName}"], server: $server, throwError: false);
41-
}
42-
}
20+
ray('Stopping application: '.$application->name);
21+
22+
if ($server->isSwarm()) {
23+
instant_remote_process(["docker stack rm {$application->uuid}"], $server);
24+
25+
return;
4326
}
27+
28+
$containersToStop = $application->getContainersToStop($previewDeployments);
29+
$application->stopContainers($containersToStop, $server);
30+
4431
if ($application->build_pack === 'dockercompose') {
45-
// remove network
46-
$uuid = $application->uuid;
47-
instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server, false);
48-
instant_remote_process(["docker network rm {$uuid}"], $server, false);
32+
$application->delete_connected_networks($application->uuid);
4933
}
34+
35+
if ($dockerCleanup) {
36+
CleanupDocker::dispatch($server, true);
37+
}
38+
} catch (\Exception $e) {
39+
ray($e->getMessage());
40+
41+
return $e->getMessage();
5042
}
5143
}
5244
}

app/Actions/CoolifyTask/RunRemoteProcess.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\Enums\ActivityTypes;
66
use App\Enums\ProcessStatus;
7+
use App\Helpers\SshMultiplexingHelper;
78
use App\Jobs\ApplicationDeploymentJob;
89
use App\Models\Server;
910
use Illuminate\Process\ProcessResult;
@@ -137,7 +138,7 @@ protected function getCommand(): string
137138
$command = $this->activity->getExtraProperty('command');
138139
$server = Server::whereUuid($server_uuid)->firstOrFail();
139140

140-
return generateSshCommand($server, $command);
141+
return SshMultiplexingHelper::generateSshCommand($server, $command);
141142
}
142143

143144
protected function handleOutput(string $type, string $output)

app/Actions/Database/StartDragonfly.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function handle(StandaloneDragonfly $database)
2323
$startCommand = "dragonfly --requirepass {$this->database->dragonfly_password}";
2424

2525
$container_name = $this->database->uuid;
26-
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
26+
$this->configuration_dir = database_configuration_dir().'/'.$container_name;
2727

2828
$this->commands = [
2929
"echo 'Starting {$database->name}.'",
@@ -75,7 +75,7 @@ public function handle(StandaloneDragonfly $database)
7575
],
7676
],
7777
];
78-
if (!is_null($this->database->limits_cpuset)) {
78+
if (! is_null($this->database->limits_cpuset)) {
7979
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
8080
}
8181
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -118,10 +118,10 @@ private function generate_local_persistent_volumes()
118118
$local_persistent_volumes = [];
119119
foreach ($this->database->persistentStorages as $persistentStorage) {
120120
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
121-
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
121+
$local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
122122
} else {
123123
$volume_name = $persistentStorage->name;
124-
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
124+
$local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
125125
}
126126
}
127127

@@ -152,7 +152,7 @@ private function generate_environment_variables()
152152
$environment_variables->push("$env->key=$env->real_value");
153153
}
154154

155-
if ($environment_variables->filter(fn($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
155+
if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
156156
$environment_variables->push("REDIS_PASSWORD={$this->database->dragonfly_password}");
157157
}
158158

0 commit comments

Comments
 (0)