Compare commits

...

19 Commits

Author SHA1 Message Date
Andras Bacsai
e83aecebc3 Merge pull request #3559 from coollabsio/next
v4.0.0-beta.344
2024-09-26 12:22:48 +02:00
Andras Bacsai
0bb1f57ea7 fix: deploy key based deployments 2024-09-26 12:19:49 +02:00
Andras Bacsai
d006edc485 refactor: Add localhost as Server if it doesn't exist and not in cloud environment 2024-09-26 10:37:02 +02:00
Andras Bacsai
aa28c99827 refactor: Update OS_TYPE for Asahi Linux in install.sh script 2024-09-26 10:36:59 +02:00
Andras Bacsai
567bbe9d0b chore: Update version numbers to 4.0.0-beta.344 2024-09-25 10:27:51 +02:00
Andras Bacsai
59d2c9748a fix: make sure to reload window if app status changes 2024-09-25 10:27:23 +02:00
Andras Bacsai
bd2e1ad9fe refactor: Fix typo in execute-container-command.blade.php 2024-09-25 10:25:35 +02:00
Andras Bacsai
43df918e43 Merge pull request #3550 from coollabsio/next
v4.0.0-beta.343
2024-09-25 09:29:54 +02:00
Andras Bacsai
1a8d15390d refactor: Update confirmation label in danger.blade.php template 2024-09-25 09:27:17 +02:00
Andras Bacsai
4af6caa79c refactor: Update checkbox component to support full width option 2024-09-25 09:16:28 +02:00
Andras Bacsai
8e91d958be refactor: Improve layout and add checkbox for task enablement in scheduled task form 2024-09-24 21:29:55 +02:00
Andras Bacsai
17d55630d5 refactor: Group and sort fields in StackForm by service name and password status 2024-09-24 21:17:07 +02:00
Andras Bacsai
70dfa101ef refactor: Improve label positioning in input and checkbox components 2024-09-24 21:04:04 +02:00
Andras Bacsai
d6b4e33db3 fix: exited services statuses 2024-09-24 20:40:41 +02:00
Andras Bacsai
a9670bd6eb refactor: Remove commented out code and improve environment variable handling in newParser function 2024-09-24 18:38:35 +02:00
Andras Bacsai
02165c2b9f chore: Update version numbers to 4.0.0-beta.343 2024-09-24 18:22:06 +02:00
Andras Bacsai
afbdd2eb06 fix: parser 2024-09-24 18:21:31 +02:00
Andras Bacsai
b0e6014e8f Merge pull request #3546 from coollabsio/dependabot/npm_and_yarn/rollup-3.29.5
chore(deps): bump rollup from 3.29.4 to 3.29.5
2024-09-24 14:34:17 +02:00
dependabot[bot]
0f13af2eca chore(deps): bump rollup from 3.29.4 to 3.29.5
Bumps [rollup](https://github.com/rollup/rollup) from 3.29.4 to 3.29.5.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v3.29.4...v3.29.5)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-24 12:27:43 +00:00
19 changed files with 142 additions and 147 deletions

View File

@@ -543,7 +543,7 @@ class GetContainersStatus
} }
} }
} }
$exitedServices = $exitedServices->unique('id'); $exitedServices = $exitedServices->unique('uuid');
foreach ($exitedServices as $exitedService) { foreach ($exitedServices as $exitedService) {
if (str($exitedService->status)->startsWith('exited')) { if (str($exitedService->status)->startsWith('exited')) {
continue; continue;

View File

@@ -1442,14 +1442,24 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
if ($this->pull_request_id !== 0) { if ($this->pull_request_id !== 0) {
$local_branch = "pull/{$this->pull_request_id}/head"; $local_branch = "pull/{$this->pull_request_id}/head";
} }
$private_key = $this->application->privateKey?->getKeyLocation(); $private_key = data_get($this->application, 'private_key.private_key');
if ($private_key) { if ($private_key) {
$private_key = base64_encode($private_key);
$this->execute_remote_command( $this->execute_remote_command(
[ [
executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i {$private_key}\" git ls-remote {$this->fullRepoUrl} {$local_branch}"), executeInDocker($this->deployment_uuid, 'mkdir -p /root/.ssh'),
],
[
executeInDocker($this->deployment_uuid, "echo '{$private_key}' | base64 -d | tee /root/.ssh/id_rsa > /dev/null"),
],
[
executeInDocker($this->deployment_uuid, 'chmod 600 /root/.ssh/id_rsa'),
],
[
executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\" git ls-remote {$this->fullRepoUrl} {$local_branch}"),
'hidden' => true, 'hidden' => true,
'save' => 'git_commit_sha', 'save' => 'git_commit_sha',
], ]
); );
} else { } else {
$this->execute_remote_command( $this->execute_remote_command(

View File

@@ -33,7 +33,7 @@ class StackForm extends Component
$key = data_get($field, 'key'); $key = data_get($field, 'key');
$value = data_get($field, 'value'); $value = data_get($field, 'value');
$rules = data_get($field, 'rules', 'nullable'); $rules = data_get($field, 'rules', 'nullable');
$isPassword = data_get($field, 'isPassword'); $isPassword = data_get($field, 'isPassword', false);
$this->fields->put($key, [ $this->fields->put($key, [
'serviceName' => $serviceName, 'serviceName' => $serviceName,
'key' => $key, 'key' => $key,
@@ -47,7 +47,15 @@ class StackForm extends Component
$this->validationAttributes["fields.$key.value"] = $fieldKey; $this->validationAttributes["fields.$key.value"] = $fieldKey;
} }
} }
$this->fields = $this->fields->sortBy('name'); $this->fields = $this->fields->groupBy('serviceName')->map(function ($group) {
return $group->sortBy(function ($field) {
return data_get($field, 'isPassword') ? 1 : 0;
})->mapWithKeys(function ($field) {
return [$field['key'] => $field];
});
})->flatMap(function ($group) {
return $group;
});
} }
public function saveCompose($raw) public function saveCompose($raw)

View File

@@ -9,6 +9,20 @@ use Livewire\Component;
class Terminal extends Component class Terminal extends Component
{ {
public function getListeners()
{
$teamId = auth()->user()->currentTeam()->id;
return [
"echo-private:team.{$teamId},ApplicationStatusChanged" => 'closeTerminal',
];
}
public function closeTerminal()
{
$this->dispatch('reloadWindow');
}
#[On('send-terminal-command')] #[On('send-terminal-command')]
public function sendTerminalCommand($isContainer, $identifier, $serverUuid) public function sendTerminalCommand($isContainer, $identifier, $serverUuid)
{ {

View File

@@ -2928,7 +2928,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
} }
$parsedServices = collect([]); $parsedServices = collect([]);
ray()->clearAll(); // ray()->clearAll();
$allMagicEnvironments = collect([]); $allMagicEnvironments = collect([]);
foreach ($services as $serviceName => $service) { foreach ($services as $serviceName => $service) {
@@ -3484,6 +3484,18 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
$value = $value->after('?'); $value = $value->after('?');
} }
if ($originalValue->value() === $value->value()) { if ($originalValue->value() === $value->value()) {
// This means the variable does not have a default value, so it needs to be created in Coolify
$parsedKeyValue = replaceVariables($value);
$resource->environment_variables()->where('key', $parsedKeyValue)->where($nameOfId, $resource->id)->firstOrCreate([
'key' => $parsedKeyValue,
$nameOfId => $resource->id,
], [
'is_build_time' => false,
'is_preview' => false,
]);
// Add the variable to the environment so it will be shown in the deployable compose file
$environment[$parsedKeyValue->value()] = $resource->environment_variables()->where('key', $parsedKeyValue)->where($nameOfId, $resource->id)->first()->value;
continue; continue;
} }
$resource->environment_variables()->where('key', $key)->where($nameOfId, $resource->id)->firstOrCreate([ $resource->environment_variables()->where('key', $key)->where($nameOfId, $resource->id)->firstOrCreate([
@@ -3576,6 +3588,17 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
if ($environment->count() > 0) { if ($environment->count() > 0) {
$environment = $environment->filter(function ($value, $key) { $environment = $environment->filter(function ($value, $key) {
return ! str($key)->startsWith('SERVICE_FQDN_'); return ! str($key)->startsWith('SERVICE_FQDN_');
})->map(function ($value, $key) use ($resource) {
// if value is empty, set it to null so if you set the environment variable in the .env file (Coolify's UI), it will used
if (str($value)->isEmpty()) {
if ($resource->environment_variables()->where('key', $key)->exists()) {
$value = $resource->environment_variables()->where('key', $key)->first()->value;
} else {
$value = null;
}
}
return $value;
}); });
} }
$serviceLabels = $labels->merge($defaultLabels); $serviceLabels = $labels->merge($defaultLabels);

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.342', 'release' => '4.0.0-beta.344',
// 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.342'; return '4.0.0-beta.344';

View File

@@ -65,7 +65,7 @@ class ProductionSeeder extends Seeder
]); ]);
} }
// Add Coolify host (localhost) as Server if it doesn't exist // Add Coolify host (localhost) as Server if it doesn't exist
if (Server::find(0) == null) { if (Server::find(0) == null && ! isCloud()) {
$server_details = [ $server_details = [
'id' => 0, 'id' => 0,
'name' => 'localhost', 'name' => 'localhost',
@@ -89,7 +89,7 @@ class ProductionSeeder extends Seeder
$server->settings->is_usable = true; $server->settings->is_usable = true;
$server->settings->save(); $server->settings->save();
} }
if (StandaloneDocker::find(0) == null) { if (StandaloneDocker::find(0) == null && ! isCloud()) {
StandaloneDocker::create([ StandaloneDocker::create([
'id' => 0, 'id' => 0,
'name' => 'localhost-coolify', 'name' => 'localhost-coolify',

View File

@@ -8,7 +8,7 @@ set -o pipefail # Cause a pipeline to return the status of the last command that
CDN="https://cdn.coollabs.io/coolify-nightly" CDN="https://cdn.coollabs.io/coolify-nightly"
DATE=$(date +"%Y%m%d-%H%M%S") DATE=$(date +"%Y%m%d-%H%M%S")
VERSION="1.5" VERSION="1.6"
DOCKER_VERSION="26.0" DOCKER_VERSION="26.0"
# TODO: Ask for a user # TODO: Ask for a user
CURRENT_USER=$USER CURRENT_USER=$USER
@@ -39,6 +39,11 @@ if [ "$OS_TYPE" = "manjaro" ] || [ "$OS_TYPE" = "manjaro-arm" ]; then
OS_TYPE="arch" OS_TYPE="arch"
fi fi
# Check if the OS is Asahi Linux, if so, change it to fedora
if [ "$OS_TYPE" = "fedora-asahi-remix" ]; then
OS_TYPE="fedora"
fi
# Check if the OS is popOS, if so, change it to ubuntu # Check if the OS is popOS, if so, change it to ubuntu
if [ "$OS_TYPE" = "pop" ]; then if [ "$OS_TYPE" = "pop" ]; then
OS_TYPE="ubuntu" OS_TYPE="ubuntu"

View File

@@ -1,10 +1,10 @@
{ {
"coolify": { "coolify": {
"v4": { "v4": {
"version": "4.0.0-beta.341" "version": "4.0.0-beta.344"
}, },
"nightly": { "nightly": {
"version": "4.0.0-beta.342" "version": "4.0.0-beta.345"
}, },
"helper": { "helper": {
"version": "1.0.1" "version": "1.0.1"

6
package-lock.json generated
View File

@@ -1860,9 +1860,9 @@
} }
}, },
"node_modules/rollup": { "node_modules/rollup": {
"version": "3.29.4", "version": "3.29.5",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.5.tgz",
"integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", "integrity": "sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==",
"dev": true, "dev": true,
"bin": { "bin": {
"rollup": "dist/bin/rollup" "rollup": "dist/bin/rollup"

View File

@@ -6,22 +6,26 @@
'instantSave' => false, 'instantSave' => false,
'value' => null, 'value' => null,
'hideLabel' => false, 'hideLabel' => false,
'fullWidth' => false,
]) ])
<div class="flex flex-row items-center gap-4 px-2 py-1 form-control min-w-fit dark:hover:bg-coolgray-100"> <div @class([
@if(!$hideLabel) 'flex flex-row items-center gap-4 px-2 py-1 form-control min-w-fit dark:hover:bg-coolgray-100',
<label class="flex gap-4 px-0 min-w-fit label"> 'w-full' => $fullWidth,
<span class="flex gap-2"> ])>
@if ($label) @if (!$hideLabel)
{!! $label !!} <label class="flex gap-4 px-0 min-w-fit label">
@else <span class="flex gap-2">
{{ $id }} @if ($label)
@endif {!! $label !!}
@if ($helper) @else
<x-helper :helper="$helper" /> {{ $id }}
@endif @endif
</span> @if ($helper)
</label> <x-helper :helper="$helper" />
@endif
</span>
</label>
@endif @endif
<span class="flex-grow"></span> <span class="flex-grow"></span>
<input @disabled($disabled) type="checkbox" {{ $attributes->merge(['class' => $defaultClass]) }} <input @disabled($disabled) type="checkbox" {{ $attributes->merge(['class' => $defaultClass]) }}

View File

@@ -3,7 +3,7 @@
'w-full' => !$isMultiline, 'w-full' => !$isMultiline,
])> ])>
@if ($label) @if ($label)
<label class="flex items-center gap-1 mb-1 text-sm font-medium">{{ $label }} <label class="flex gap-1 items-center mb-1 text-sm font-medium">{{ $label }}
@if ($required) @if ($required)
<x-highlighted text="*" /> <x-highlighted text="*" />
@endif @endif
@@ -16,7 +16,7 @@
<div class="relative" x-data="{ type: 'password' }"> <div class="relative" x-data="{ type: 'password' }">
@if ($allowToPeak) @if ($allowToPeak)
<div x-on:click="changePasswordFieldType" <div x-on:click="changePasswordFieldType"
class="absolute inset-y-0 right-0 flex items-center pr-2 cursor-pointer hover:dark:text-white"> class="flex absolute inset-y-0 right-0 items-center pr-2 cursor-pointer hover:dark:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" stroke-width="1.5" <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path stroke="none" d="M0 0h24v24H0z" fill="none" />

View File

@@ -139,7 +139,7 @@
@endif @endif
@else @else
@if ($buttonFullWidth) @if ($buttonFullWidth)
<x-forms.button @click="modalOpen=true" class="flex w-full gap-2" wire:target> <x-forms.button @click="modalOpen=true" class="flex gap-2 w-full" wire:target>
{{ $buttonTitle }} {{ $buttonTitle }}
</x-forms.button> </x-forms.button>
@else @else
@@ -162,17 +162,17 @@
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100" x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave-end="opacity-0 -translate-y-2 sm:scale-95" x-transition:leave-end="opacity-0 -translate-y-2 sm:scale-95"
class="relative w-full py-6 border rounded min-w-full lg:min-w-[36rem] max-w-[48rem] bg-neutral-100 border-neutral-400 dark:bg-base px-7 dark:border-coolgray-300"> class="relative w-full py-6 border rounded min-w-full lg:min-w-[36rem] max-w-[48rem] bg-neutral-100 border-neutral-400 dark:bg-base px-7 dark:border-coolgray-300">
<div class="flex items-center justify-between pb-3"> <div class="flex justify-between items-center pb-3">
<h3 class="text-2xl font-bold pr-8">{{ $title }}</h3> <h3 class="pr-8 text-2xl font-bold">{{ $title }}</h3>
<button @click="modalOpen = false; resetModal()" <button @click="modalOpen = false; resetModal()"
class="absolute top-2 right-2 flex items-center justify-center w-8 h-8 rounded-full dark:text-white hover:bg-coolgray-300"> class="flex absolute top-2 right-2 justify-center items-center w-8 h-8 rounded-full dark:text-white hover:bg-coolgray-300">
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" <svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke-width="1.5" stroke="currentColor"> stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /> <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg> </svg>
</button> </button>
</div> </div>
<div class="relative w-auto pb-8"> <div class="relative pb-8 w-auto">
@if (!empty($checkboxes)) @if (!empty($checkboxes))
<!-- Step 1: Select actions --> <!-- Step 1: Select actions -->
<div x-show="step === 1"> <div x-show="step === 1">
@@ -180,15 +180,11 @@
<h4>Actions</h4> <h4>Actions</h4>
</div> </div>
@foreach ($checkboxes as $index => $checkbox) @foreach ($checkboxes as $index => $checkbox)
<div class="flex items-center justify-between mb-2"> <div class="flex justify-between items-center mb-2">
<label for="{{ $checkbox['id'] }}" <x-forms.checkbox fullWidth :label="$checkbox['label']" :id="$checkbox['id']"
class="text-sm leading-5 text-gray-700 dark:text-gray-300 flex-grow pr-4"> :wire:model="$checkbox['id']"
{{ $checkbox['label'] }}
</label>
<x-forms.checkbox :id="$checkbox['id']" :wire:model="$checkbox['id']"
x-on:change="toggleAction('{{ $checkbox['id'] }}')" :checked="$this->{$checkbox['id']}" x-on:change="toggleAction('{{ $checkbox['id'] }}')" :checked="$this->{$checkbox['id']}"
x-bind:checked="selectedActions.includes('{{ $checkbox['id'] }}')" x-bind:checked="selectedActions.includes('{{ $checkbox['id'] }}')" />
class="flex-shrink-0" :hideLabel="true" />
</div> </div>
@endforeach @endforeach
</div> </div>
@@ -196,7 +192,7 @@
<!-- Step 2: Confirm deletion --> <!-- Step 2: Confirm deletion -->
<div x-show="step === 2"> <div x-show="step === 2">
<div class="bg-error border-l-4 border-red-500 text-white p-4 mb-4" role="alert"> <div class="p-4 mb-4 text-white border-l-4 border-red-500 bg-error" role="alert">
<p class="font-bold">Warning</p> <p class="font-bold">Warning</p>
<p>This operation is permanent and cannot be undone. Please think again before proceeding! <p>This operation is permanent and cannot be undone. Please think again before proceeding!
</p> </p>
@@ -205,7 +201,7 @@
<ul class="mb-4 space-y-2"> <ul class="mb-4 space-y-2">
@foreach ($actions as $action) @foreach ($actions as $action)
<li class="flex items-center text-red-500"> <li class="flex items-center text-red-500">
<svg class="w-5 h-5 mr-2 flex-shrink-0" fill="none" stroke="currentColor" <svg class="flex-shrink-0 mr-2 w-5 h-5" fill="none" stroke="currentColor"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M6 18L18 6M6 6l12 12"></path> d="M6 18L18 6M6 6l12 12"></path>
@@ -216,7 +212,7 @@
@foreach ($checkboxes as $checkbox) @foreach ($checkboxes as $checkbox)
<template x-if="selectedActions.includes('{{ $checkbox['id'] }}')"> <template x-if="selectedActions.includes('{{ $checkbox['id'] }}')">
<li class="flex items-center text-red-500"> <li class="flex items-center text-red-500">
<svg class="w-5 h-5 mr-2 flex-shrink-0" fill="none" stroke="currentColor" <svg class="flex-shrink-0 mr-2 w-5 h-5" fill="none" stroke="currentColor"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M6 18L18 6M6 6l12 12"></path> d="M6 18L18 6M6 6l12 12"></path>
@@ -228,16 +224,16 @@
</ul> </ul>
@if ($confirmWithText) @if ($confirmWithText)
<div class="mb-4"> <div class="mb-4">
<h4 class="text-lg font-semibold mb-2">Confirm Actions</h4> <h4 class="mb-2 text-lg font-semibold">Confirm Actions</h4>
<p class="text-sm mb-2">{{ $confirmationLabel }}</p> <p class="mb-2 text-sm">{{ $confirmationLabel }}</p>
<div class="relative mb-2"> <div class="relative mb-2">
<input type="text" x-model="confirmationText" <input type="text" x-model="confirmationText"
class="w-full p-2 pr-10 rounded text-black input cursor-text" readonly> class="p-2 pr-10 w-full text-black rounded cursor-text input" readonly>
<button @click="copyConfirmationText()" <button @click="copyConfirmationText()"
class="absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-500 hover:text-gray-700" class="absolute right-2 top-1/2 text-gray-500 transform -translate-y-1/2 hover:text-gray-700"
title="Copy confirmation text" x-ref="copyButton"> title="Copy confirmation text" x-ref="copyButton">
<template x-if="!copied"> <template x-if="!copied">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" viewBox="0 0 20 20"
fill="currentColor"> fill="currentColor">
<path d="M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z" /> <path d="M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z" />
<path <path
@@ -245,7 +241,7 @@
</svg> </svg>
</template> </template>
<template x-if="copied"> <template x-if="copied">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-green-500" <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-green-500"
viewBox="0 0 20 20" fill="currentColor"> viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" <path fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
@@ -256,18 +252,18 @@
</div> </div>
<label for="userConfirmationText" <label for="userConfirmationText"
class="block text-sm font-medium text-gray-700 dark:text-gray-300 mt-4"> class="block mt-4 text-sm font-medium text-gray-700 dark:text-gray-300">
{{ $shortConfirmationLabel }} {{ $shortConfirmationLabel }}
</label> </label>
<input type="text" x-model="userConfirmationText" <input type="text" x-model="userConfirmationText"
class="w-full p-2 rounded text-black input mt-1"> class="p-2 mt-1 w-full text-black rounded input">
</div> </div>
@endif @endif
</div> </div>
<!-- Step 3: Password confirmation --> <!-- Step 3: Password confirmation -->
<div x-show="step === 3 && confirmWithPassword"> <div x-show="step === 3 && confirmWithPassword">
<div class="bg-error border-l-4 border-red-500 text-white p-4 mb-4" role="alert"> <div class="p-4 mb-4 text-white border-l-4 border-red-500 bg-error" role="alert">
<p class="font-bold">Final Confirmation</p> <p class="font-bold">Final Confirmation</p>
<p>Please enter your password to confirm this destructive action.</p> <p>Please enter your password to confirm this destructive action.</p>
</div> </div>
@@ -276,11 +272,11 @@
class="block text-sm font-medium text-gray-700 dark:text-gray-300"> class="block text-sm font-medium text-gray-700 dark:text-gray-300">
Your Password Your Password
</label> </label>
<input type="password" id="password-confirm" x-model="password" class="input w-full" <input type="password" id="password-confirm" x-model="password" class="w-full input"
placeholder="Enter your password"> placeholder="Enter your password">
<p x-show="passwordError" x-text="passwordError" class="text-red-500 text-sm mt-1"></p> <p x-show="passwordError" x-text="passwordError" class="mt-1 text-sm text-red-500"></p>
@error('password') @error('password')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p> <p class="mt-1 text-sm text-red-500">{{ $message }}</p>
@enderror @enderror
</div> </div>
</div> </div>

View File

@@ -6,6 +6,6 @@
</div> </div>
<x-modal-confirmation title="Confirm Resource Deletion?" buttonTitle="Delete" isErrorButton submitAction="delete" <x-modal-confirmation title="Confirm Resource Deletion?" buttonTitle="Delete" isErrorButton submitAction="delete"
buttonTitle="Delete" :checkboxes="$checkboxes" :actions="['Permanently delete all containers of this resource.']" confirmationText="{{ $resourceName }}" buttonTitle="Delete" :checkboxes="$checkboxes" :actions="['Permanently delete all containers of this resource.']" confirmationText="{{ $resourceName }}"
confirmationLabel="Please confirm the execution of the actions by entering the NAME of the resource below" confirmationLabel="Please confirm the execution of the actions by entering the Resource Name below"
shortConfirmationLabel="Resource Name" step3ButtonText="Permanently Delete" /> shortConfirmationLabel="Resource Name" step3ButtonText="Permanently Delete" />
</div> </div>

View File

@@ -32,7 +32,7 @@
<x-forms.button type="submit">Connect</x-forms.button> <x-forms.button type="submit">Connect</x-forms.button>
</form> </form>
@else @else
<div class="pt-4">No containers are not running.</div> <div class="pt-4">No containers are running.</div>
@endif @endif
</div> </div>
</div> </div>

View File

@@ -11,7 +11,7 @@
<form wire:submit="submit" class="w-full"> <form wire:submit="submit" class="w-full">
<div class="flex flex-col gap-2 pb-2"> <div class="flex flex-col gap-2 pb-2">
<div class="flex items-end gap-2 pt-4"> <div class="flex gap-2 items-end pt-4">
<h2>Scheduled Task</h2> <h2>Scheduled Task</h2>
<x-forms.button type="submit"> <x-forms.button type="submit">
Save Save
@@ -23,7 +23,10 @@
step2ButtonText="Permanently Delete" /> step2ButtonText="Permanently Delete" />
</div> </div>
<div class="flex w-full gap-2"> <div class="w-48">
<x-forms.checkbox instantSave id="task.enabled" label="Enabled" />
</div>
<div class="flex gap-2 w-full">
<x-forms.input placeholder="Name" id="task.name" label="Name" required /> <x-forms.input placeholder="Name" id="task.name" label="Name" required />
<x-forms.input placeholder="php artisan schedule:run" id="task.command" label="Command" required /> <x-forms.input placeholder="php artisan schedule:run" id="task.command" label="Command" required />
<x-forms.input placeholder="0 0 * * * or daily" id="task.frequency" label="Frequency" required /> <x-forms.input placeholder="0 0 * * * or daily" id="task.frequency" label="Frequency" required />

View File

@@ -10,6 +10,8 @@ DATE=$(date +"%Y%m%d-%H%M%S")
VERSION="1.6" VERSION="1.6"
DOCKER_VERSION="26.0" DOCKER_VERSION="26.0"
# TODO: Ask for a user
CURRENT_USER=$USER
mkdir -p /data/coolify/{source,ssh,applications,databases,backups,services,proxy,webhooks-during-maintenance,metrics,logs} mkdir -p /data/coolify/{source,ssh,applications,databases,backups,services,proxy,webhooks-during-maintenance,metrics,logs}
mkdir -p /data/coolify/ssh/{keys,mux} mkdir -p /data/coolify/ssh/{keys,mux}
@@ -401,88 +403,18 @@ if [ ! -f ~/.ssh/authorized_keys ]; then
chmod 600 ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
fi fi
checkSshKeyInAuthorizedKeys() { set +e
grep -qw "root@coolify" ~/.ssh/authorized_keys IS_COOLIFY_VOLUME_EXISTS=$(docker volume ls | grep coolify-db | wc -l)
return $? set -e
}
checkSshKeyInCoolifyData() { if [ "$IS_COOLIFY_VOLUME_EXISTS" -eq 0 ]; then
[ -s /data/coolify/ssh/keys/id.root@host.docker.internal ]
return $?
}
generateAuthorizedKeys() {
sed -i "/root@coolify/d" ~/.ssh/authorized_keys
cat /data/coolify/ssh/keys/id.root@host.docker.internal.pub >> ~/.ssh/authorized_keys
rm -f /data/coolify/ssh/keys/id.root@host.docker.internal.pub
}
generateSshKey() {
echo " - Generating SSH key." echo " - Generating SSH key."
ssh-keygen -t ed25519 -a 100 -f /data/coolify/ssh/keys/id.root@host.docker.internal -q -N "" -C root@coolify ssh-keygen -t ed25519 -a 100 -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal -q -N "" -C coolify
chown 9999 /data/coolify/ssh/keys/id.root@host.docker.internal chown 9999 /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal
generateAuthorizedKeys sed -i "/coolify/d" ~/.ssh/authorized_keys
} cat /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal.pub >> ~/.ssh/authorized_keys
rm -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal.pub
syncSshKeys() { fi
DB_RUNNING=$(docker inspect coolify-db --format '{{ .State.Status }}' 2>/dev/null)
# Check if SSH key exists in Coolify data but not in authorized_keys
if checkSshKeyInCoolifyData && ! checkSshKeyInAuthorizedKeys; then
# Add the existing Coolify SSH key to authorized_keys
cat /data/coolify/ssh/keys/id.root@host.docker.internal.pub >> ~/.ssh/authorized_keys
# Check if SSH key exists in authorized_keys but not in Coolify data
elif checkSshKeyInAuthorizedKeys && ! checkSshKeyInCoolifyData; then
# Ensure Coolify DB is running before proceeding
if [ "$DB_RUNNING" = "running" ]; then
# Retrieve DB user and SSH key from Coolify database
DB_USER=$(docker inspect coolify-db --format '{{ .Config.Env }}' | grep -oP 'POSTGRES_USER=\K[^ ]+')
DB_SSH_KEY=$(docker exec coolify-db psql -U $DB_USER -d coolify -t -c "SELECT \"private_key\" FROM \"private_keys\" WHERE id = 0 AND team_id = 0 LIMIT 1;" -A -t)
if [ -z "$DB_SSH_KEY" ]; then
# If no key found in DB, generate a new one
echo " - SSH key not found in database. Generating new key."
generateSshKey
else
# If key found in DB, save it and update authorized_keys
echo " - SSH key found in database. Saving to file."
echo "$DB_SSH_KEY" > /data/coolify/ssh/keys/id.root@host.docker.internal
chmod 600 /data/coolify/ssh/keys/id.root@host.docker.internal
chown 9999 /data/coolify/ssh/keys/id.root@host.docker.internal
# Generate public key from private key and update authorized_keys
ssh-keygen -y -f /data/coolify/ssh/keys/id.root@host.docker.internal -C root@coolify > /data/coolify/ssh/keys/id.root@host.docker.internal.pub
sed -i "/root@coolify/d" ~/.ssh/authorized_keys
cat /data/coolify/ssh/keys/id.root@host.docker.internal.pub >> ~/.ssh/authorized_keys
rm -f /data/coolify/ssh/keys/id.root@host.docker.internal.pub
chmod 600 ~/.ssh/authorized_keys
fi
fi
# If SSH key doesn't exist in either location
elif ! checkSshKeyInAuthorizedKeys && ! checkSshKeyInCoolifyData; then
# Ensure Coolify DB is running before proceeding
if [ "$DB_RUNNING" = "running" ]; then
# Retrieve DB user and SSH key from Coolify database
DB_USER=$(docker inspect coolify-db --format '{{ .Config.Env }}' | grep -oP 'POSTGRES_USER=\K[^ ]+')
DB_SSH_KEY=$(docker exec coolify-db psql -U $DB_USER -d coolify -t -c "SELECT \"private_key\" FROM \"private_keys\" WHERE id = 0 AND team_id = 0 LIMIT 1;" -A -t)
if [ -z "$DB_SSH_KEY" ]; then
# If no key found in DB, generate a new one
echo " - SSH key not found in database. Generating new key."
generateSshKey
else
# If key found in DB, save it and update authorized_keys
echo " - SSH key found in database. Saving to file."
echo "$DB_SSH_KEY" > /data/coolify/ssh/keys/id.root@host.docker.internal
chmod 600 /data/coolify/ssh/keys/id.root@host.docker.internal
ssh-keygen -y -f /data/coolify/ssh/keys/id.root@host.docker.internal -C root@coolify > /data/coolify/ssh/keys/id.root@host.docker.internal.pub
sed -i "/root@coolify/d" ~/.ssh/authorized_keys
cat /data/coolify/ssh/keys/id.root@host.docker.internal.pub >> ~/.ssh/authorized_keys
fi
else
generateSshKey
fi
fi
}
syncSshKeys || true
chown -R 9999:root /data/coolify chown -R 9999:root /data/coolify
chmod -R 700 /data/coolify chmod -R 700 /data/coolify

View File

@@ -1,10 +1,10 @@
{ {
"coolify": { "coolify": {
"v4": { "v4": {
"version": "4.0.0-beta.342" "version": "4.0.0-beta.344"
}, },
"nightly": { "nightly": {
"version": "4.0.0-beta.343" "version": "4.0.0-beta.345"
}, },
"helper": { "helper": {
"version": "1.0.1" "version": "1.0.1"