@@ -49,7 +49,6 @@ class FileStorage extends Component
|
||||
$this->workdir = null;
|
||||
$this->fs_path = $this->fileStorage->fs_path;
|
||||
}
|
||||
$this->fileStorage->loadStorageOnServer();
|
||||
}
|
||||
|
||||
public function convertToDirectory()
|
||||
@@ -68,6 +67,18 @@ class FileStorage extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function loadStorageOnServer()
|
||||
{
|
||||
try {
|
||||
$this->fileStorage->loadStorageOnServer();
|
||||
$this->dispatch('success', 'File storage loaded from server.');
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
} finally {
|
||||
$this->dispatch('refreshStorages');
|
||||
}
|
||||
}
|
||||
|
||||
public function convertToFile()
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -65,7 +65,6 @@ class Deploy extends Component
|
||||
public function restart()
|
||||
{
|
||||
try {
|
||||
$this->stop();
|
||||
$this->dispatch('checkProxy');
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
|
||||
@@ -235,7 +235,7 @@ class SettingsEmail extends Component
|
||||
throw new \Exception('Too many messages sent!');
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e);
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,4 +176,19 @@ class LocalFileVolume extends BaseModel
|
||||
|
||||
return instant_remote_process($commands, $server);
|
||||
}
|
||||
|
||||
// Accessor for convenient access
|
||||
protected function plainMountPath(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => $this->mount_path,
|
||||
set: fn ($value) => $this->mount_path = $value
|
||||
);
|
||||
}
|
||||
|
||||
// Scope for searching
|
||||
public function scopeWherePlainMountPath($query, $path)
|
||||
{
|
||||
return $query->get()->where('plain_mount_path', $path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,69 +2,68 @@
|
||||
|
||||
namespace App\Notifications\Channels;
|
||||
|
||||
use App\Services\ConfigurationRepository;
|
||||
use Exception;
|
||||
use Illuminate\Mail\Message;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Resend;
|
||||
|
||||
class EmailChannel
|
||||
{
|
||||
private ConfigurationRepository $configRepository;
|
||||
|
||||
public function __construct(ConfigurationRepository $configRepository)
|
||||
{
|
||||
$this->configRepository = $configRepository;
|
||||
}
|
||||
public function __construct() {}
|
||||
|
||||
public function send(SendsEmail $notifiable, Notification $notification): void
|
||||
{
|
||||
try {
|
||||
$this->bootConfigs($notifiable);
|
||||
$useInstanceEmailSettings = $notifiable->emailNotificationSettings->use_instance_email_settings;
|
||||
$customEmails = data_get($notification, 'emails', null);
|
||||
if ($useInstanceEmailSettings) {
|
||||
$settings = instanceSettings();
|
||||
} else {
|
||||
$settings = $notifiable->emailNotificationSettings;
|
||||
}
|
||||
$isResendEnabled = $settings->resend_enabled;
|
||||
$isSmtpEnabled = $settings->smtp_enabled;
|
||||
if ($customEmails) {
|
||||
$recipients = [$customEmails];
|
||||
} else {
|
||||
$recipients = $notifiable->getRecipients();
|
||||
if (count($recipients) === 0) {
|
||||
throw new Exception('No email recipients found');
|
||||
}
|
||||
|
||||
$mailMessage = $notification->toMail($notifiable);
|
||||
Mail::send(
|
||||
[],
|
||||
[],
|
||||
fn (Message $message) => $message
|
||||
->to($recipients)
|
||||
->subject($mailMessage->subject)
|
||||
->html((string) $mailMessage->render())
|
||||
|
||||
if ($isResendEnabled) {
|
||||
$resend = Resend::client($settings->resend_api_key);
|
||||
$from = "{$settings->smtp_from_name} <{$settings->smtp_from_address}>";
|
||||
$resend->emails->send([
|
||||
'from' => $from,
|
||||
'to' => $recipients,
|
||||
'subject' => $mailMessage->subject,
|
||||
'html' => (string) $mailMessage->render(),
|
||||
]);
|
||||
} elseif ($isSmtpEnabled) {
|
||||
$encryption = match (strtolower($settings->smtp_encryption)) {
|
||||
'starttls' => null,
|
||||
'tls' => 'tls',
|
||||
'none' => null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
$transport = new \Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport(
|
||||
$settings->smtp_host,
|
||||
$settings->smtp_port,
|
||||
$encryption
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
if ($error === 'No email settings found.') {
|
||||
throw $e;
|
||||
}
|
||||
$message = "EmailChannel error: {$e->getMessage()}. Failed to send email to:";
|
||||
if (isset($recipients)) {
|
||||
$message .= implode(', ', $recipients);
|
||||
}
|
||||
if (isset($mailMessage)) {
|
||||
$message .= " with subject: {$mailMessage->subject}";
|
||||
}
|
||||
send_internal_notification($message);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
$transport->setUsername($settings->smtp_username);
|
||||
$transport->setPassword($settings->smtp_password);
|
||||
|
||||
private function bootConfigs($notifiable): void
|
||||
{
|
||||
$emailSettings = $notifiable->emailNotificationSettings;
|
||||
$mailer = new \Symfony\Component\Mailer\Mailer($transport);
|
||||
|
||||
if ($emailSettings->use_instance_email_settings) {
|
||||
$type = set_transanctional_email_settings();
|
||||
if (blank($type)) {
|
||||
throw new Exception('No email settings found.');
|
||||
}
|
||||
$fromEmail = $settings->smtp_from_address ?? 'noreply@localhost';
|
||||
$fromName = $settings->smtp_from_name ?? 'System';
|
||||
$from = new \Symfony\Component\Mime\Address($fromEmail, $fromName);
|
||||
$email = (new \Symfony\Component\Mime\Email)
|
||||
->from($from)
|
||||
->to(...$recipients)
|
||||
->subject($mailMessage->subject)
|
||||
->html((string) $mailMessage->render());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->configRepository->updateMailConfig($emailSettings);
|
||||
$mailer->send($email);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Models\ServiceApplication;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
use Spatie\Url\Url;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
|
||||
function getCurrentApplicationContainerStatus(Server $server, int $id, ?int $pullRequestId = null, ?bool $includePullrequests = false): Collection
|
||||
@@ -834,7 +835,15 @@ function validateComposeFile(string $compose, int $server_id): string|Throwable
|
||||
if (! $server) {
|
||||
throw new \Exception('Server not found');
|
||||
}
|
||||
$base64_compose = base64_encode($compose);
|
||||
$yaml_compose = Yaml::parse($compose);
|
||||
foreach ($yaml_compose['services'] as $service_name => $service) {
|
||||
foreach ($service['volumes'] as $volume_name => $volume) {
|
||||
if (data_get($volume, 'type') === 'bind' && data_get($volume, 'content')) {
|
||||
unset($yaml_compose['services'][$service_name]['volumes'][$volume_name]['content']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$base64_compose = base64_encode(Yaml::dump($yaml_compose));
|
||||
instant_remote_process([
|
||||
"echo {$base64_compose} | base64 -d | tee /tmp/{$uuid}.yml > /dev/null",
|
||||
"chmod 600 /tmp/{$uuid}.yml",
|
||||
|
||||
@@ -1250,14 +1250,24 @@ function get_public_ips()
|
||||
function isAnyDeploymentInprogress()
|
||||
{
|
||||
$runningJobs = ApplicationDeploymentQueue::where('horizon_job_worker', gethostname())->where('status', ApplicationDeploymentStatus::IN_PROGRESS->value)->get();
|
||||
$basicDetails = $runningJobs->map(function ($job) {
|
||||
return [
|
||||
'id' => $job->id,
|
||||
'created_at' => $job->created_at,
|
||||
'application_id' => $job->application_id,
|
||||
'server_id' => $job->server_id,
|
||||
'horizon_job_id' => $job->horizon_job_id,
|
||||
'status' => $job->status,
|
||||
];
|
||||
});
|
||||
echo 'Running jobs: '.json_encode($basicDetails)."\n";
|
||||
$horizonJobIds = [];
|
||||
foreach ($runningJobs as $runningJob) {
|
||||
$horizonJobStatus = getJobStatus($runningJob->horizon_job_id);
|
||||
if ($horizonJobStatus === 'unknown') {
|
||||
return true;
|
||||
}
|
||||
if ($horizonJobStatus === 'unknown' || $horizonJobStatus === 'reserved') {
|
||||
$horizonJobIds[] = $runningJob->horizon_job_id;
|
||||
}
|
||||
}
|
||||
if (count($horizonJobIds) === 0) {
|
||||
echo "No deployments in progress.\n";
|
||||
exit(0);
|
||||
@@ -1353,21 +1363,15 @@ function parseServiceVolumes($serviceVolumes, $resource, $topLevelVolumes, $pull
|
||||
$source = $source."-pr-$pull_request_id";
|
||||
}
|
||||
if (! $resource?->settings?->is_preserve_repository_enabled || $foundConfig?->is_based_on_git) {
|
||||
LocalFileVolume::updateOrCreate(
|
||||
[
|
||||
'mount_path' => $target,
|
||||
'resource_id' => $resource->id,
|
||||
'resource_type' => get_class($resource),
|
||||
],
|
||||
[
|
||||
$volume = LocalFileVolume::wherePlainMountPath($target)->first() ?? new LocalFileVolume;
|
||||
$volume->fill([
|
||||
'fs_path' => $source,
|
||||
'mount_path' => $target,
|
||||
'content' => $content,
|
||||
'is_directory' => $isDirectory,
|
||||
'resource_id' => $resource->id,
|
||||
'resource_type' => get_class($resource),
|
||||
]
|
||||
);
|
||||
])->save();
|
||||
}
|
||||
} elseif ($type->value() === 'volume') {
|
||||
if ($topLevelVolumes->has($source->value())) {
|
||||
@@ -1665,21 +1669,28 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||
if ($source->value() === '/tmp' || $source->value() === '/tmp/') {
|
||||
return $volume;
|
||||
}
|
||||
LocalFileVolume::updateOrCreate(
|
||||
[
|
||||
'mount_path' => $target,
|
||||
'resource_id' => $savedService->id,
|
||||
'resource_type' => get_class($savedService),
|
||||
],
|
||||
[
|
||||
|
||||
$existingVolume = LocalFileVolume::wherePlainMountPath($target)->first();
|
||||
|
||||
if ($existingVolume) {
|
||||
$existingVolume->update([
|
||||
'fs_path' => $source,
|
||||
'mount_path' => $target,
|
||||
'content' => $content,
|
||||
'is_directory' => $isDirectory,
|
||||
'resource_id' => $savedService->id,
|
||||
'resource_type' => get_class($savedService),
|
||||
]
|
||||
);
|
||||
]);
|
||||
} else {
|
||||
LocalFileVolume::create([
|
||||
'fs_path' => $source,
|
||||
'mount_path' => $target,
|
||||
'content' => $content,
|
||||
'is_directory' => $isDirectory,
|
||||
'resource_id' => $savedService->id,
|
||||
'resource_type' => get_class($savedService),
|
||||
]);
|
||||
}
|
||||
} elseif ($type->value() === 'volume') {
|
||||
if ($topLevelVolumes->has($source->value())) {
|
||||
$v = $topLevelVolumes->get($source->value());
|
||||
@@ -3317,21 +3328,15 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
||||
if ($isApplication && $isPullRequest) {
|
||||
$source = $source."-pr-$pullRequestId";
|
||||
}
|
||||
LocalFileVolume::updateOrCreate(
|
||||
[
|
||||
'mount_path' => $target,
|
||||
'resource_id' => $originalResource->id,
|
||||
'resource_type' => get_class($originalResource),
|
||||
],
|
||||
[
|
||||
$volume = LocalFileVolume::wherePlainMountPath($target)->first() ?? new LocalFileVolume;
|
||||
$volume->fill([
|
||||
'fs_path' => $source,
|
||||
'mount_path' => $target,
|
||||
'content' => $content,
|
||||
'is_directory' => $isDirectory,
|
||||
'resource_id' => $originalResource->id,
|
||||
'resource_type' => get_class($originalResource),
|
||||
]
|
||||
);
|
||||
])->save();
|
||||
if (isDev()) {
|
||||
if ((int) $resource->compose_parsing_version >= 4) {
|
||||
if ($isApplication) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
return [
|
||||
'coolify' => [
|
||||
'version' => '4.0.0-beta.400',
|
||||
'version' => '4.0.0-beta.401',
|
||||
'helper_version' => '1.0.7',
|
||||
'realtime_version' => '1.0.6',
|
||||
'self_hosted' => env('SELF_HOSTED', true),
|
||||
|
||||
@@ -20,7 +20,7 @@ DATE=$(date +"%Y%m%d-%H%M%S")
|
||||
|
||||
OS_TYPE=$(grep -w "ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"')
|
||||
ENV_FILE="/data/coolify/source/.env"
|
||||
VERSION="19"
|
||||
VERSION="20"
|
||||
DOCKER_VERSION="27.0"
|
||||
# TODO: Ask for a user
|
||||
CURRENT_USER=$USER
|
||||
@@ -803,9 +803,9 @@ echo -e " - Please wait."
|
||||
getAJoke
|
||||
|
||||
if [[ $- == *x* ]]; then
|
||||
bash -x /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}"
|
||||
bash -x /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}" "${REGISTRY_URL:-ghcr.io}"
|
||||
else
|
||||
bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}"
|
||||
bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}" "${REGISTRY_URL:-ghcr.io}"
|
||||
fi
|
||||
echo " - Coolify installed successfully."
|
||||
rm -f $ENV_FILE-$DATE
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/bin/bash
|
||||
## Do not modify this file. You will lose the ability to autoupdate!
|
||||
|
||||
VERSION="14"
|
||||
VERSION="15"
|
||||
CDN="https://cdn.coollabs.io/coolify-nightly"
|
||||
LATEST_IMAGE=${1:-latest}
|
||||
LATEST_HELPER_VERSION=${2:-latest}
|
||||
REGISTRY_URL=${3:-ghcr.io}
|
||||
|
||||
DATE=$(date +%Y-%m-%d-%H-%M-%S)
|
||||
LOGFILE="/data/coolify/source/upgrade-${DATE}.log"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"coolify": {
|
||||
"v4": {
|
||||
"version": "4.0.0-beta.400"
|
||||
"version": "4.0.0-beta.401"
|
||||
},
|
||||
"nightly": {
|
||||
"version": "4.0.0-beta.401"
|
||||
"version": "4.0.0-beta.402"
|
||||
},
|
||||
"helper": {
|
||||
"version": "1.0.7"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<x-modal-input buttonTitle="Send Test Email" title="Send Test Email">
|
||||
<form wire:submit.prevent="sendTestEmail" class="flex flex-col w-full gap-2">
|
||||
<x-forms.input wire:model="testEmailAddress" placeholder="test@example.com"
|
||||
id="testEmailAddress" label="Recipients" required />
|
||||
id="testEmailAddress" label="Recipient" required />
|
||||
<x-forms.button type="submit" @click="modalOpen=false">
|
||||
Send Email
|
||||
</x-forms.button>
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
<div class="py-4 ">
|
||||
<div class="">
|
||||
<div class="flex flex-col justify-center pb-4 text-sm select-text">
|
||||
{{-- @if (data_get($resource, 'build_pack') === 'dockercompose')
|
||||
<h4>{{ data_get($resource, 'name', 'unknown') }}</h4>
|
||||
@endif --}}
|
||||
@if ($fileStorage->is_directory)
|
||||
<h4 class="dark:text-white pt-4 border-t dark:border-coolgray-200">Directory Mount</h4>
|
||||
@else
|
||||
<h4 class="dark:text-white pt-4 border-t dark:border-coolgray-200">File Mount</h4>
|
||||
@endif
|
||||
|
||||
<div class="flex gap-2 md:flex-row flex-col pt-4">
|
||||
<x-forms.input label="Source Path" :value="$fileStorage->fs_path" readonly />
|
||||
<x-forms.input label="Destination Path" :value="$fileStorage->mount_path" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<form wire:submit='submit' class="flex flex-col gap-2">
|
||||
<div class="flex gap-2">
|
||||
@if ($fileStorage->is_directory)
|
||||
@@ -39,6 +32,7 @@
|
||||
confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
|
||||
shortConfirmationLabel="Filepath" :confirmWithPassword="false" step2ButtonText="Convert to directory" />
|
||||
@endif
|
||||
<x-forms.button type="button" wire:click="loadStorageOnServer">Load from server</x-forms.button>
|
||||
<x-modal-confirmation :ignoreWire="false" title="Confirm File Deletion?" buttonTitle="Delete"
|
||||
isErrorButton submitAction="delete" :checkboxes="$fileDeletionCheckboxes" :actions="['The selected file will be permanently deleted from the container.']"
|
||||
confirmationText="{{ $fs_path }}"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<form wire:submit='submit' class="flex flex-col gap-2 xl:items-end xl:flex-row">
|
||||
@if ($isReadOnly)
|
||||
@if ($isFirst)
|
||||
<div class="flex gap-2 items-end w-full md:flex-row flex-col">
|
||||
@if (
|
||||
$storage->resource_type === 'App\Models\ServiceApplication' ||
|
||||
$storage->resource_type === 'App\Models\ServiceDatabase')
|
||||
@@ -26,21 +27,28 @@
|
||||
Update
|
||||
</x-forms.button>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<div class="flex gap-2 items-end w-full">
|
||||
<x-forms.input id="storage.name" required readonly />
|
||||
<x-forms.input id="storage.host_path" readonly />
|
||||
<x-forms.input id="storage.mount_path" required readonly />
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
@if ($isFirst)
|
||||
<div class="flex gap-2 items-end w-full">
|
||||
<x-forms.input id="storage.name" label="Volume Name" required />
|
||||
<x-forms.input id="storage.host_path" helper="Directory on the host system." label="Source Path" />
|
||||
<x-forms.input id="storage.mount_path" label="Destination Path" helper="Directory inside the container."
|
||||
required />
|
||||
<x-forms.input id="storage.mount_path" label="Destination Path"
|
||||
helper="Directory inside the container." required />
|
||||
</div>
|
||||
@else
|
||||
<div class="flex gap-2 items-end w-full">
|
||||
<x-forms.input id="storage.name" required />
|
||||
<x-forms.input id="storage.host_path" />
|
||||
<x-forms.input id="storage.mount_path" required />
|
||||
</div>
|
||||
@endif
|
||||
<div class="flex gap-2">
|
||||
<x-forms.button type="submit">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<x-modal-input buttonTitle="Send Test Email" title="Send Test Email">
|
||||
<form wire:submit.prevent="sendTestEmail" class="flex flex-col w-full gap-2">
|
||||
<x-forms.input wire:model="testEmailAddress" placeholder="test@example.com" id="testEmailAddress"
|
||||
label="Recipients" required />
|
||||
label="Recipient" required />
|
||||
<x-forms.button type="submit" @click="modalOpen=false">
|
||||
Send Email
|
||||
</x-forms.button>
|
||||
|
||||
@@ -20,7 +20,7 @@ DATE=$(date +"%Y%m%d-%H%M%S")
|
||||
|
||||
OS_TYPE=$(grep -w "ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"')
|
||||
ENV_FILE="/data/coolify/source/.env"
|
||||
VERSION="19"
|
||||
VERSION="20"
|
||||
DOCKER_VERSION="27.0"
|
||||
# TODO: Ask for a user
|
||||
CURRENT_USER=$USER
|
||||
@@ -803,9 +803,9 @@ echo -e " - Please wait."
|
||||
getAJoke
|
||||
|
||||
if [[ $- == *x* ]]; then
|
||||
bash -x /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}"
|
||||
bash -x /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}" "${REGISTRY_URL:-ghcr.io}"
|
||||
else
|
||||
bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}"
|
||||
bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}" "${REGISTRY_URL:-ghcr.io}"
|
||||
fi
|
||||
echo " - Coolify installed successfully."
|
||||
rm -f $ENV_FILE-$DATE
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/bin/bash
|
||||
## Do not modify this file. You will lose the ability to autoupdate!
|
||||
|
||||
VERSION="14"
|
||||
VERSION="15"
|
||||
CDN="https://cdn.coollabs.io/coolify"
|
||||
LATEST_IMAGE=${1:-latest}
|
||||
LATEST_HELPER_VERSION=${2:-latest}
|
||||
REGISTRY_URL=${3:-ghcr.io}
|
||||
|
||||
DATE=$(date +%Y-%m-%d-%H-%M-%S)
|
||||
LOGFILE="/data/coolify/source/upgrade-${DATE}.log"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"coolify": {
|
||||
"v4": {
|
||||
"version": "4.0.0-beta.400"
|
||||
"version": "4.0.0-beta.401"
|
||||
},
|
||||
"nightly": {
|
||||
"version": "4.0.0-beta.401"
|
||||
"version": "4.0.0-beta.402"
|
||||
},
|
||||
"helper": {
|
||||
"version": "1.0.7"
|
||||
|
||||
Reference in New Issue
Block a user