Compare commits

...

19 Commits

Author SHA1 Message Date
Andras Bacsai
cf01d32237 Merge pull request #1960 from coollabsio/next
v4.0.0-beta.255
2024-04-10 08:36:45 +02:00
Andras Bacsai
5ec553f68d Reset default labels when application FQDN is updated 2024-04-10 08:21:06 +02:00
Andras Bacsai
d95e5a169d Update version numbers to 4.0.0-beta.255 2024-04-10 08:17:31 +02:00
Andras Bacsai
8debefddad Merge pull request #1955 from coollabsio/next
v4.0.0-beta.254
2024-04-09 13:17:02 +02:00
Andras Bacsai
bd25860ccf Add check for enabled tasks in scheduled tasks loop 2024-04-09 13:03:06 +02:00
Andras Bacsai
b21cb5c0e9 Update job schedules to run every two minutes instead of every minute 2024-04-09 13:02:22 +02:00
Andras Bacsai
ff79a2d3f4 Commented out ray() function call in remoteProcess.php 2024-04-09 13:02:16 +02:00
Andras Bacsai
9ae3743a58 Update job schedules and version numbers 2024-04-09 12:48:58 +02:00
Andras Bacsai
ffcdbcc802 Merge branch 'main' into next 2024-04-09 12:28:43 +02:00
Andras Bacsai
3ff78a3a47 Update version to 1.3.1 in install.sh 2024-04-09 12:28:11 +02:00
Andras Bacsai
4d78ac4789 Remove unnecessary sed command in install.sh script 2024-04-09 12:28:05 +02:00
Andras Bacsai
be24f2d520 Create SECURITY.md 2024-04-09 12:27:35 +02:00
Andras Bacsai
ff7fccb6a2 Merge pull request #1954 from coollabsio/next
v4.0.0-beta.253
2024-04-09 12:22:32 +02:00
Andras Bacsai
ee5a2b3c38 Add migration to make custom docker commands longer 2024-04-09 11:58:14 +02:00
Andras Bacsai
72b9001447 Fix error message in generate_github_installation_token function 2024-04-09 11:54:15 +02:00
Andras Bacsai
353245bb7d fix: hashed random delimeter in ssh commands + make sure to remove the delimeter from the command 2024-04-09 11:48:57 +02:00
Andras Bacsai
f9411bf0ed Remove debug statement in generateGitImportCommands function 2024-04-09 11:48:26 +02:00
Andras Bacsai
0eedbd2aa1 Update version numbers to 4.0.0-beta.253 2024-04-09 11:09:16 +02:00
Andras Bacsai
5e36c37838 Add coolify database and handle exceptions 2024-04-09 11:09:13 +02:00
12 changed files with 97 additions and 39 deletions

16
SECURITY.md Normal file
View File

@@ -0,0 +1,16 @@
# Security Policy
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| > 4 | :white_check_mark: |
| 3 | :x: |
## Reporting a Vulnerability
If you have any vulnerability please report at hi@coollabs.io

View File

@@ -121,6 +121,9 @@ class Kernel extends ConsoleKernel
return; return;
} }
foreach ($scheduled_tasks as $scheduled_task) { foreach ($scheduled_tasks as $scheduled_task) {
if ($scheduled_task->enabled === false) {
continue;
}
$service = $scheduled_task->service; $service = $scheduled_task->service;
$application = $scheduled_task->application; $application = $scheduled_task->application;

View File

@@ -177,6 +177,9 @@ class General extends Component
$this->loadComposeFile(); $this->loadComposeFile();
} }
} }
public function updatedApplicationFqdn() {
$this->resetDefaultLabels();
}
public function updatedApplicationBuildPack() public function updatedApplicationBuildPack()
{ {
if ($this->application->build_pack !== 'nixpacks') { if ($this->application->build_pack !== 'nixpacks') {
@@ -204,11 +207,13 @@ class General extends Component
$fqdn = generateFqdn($server, $this->application->uuid); $fqdn = generateFqdn($server, $this->application->uuid);
$this->application->fqdn = $fqdn; $this->application->fqdn = $fqdn;
$this->application->save(); $this->application->save();
$this->resetDefaultLabels();
$this->dispatch('success', 'Wildcard domain generated.'); $this->dispatch('success', 'Wildcard domain generated.');
} }
} }
public function resetDefaultLabels() public function resetDefaultLabels()
{ {
ray('resetDefaultLabels');
$this->customLabels = str(implode("|", generateLabelsApplication($this->application)))->replace("|", "\n"); $this->customLabels = str(implode("|", generateLabelsApplication($this->application)))->replace("|", "\n");
$this->ports_exposes = $this->application->ports_exposes; $this->ports_exposes = $this->application->ports_exposes;

View File

@@ -41,35 +41,39 @@ class Backup extends Component
} }
public function add_coolify_database() public function add_coolify_database()
{ {
$server = Server::find(0); try {
$out = instant_remote_process(['docker inspect coolify-db'], $server); $server = Server::findOrFail(0);
$envs = format_docker_envs_to_json($out); $out = instant_remote_process(['docker inspect coolify-db'], $server);
$postgres_password = $envs['POSTGRES_PASSWORD']; $envs = format_docker_envs_to_json($out);
$postgres_user = $envs['POSTGRES_USER']; $postgres_password = $envs['POSTGRES_PASSWORD'];
$postgres_db = $envs['POSTGRES_DB']; $postgres_user = $envs['POSTGRES_USER'];
$this->database = StandalonePostgresql::create([ $postgres_db = $envs['POSTGRES_DB'];
'id' => 0, $this->database = StandalonePostgresql::create([
'name' => 'coolify-db', 'id' => 0,
'description' => 'Coolify database', 'name' => 'coolify-db',
'postgres_user' => $postgres_user, 'description' => 'Coolify database',
'postgres_password' => $postgres_password, 'postgres_user' => $postgres_user,
'postgres_db' => $postgres_db, 'postgres_password' => $postgres_password,
'status' => 'running', 'postgres_db' => $postgres_db,
'destination_type' => 'App\Models\StandaloneDocker', 'status' => 'running',
'destination_id' => 0, 'destination_type' => 'App\Models\StandaloneDocker',
]); 'destination_id' => 0,
$this->backup = ScheduledDatabaseBackup::create([ ]);
'id' => 0, $this->backup = ScheduledDatabaseBackup::create([
'enabled' => true, 'id' => 0,
'save_s3' => false, 'enabled' => true,
'frequency' => '0 0 * * *', 'save_s3' => false,
'database_id' => $this->database->id, 'frequency' => '0 0 * * *',
'database_type' => 'App\Models\StandalonePostgresql', 'database_id' => $this->database->id,
'team_id' => currentTeam()->id, 'database_type' => 'App\Models\StandalonePostgresql',
]); 'team_id' => currentTeam()->id,
$this->database->refresh(); ]);
$this->backup->refresh(); $this->database->refresh();
$this->s3s = S3Storage::whereTeamId(0)->get(); $this->backup->refresh();
$this->s3s = S3Storage::whereTeamId(0)->get();
} catch (\Exception $e) {
return handleError($e, $this);
}
} }
public function backup_now() public function backup_now()

View File

@@ -621,7 +621,6 @@ class Application extends BaseModel
$commands->push("cd {$baseDir} && git fetch origin {$branch} && $git_checkout_command"); $commands->push("cd {$baseDir} && git fetch origin {$branch} && $git_checkout_command");
} }
} }
ray($commands);
return [ return [
'commands' => $commands->implode(' && '), 'commands' => $commands->implode(' && '),
'branch' => $branch, 'branch' => $branch,

View File

@@ -29,7 +29,7 @@ function generate_github_installation_token(GithubApp $source)
'Accept' => 'application/vnd.github.machine-man-preview+json' 'Accept' => 'application/vnd.github.machine-man-preview+json'
])->post("{$source->api_url}/app/installations/{$source->installation_id}/access_tokens"); ])->post("{$source->api_url}/app/installations/{$source->installation_id}/access_tokens");
if ($token->failed()) { if ($token->failed()) {
throw new RuntimeException("Failed to get access token for " . $source->name . " with error: " . $token->json()['message']); throw new RuntimeException("Failed to get access token for " . $source->name . " with error: " . data_get($token->json(),'message','no error message found'));
} }
return $token->json()['token']; return $token->json()['token'];
} }

View File

@@ -7,11 +7,10 @@ use App\Models\Application;
use App\Models\ApplicationDeploymentQueue; use App\Models\ApplicationDeploymentQueue;
use App\Models\PrivateKey; use App\Models\PrivateKey;
use App\Models\Server; use App\Models\Server;
use App\Notifications\Server\Revived;
use App\Notifications\Server\Unreachable;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Process; use Illuminate\Support\Facades\Process;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@@ -135,7 +134,6 @@ function generateSshCommand(Server $server, string $command)
$connectionTimeout = config('constants.ssh.connection_timeout'); $connectionTimeout = config('constants.ssh.connection_timeout');
$serverInterval = config('constants.ssh.server_interval'); $serverInterval = config('constants.ssh.server_interval');
$delimiter = 'EOF-COOLIFY-SSH';
$ssh_command = "timeout $timeout ssh "; $ssh_command = "timeout $timeout ssh ";
if (config('coolify.mux_enabled') && config('coolify.is_windows_docker_desktop') == false) { if (config('coolify.mux_enabled') && config('coolify.is_windows_docker_desktop') == false) {
@@ -145,6 +143,9 @@ function generateSshCommand(Server $server, string $command)
$ssh_command .= '-o ProxyCommand="/usr/local/bin/cloudflared access ssh --hostname %h" '; $ssh_command .= '-o ProxyCommand="/usr/local/bin/cloudflared access ssh --hostname %h" ';
} }
$command = "PATH=\$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/host/usr/local/sbin:/host/usr/local/bin:/host/usr/sbin:/host/usr/bin:/host/sbin:/host/bin && $command"; $command = "PATH=\$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/host/usr/local/sbin:/host/usr/local/bin:/host/usr/sbin:/host/usr/bin:/host/sbin:/host/bin && $command";
$delimiter = Hash::make($command);
$command = str_replace($delimiter, '', $command);
$ssh_command .= "-i {$privateKeyLocation} " $ssh_command .= "-i {$privateKeyLocation} "
. '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ' . '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
. '-o PasswordAuthentication=no ' . '-o PasswordAuthentication=no '
@@ -158,6 +159,7 @@ function generateSshCommand(Server $server, string $command)
. $command . PHP_EOL . $command . PHP_EOL
. $delimiter; . $delimiter;
// ray($ssh_command); // ray($ssh_command);
// ray($delimiter);
return $ssh_command; return $ssh_command;
} }
function instant_remote_process(Collection|array $command, Server $server, $throwError = true) function instant_remote_process(Collection|array $command, Server $server, $throwError = true)

View File

@@ -7,7 +7,7 @@ return [
// The release version of your application // The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.252', 'release' => '4.0.0-beta.255',
// When left empty or `null` the Laravel environment will be used // When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'), 'environment' => config('app.env'),

View File

@@ -1,3 +1,3 @@
<?php <?php
return '4.0.0-beta.252'; return '4.0.0-beta.255';

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->text('custom_docker_run_options')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->string('custom_docker_run_options')->nullable()->change();
});
}
};

View File

@@ -6,7 +6,7 @@ set -e # Exit immediately if a command exits with a non-zero status
#set -u # Treat unset variables as an error and exit #set -u # Treat unset variables as an error and exit
set -o pipefail # Cause a pipeline to return the status of the last command that exited with a non-zero status set -o pipefail # Cause a pipeline to return the status of the last command that exited with a non-zero status
VERSION="1.3.0" VERSION="1.3.1"
DOCKER_VERSION="24.0" DOCKER_VERSION="24.0"
CDN="https://cdn.coollabs.io/coolify" CDN="https://cdn.coollabs.io/coolify"
@@ -23,7 +23,7 @@ if [ "$OS_TYPE" = 'amzn' ]; then
dnf install -y findutils >/dev/null 2>&1 dnf install -y findutils >/dev/null 2>&1
fi fi
LATEST_VERSION=$(curl --silent $CDN/versions.json | grep -i version | sed -n '2p' | xargs | awk '{print $2}' | tr -d ',') LATEST_VERSION=$(curl --silent $CDN/versions.json | grep -i version | xargs | awk '{print $2}' | tr -d ',')
DATE=$(date +"%Y%m%d-%H%M%S") DATE=$(date +"%Y%m%d-%H%M%S")
if [ $EUID != 0 ]; then if [ $EUID != 0 ]; then

View File

@@ -1,7 +1,7 @@
{ {
"coolify": { "coolify": {
"v4": { "v4": {
"version": "4.0.0-beta.252" "version": "4.0.0-beta.255"
} }
} }
} }