fix: lots of regarding git + docker compose deployments
This commit is contained in:
parent
8d86d53292
commit
d4d2cc71a0
@ -72,9 +72,11 @@ class Previews extends Component
|
|||||||
public function stop(int $pull_request_id)
|
public function stop(int $pull_request_id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$container_name = generateApplicationContainerName($this->application, $pull_request_id);
|
$containers = getCurrentApplicationContainerStatus($this->application->destination->server, $this->application->id, $pull_request_id);
|
||||||
|
foreach ($containers as $container) {
|
||||||
instant_remote_process(["docker rm -f $container_name"], $this->application->destination->server, throwError: false);
|
$name = str_replace('/', '', $container['Names']);
|
||||||
|
instant_remote_process(["docker rm -f $name"], $this->application->destination->server, throwError: false);
|
||||||
|
}
|
||||||
ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->delete();
|
ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->delete();
|
||||||
$this->application->refresh();
|
$this->application->refresh();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
@ -393,9 +393,16 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
private function save_environment_variables()
|
private function save_environment_variables()
|
||||||
{
|
{
|
||||||
$envs = collect([]);
|
$envs = collect([]);
|
||||||
foreach ($this->application->environment_variables as $env) {
|
if ($this->pull_request_id !== 0) {
|
||||||
$envs->push($env->key . '=' . $env->value);
|
foreach ($this->application->environment_variables_preview as $env) {
|
||||||
|
$envs->push($env->key . '=' . $env->value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($this->application->environment_variables as $env) {
|
||||||
|
$envs->push($env->key . '=' . $env->value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ray($envs);
|
||||||
$envs_base64 = base64_encode($envs->implode("\n"));
|
$envs_base64 = base64_encode($envs->implode("\n"));
|
||||||
$this->execute_remote_command(
|
$this->execute_remote_command(
|
||||||
[
|
[
|
||||||
@ -446,7 +453,12 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
if (data_get($this->application, 'docker_compose_location')) {
|
if (data_get($this->application, 'docker_compose_location')) {
|
||||||
$this->docker_compose_location = $this->application->docker_compose_location;
|
$this->docker_compose_location = $this->application->docker_compose_location;
|
||||||
}
|
}
|
||||||
$this->application_deployment_queue->addLogEntry("Starting deployment of {$this->application->name}.");
|
if ($this->pull_request_id === 0) {
|
||||||
|
$this->application_deployment_queue->addLogEntry("Starting deployment of {$this->application->name}.");
|
||||||
|
} else {
|
||||||
|
ray('asd');
|
||||||
|
$this->application_deployment_queue->addLogEntry("Starting pull request (#{$this->pull_request_id}) deployment of {$this->customRepository}:{$this->application->git_branch}.");
|
||||||
|
}
|
||||||
$this->server->executeRemoteCommand(
|
$this->server->executeRemoteCommand(
|
||||||
commands: $this->application->prepareHelperImage($this->deployment_uuid),
|
commands: $this->application->prepareHelperImage($this->deployment_uuid),
|
||||||
loggingModel: $this->application_deployment_queue
|
loggingModel: $this->application_deployment_queue
|
||||||
@ -455,19 +467,24 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
$this->clone_repository();
|
$this->clone_repository();
|
||||||
$this->generate_image_names();
|
$this->generate_image_names();
|
||||||
$this->cleanup_git();
|
$this->cleanup_git();
|
||||||
$composeFile = $this->application->parseCompose();
|
$composeFile = $this->application->parseCompose(pull_request_id: $this->pull_request_id);
|
||||||
$yaml = Yaml::dump($composeFile->toArray(), 10);
|
$yaml = Yaml::dump($composeFile->toArray(), 10);
|
||||||
$this->docker_compose_base64 = base64_encode($yaml);
|
$this->docker_compose_base64 = base64_encode($yaml);
|
||||||
$this->execute_remote_command([
|
$this->execute_remote_command([
|
||||||
executeInDocker($this->deployment_uuid, "echo '{$this->docker_compose_base64}' | base64 -d > {$this->workdir}/docker-compose.yaml"), "hidden" => true
|
executeInDocker($this->deployment_uuid, "echo '{$this->docker_compose_base64}' | base64 -d > {$this->workdir}/docker-compose.yaml"), "hidden" => true
|
||||||
]);
|
]);
|
||||||
$this->execute_remote_command([
|
|
||||||
"docker network create --attachable '{$this->application->uuid}' >/dev/null || true", "hidden" => true, "ignore_errors" => true
|
|
||||||
], [
|
|
||||||
"docker network connect {$this->application->uuid} coolify-proxy || true", "hidden" => true, "ignore_errors" => true
|
|
||||||
]);
|
|
||||||
$this->save_environment_variables();
|
$this->save_environment_variables();
|
||||||
$this->stop_running_container(force: true);
|
$this->stop_running_container(force: true);
|
||||||
|
|
||||||
|
$networkId = $this->application->uuid;
|
||||||
|
if ($this->pull_request_id !== 0) {
|
||||||
|
$networkId = "{$this->application->uuid}-{$this->pull_request_id}";
|
||||||
|
}
|
||||||
|
$this->execute_remote_command([
|
||||||
|
"docker network create --attachable '{$networkId}' >/dev/null || true", "hidden" => true, "ignore_errors" => true
|
||||||
|
], [
|
||||||
|
"docker network connect {$networkId} coolify-proxy || true", "hidden" => true, "ignore_errors" => true
|
||||||
|
]);
|
||||||
$this->start_by_compose_file();
|
$this->start_by_compose_file();
|
||||||
$this->application->loadComposeFile(isInit: false);
|
$this->application->loadComposeFile(isInit: false);
|
||||||
}
|
}
|
||||||
@ -750,6 +767,9 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
$importCommands = $this->generate_git_import_commands();
|
$importCommands = $this->generate_git_import_commands();
|
||||||
$this->application_deployment_queue->addLogEntry("\n----------------------------------------");
|
$this->application_deployment_queue->addLogEntry("\n----------------------------------------");
|
||||||
$this->application_deployment_queue->addLogEntry("Importing {$this->customRepository}:{$this->application->git_branch} (commit sha {$this->application->git_commit_sha}) to {$this->basedir}.");
|
$this->application_deployment_queue->addLogEntry("Importing {$this->customRepository}:{$this->application->git_branch} (commit sha {$this->application->git_commit_sha}) to {$this->basedir}.");
|
||||||
|
if ($this->pull_request_id !== 0) {
|
||||||
|
$this->application_deployment_queue->addLogEntry("Checking out tag pull/{$this->pull_request_id}/head.");
|
||||||
|
}
|
||||||
$this->execute_remote_command(
|
$this->execute_remote_command(
|
||||||
[
|
[
|
||||||
$importCommands, "hidden" => true
|
$importCommands, "hidden" => true
|
||||||
@ -1171,11 +1191,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
$this->application_deployment_queue->addLogEntry("Removing old containers.");
|
$this->application_deployment_queue->addLogEntry("Removing old containers.");
|
||||||
if ($this->newVersionIsHealthy || $force) {
|
if ($this->newVersionIsHealthy || $force) {
|
||||||
$containers = getCurrentApplicationContainerStatus($this->server, $this->application->id, $this->pull_request_id);
|
$containers = getCurrentApplicationContainerStatus($this->server, $this->application->id, $this->pull_request_id);
|
||||||
if ($this->pull_request_id !== 0) {
|
if ($this->pull_request_id === 0) {
|
||||||
$containers = $containers->filter(function ($container) {
|
|
||||||
return data_get($container, 'Names') === $this->container_name;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$containers = $containers->filter(function ($container) {
|
$containers = $containers->filter(function ($container) {
|
||||||
return data_get($container, 'Names') !== $this->container_name;
|
return data_get($container, 'Names') !== $this->container_name;
|
||||||
});
|
});
|
||||||
|
@ -589,10 +589,10 @@ class Application extends BaseModel
|
|||||||
]);
|
]);
|
||||||
return $commands;
|
return $commands;
|
||||||
}
|
}
|
||||||
function parseCompose()
|
function parseCompose(int $pull_request_id = 0)
|
||||||
{
|
{
|
||||||
if ($this->docker_compose_raw) {
|
if ($this->docker_compose_raw) {
|
||||||
return parseDockerComposeFile($this);
|
return parseDockerComposeFile(resource: $this, isNew: false, pull_request_id: $pull_request_id);
|
||||||
} else {
|
} else {
|
||||||
return collect([]);
|
return collect([]);
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ function generateServiceSpecificFqdns(ServiceApplication|Application $resource,
|
|||||||
}
|
}
|
||||||
return $payload;
|
return $payload;
|
||||||
}
|
}
|
||||||
function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_https_enabled, $onlyPort = null)
|
function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_https_enabled = false, $onlyPort = null)
|
||||||
{
|
{
|
||||||
$labels = collect([]);
|
$labels = collect([]);
|
||||||
$labels->push('traefik.enable=true');
|
$labels->push('traefik.enable=true');
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
|
use App\Models\ApplicationPreview;
|
||||||
use App\Models\EnvironmentVariable;
|
use App\Models\EnvironmentVariable;
|
||||||
use App\Models\InstanceSettings;
|
use App\Models\InstanceSettings;
|
||||||
use App\Models\LocalFileVolume;
|
use App\Models\LocalFileVolume;
|
||||||
@ -578,7 +579,7 @@ function getTopLevelNetworks(Service|Application $resource)
|
|||||||
return $topLevelNetworks->keys();
|
return $topLevelNetworks->keys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function parseDockerComposeFile(Service|Application $resource, bool $isNew = false)
|
function parseDockerComposeFile(Service|Application $resource, bool $isNew = false, int $pull_request_id)
|
||||||
{
|
{
|
||||||
// ray()->clearAll();
|
// ray()->clearAll();
|
||||||
if ($resource->getMorphClass() === 'App\Models\Service') {
|
if ($resource->getMorphClass() === 'App\Models\Service') {
|
||||||
@ -1095,6 +1096,9 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
}
|
}
|
||||||
$server = $resource->destination->server;
|
$server = $resource->destination->server;
|
||||||
$topLevelVolumes = collect(data_get($yaml, 'volumes', []));
|
$topLevelVolumes = collect(data_get($yaml, 'volumes', []));
|
||||||
|
if ($pull_request_id !== 0) {
|
||||||
|
$topLevelVolumes = collect([]);
|
||||||
|
}
|
||||||
$topLevelNetworks = collect(data_get($yaml, 'networks', []));
|
$topLevelNetworks = collect(data_get($yaml, 'networks', []));
|
||||||
$dockerComposeVersion = data_get($yaml, 'version') ?? '3.8';
|
$dockerComposeVersion = data_get($yaml, 'version') ?? '3.8';
|
||||||
$services = data_get($yaml, 'services');
|
$services = data_get($yaml, 'services');
|
||||||
@ -1108,7 +1112,10 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$definedNetwork = collect([$resource->uuid]);
|
$definedNetwork = collect([$resource->uuid]);
|
||||||
$services = collect($services)->map(function ($service, $serviceName) use ($topLevelVolumes, $topLevelNetworks, $definedNetwork, $isNew, $generatedServiceFQDNS, $resource, $server) {
|
if ($pull_request_id !== 0) {
|
||||||
|
$definedNetwork = collect(["{$resource->uuid}-$pull_request_id"]);
|
||||||
|
}
|
||||||
|
$services = collect($services)->map(function ($service, $serviceName) use ($topLevelVolumes, $topLevelNetworks, $definedNetwork, $isNew, $generatedServiceFQDNS, $resource, $server, $pull_request_id) {
|
||||||
$serviceVolumes = collect(data_get($service, 'volumes', []));
|
$serviceVolumes = collect(data_get($service, 'volumes', []));
|
||||||
$servicePorts = collect(data_get($service, 'ports', []));
|
$servicePorts = collect(data_get($service, 'ports', []));
|
||||||
$serviceNetworks = collect(data_get($service, 'networks', []));
|
$serviceNetworks = collect(data_get($service, 'networks', []));
|
||||||
@ -1127,17 +1134,40 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$serviceLabels->push("$removedLabelName=$removedLabel");
|
$serviceLabels->push("$removedLabelName=$removedLabel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$baseName = generateApplicationContainerName($resource, $pull_request_id);
|
||||||
|
$containerName = "$serviceName-$baseName";
|
||||||
|
if ($pull_request_id !== 0) {
|
||||||
|
if (count($serviceVolumes) > 0) {
|
||||||
|
$serviceVolumes = $serviceVolumes->map(function ($volume) use ($resource, $pull_request_id, $topLevelVolumes) {
|
||||||
|
if (is_string($volume)) {
|
||||||
|
$volume = str($volume);
|
||||||
|
if ($volume->contains(':')) {
|
||||||
|
$name = $volume->before(':');
|
||||||
|
$mount = $volume->after(':');
|
||||||
|
$newName = $name . "-{$resource->uuid}-$pull_request_id";
|
||||||
|
$volume = str("$newName:$mount");
|
||||||
|
$topLevelVolumes->put($newName, [
|
||||||
|
'name' => $newName,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
} else if (is_array($volume)) {
|
||||||
|
$volume['source'] = str($volume['source'])->append("-{$resource->uuid}-$pull_request_id");
|
||||||
|
}
|
||||||
|
|
||||||
$containerName = "$serviceName-{$resource->uuid}";
|
|
||||||
|
|
||||||
|
return $volume->value();
|
||||||
|
});
|
||||||
|
data_set($service, 'volumes', $serviceVolumes->toArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
// Decide if the service is a database
|
// Decide if the service is a database
|
||||||
$isDatabase = isDatabaseImage(data_get_str($service, 'image'));
|
$isDatabase = isDatabaseImage(data_get_str($service, 'image'));
|
||||||
$image = data_get_str($service, 'image');
|
|
||||||
data_set($service, 'is_database', $isDatabase);
|
data_set($service, 'is_database', $isDatabase);
|
||||||
|
|
||||||
// Collect/create/update networks
|
// Collect/create/update networks
|
||||||
if ($serviceNetworks->count() > 0) {
|
if ($serviceNetworks->count() > 0) {
|
||||||
foreach ($serviceNetworks as $networkName => $networkDetails) {
|
foreach ($serviceNetworks as $networkName => $networkDetails) {
|
||||||
|
ray($networkDetails);
|
||||||
$networkExists = $topLevelNetworks->contains(function ($value, $key) use ($networkName) {
|
$networkExists = $topLevelNetworks->contains(function ($value, $key) use ($networkName) {
|
||||||
return $value == $networkName || $key == $networkName;
|
return $value == $networkName || $key == $networkName;
|
||||||
});
|
});
|
||||||
@ -1169,10 +1199,17 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
});
|
});
|
||||||
if (!$definedNetworkExists) {
|
if (!$definedNetworkExists) {
|
||||||
foreach ($definedNetwork as $network) {
|
foreach ($definedNetwork as $network) {
|
||||||
$topLevelNetworks->put($network, [
|
if ($pull_request_id !== 0) {
|
||||||
'name' => $network,
|
$topLevelNetworks->put($network, [
|
||||||
'external' => true
|
'name' => $network,
|
||||||
]);
|
'external' => false
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$topLevelNetworks->put($network, [
|
||||||
|
'name' => $network,
|
||||||
|
'external' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$networks = collect();
|
$networks = collect();
|
||||||
@ -1368,12 +1405,29 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$fqdns = data_get($domains, "$serviceName.domain");
|
$fqdns = data_get($domains, "$serviceName.domain");
|
||||||
if ($fqdns) {
|
if ($fqdns) {
|
||||||
$fqdns = str($fqdns)->explode(',');
|
$fqdns = str($fqdns)->explode(',');
|
||||||
$serviceLabels = $serviceLabels->merge(fqdnLabelsForTraefik($resource->uuid, $fqdns, true));
|
$uuid = new Cuid2(7);
|
||||||
|
if ($pull_request_id !== 0) {
|
||||||
|
$fqdns = $fqdns->map(function ($fqdn) use ($pull_request_id, $resource) {
|
||||||
|
$preview = ApplicationPreview::findPreviewByApplicationAndPullId($resource->id, $pull_request_id);
|
||||||
|
$url = Url::fromString($fqdn);
|
||||||
|
$template = $resource->preview_url_template;
|
||||||
|
$host = $url->getHost();
|
||||||
|
$schema = $url->getScheme();
|
||||||
|
$random = new Cuid2(7);
|
||||||
|
$preview_fqdn = str_replace('{{random}}', $random, $template);
|
||||||
|
$preview_fqdn = str_replace('{{domain}}', $host, $preview_fqdn);
|
||||||
|
$preview_fqdn = str_replace('{{pr_id}}', $pull_request_id, $preview_fqdn);
|
||||||
|
$preview_fqdn = "$schema://$preview_fqdn";
|
||||||
|
$preview->fqdn = $preview_fqdn;
|
||||||
|
$preview->save();
|
||||||
|
return $preview_fqdn;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$serviceLabels = $serviceLabels->merge(fqdnLabelsForTraefik($uuid, $fqdns));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$defaultLabels = defaultLabels($resource->id, $containerName, type: 'application');
|
$defaultLabels = defaultLabels($resource->id, $containerName, $pull_request_id, type: 'application');
|
||||||
|
|
||||||
$serviceLabels = $serviceLabels->merge($defaultLabels);
|
$serviceLabels = $serviceLabels->merge($defaultLabels);
|
||||||
|
|
||||||
if ($server->isLogDrainEnabled() && $resource->isLogDrainEnabled()) {
|
if ($server->isLogDrainEnabled() && $resource->isLogDrainEnabled()) {
|
||||||
@ -1392,6 +1446,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
data_set($service, 'container_name', $containerName);
|
data_set($service, 'container_name', $containerName);
|
||||||
data_forget($service, 'volumes.*.content');
|
data_forget($service, 'volumes.*.content');
|
||||||
data_forget($service, 'volumes.*.isDirectory');
|
data_forget($service, 'volumes.*.isDirectory');
|
||||||
|
|
||||||
return $service;
|
return $service;
|
||||||
});
|
});
|
||||||
$finalServices = [
|
$finalServices = [
|
||||||
|
@ -24,13 +24,16 @@
|
|||||||
helper="Allow Git LFS during build process." />
|
helper="Allow Git LFS during build process." />
|
||||||
@endif
|
@endif
|
||||||
<form wire:submit.prevent="submit">
|
<form wire:submit.prevent="submit">
|
||||||
<div class="flex gap-2">
|
@if ($application->build_pack !== 'dockercompose')
|
||||||
<x-forms.checkbox helper="Enable GPU usage for this application. More info <a href='https://docs.docker.com/compose/gpu-support/' class='text-white underline' target='_blank'>here</a>." instantSave
|
<div class="flex gap-2">
|
||||||
id="application.settings.is_gpu_enabled" label="GPU Enabled Application" />
|
<x-forms.checkbox
|
||||||
@if ($application->settings->is_gpu_enabled)
|
helper="Enable GPU usage for this application. More info <a href='https://docs.docker.com/compose/gpu-support/' class='text-white underline' target='_blank'>here</a>."
|
||||||
<x-forms.button type="submiot">Save</x-forms.button>
|
instantSave id="application.settings.is_gpu_enabled" label="GPU Enabled Application" />
|
||||||
@endif
|
@if ($application->settings->is_gpu_enabled)
|
||||||
</div>
|
<x-forms.button type="submiot">Save</x-forms.button>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
@if ($application->settings->is_gpu_enabled)
|
@if ($application->settings->is_gpu_enabled)
|
||||||
<div class="flex flex-col w-full gap-2 p-2 xl:flex-row">
|
<div class="flex flex-col w-full gap-2 p-2 xl:flex-row">
|
||||||
<x-forms.input label="GPU Driver" id="application.settings.gpu_driver"> </x-forms.input>
|
<x-forms.input label="GPU Driver" id="application.settings.gpu_driver"> </x-forms.input>
|
||||||
|
@ -47,6 +47,24 @@
|
|||||||
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
|
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
@if ($application->build_pack === 'dockercompose')
|
||||||
|
@if (count($parsedServices) > 0)
|
||||||
|
@foreach (data_get($parsedServices, 'services') as $serviceName => $service)
|
||||||
|
@if (!isDatabaseImage(data_get($service, 'image')))
|
||||||
|
<div class="flex items-end gap-2">
|
||||||
|
<x-forms.input
|
||||||
|
helper="You can specify one domain with path or more with comma. You can specify a port to bind the domain to.<br><br><span class='text-helper'>Example</span><br>- http://app.coolify.io, https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3<br>- http://app.coolify.io:3000 -> app.coolify.io will point to port 3000 inside the container. "
|
||||||
|
label="Domains for {{ str($serviceName)->headline() }}"
|
||||||
|
id="parsedServiceDomains.{{ $serviceName }}.domain"></x-forms.input>
|
||||||
|
@if (!data_get($parsedServiceDomains, "$serviceName.domain"))
|
||||||
|
<x-forms.button wire:click="generateDomain('{{ $serviceName }}')">Generate
|
||||||
|
Domain</x-forms.button>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if ($application->build_pack !== 'dockerimage' && $application->build_pack !== 'dockercompose')
|
@if ($application->build_pack !== 'dockerimage' && $application->build_pack !== 'dockercompose')
|
||||||
@ -119,24 +137,9 @@
|
|||||||
@endif
|
@endif
|
||||||
@if ($application->build_pack === 'dockercompose')
|
@if ($application->build_pack === 'dockercompose')
|
||||||
<x-forms.button wire:click="loadComposeFile">Reload Compose File</x-forms.button>
|
<x-forms.button wire:click="loadComposeFile">Reload Compose File</x-forms.button>
|
||||||
@if (count($parsedServices) > 0)
|
|
||||||
@foreach (data_get($parsedServices, 'services') as $serviceName => $service)
|
<x-forms.textarea rows="10" readonly id="application.docker_compose" label="Docker Compose Content"
|
||||||
@if (!isDatabaseImage(data_get($service, 'image')))
|
helper="You need to modify the docker compose file." />
|
||||||
<div class="flex items-end gap-2">
|
|
||||||
<x-forms.input
|
|
||||||
helper="You can specify one domain with path or more with comma. You can specify a port to bind the domain to.<br><br><span class='text-helper'>Example</span><br>- http://app.coolify.io, https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3<br>- http://app.coolify.io:3000 -> app.coolify.io will point to port 3000 inside the container. "
|
|
||||||
label="Domains for {{ str($serviceName)->headline() }}"
|
|
||||||
id="parsedServiceDomains.{{ $serviceName }}.domain"></x-forms.input>
|
|
||||||
@if (!data_get($parsedServiceDomains, "$serviceName.domain"))
|
|
||||||
<x-forms.button wire:click="generateDomain('{{ $serviceName }}')">Generate
|
|
||||||
Domain</x-forms.button>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
<x-forms.textarea rows="20" readonly id="application.docker_compose"
|
|
||||||
label="Docker Compose Content" />
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($application->dockerfile)
|
@if ($application->dockerfile)
|
||||||
|
@ -225,13 +225,9 @@ Route::post('/source/github/events/manual', function () {
|
|||||||
return response("Nothing to do. No applications found with branch '$base_branch'.");
|
return response("Nothing to do. No applications found with branch '$base_branch'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ray($applications);
|
|
||||||
foreach ($applications as $application) {
|
foreach ($applications as $application) {
|
||||||
ray($application);
|
|
||||||
$webhook_secret = data_get($application, 'manual_webhook_secret_github');
|
$webhook_secret = data_get($application, 'manual_webhook_secret_github');
|
||||||
ray($webhook_secret);
|
|
||||||
$hmac = hash_hmac('sha256', request()->getContent(), $webhook_secret);
|
$hmac = hash_hmac('sha256', request()->getContent(), $webhook_secret);
|
||||||
ray($hmac, $x_hub_signature_256);
|
|
||||||
if (!hash_equals($x_hub_signature_256, $hmac)) {
|
if (!hash_equals($x_hub_signature_256, $hmac)) {
|
||||||
ray('Invalid signature');
|
ray('Invalid signature');
|
||||||
continue;
|
continue;
|
||||||
@ -324,7 +320,6 @@ Route::post('/source/github/events', function () {
|
|||||||
|
|
||||||
$webhook_secret = data_get($github_app, 'webhook_secret');
|
$webhook_secret = data_get($github_app, 'webhook_secret');
|
||||||
$hmac = hash_hmac('sha256', request()->getContent(), $webhook_secret);
|
$hmac = hash_hmac('sha256', request()->getContent(), $webhook_secret);
|
||||||
ray($hmac, $x_hub_signature_256)->blue();
|
|
||||||
if (config('app.env') !== 'local') {
|
if (config('app.env') !== 'local') {
|
||||||
if (!hash_equals($x_hub_signature_256, $hmac)) {
|
if (!hash_equals($x_hub_signature_256, $hmac)) {
|
||||||
return response('not cool');
|
return response('not cool');
|
||||||
@ -661,12 +656,10 @@ Route::post('/payments/paddle/events', function () {
|
|||||||
$h1 = Str::of($signature)->after('h1=');
|
$h1 = Str::of($signature)->after('h1=');
|
||||||
$signedPayload = $ts->value . ':' . request()->getContent();
|
$signedPayload = $ts->value . ':' . request()->getContent();
|
||||||
$verify = hash_hmac('sha256', $signedPayload, config('subscription.paddle_webhook_secret'));
|
$verify = hash_hmac('sha256', $signedPayload, config('subscription.paddle_webhook_secret'));
|
||||||
ray($verify, $h1->value, hash_equals($verify, $h1->value));
|
|
||||||
if (!hash_equals($verify, $h1->value)) {
|
if (!hash_equals($verify, $h1->value)) {
|
||||||
return response('Invalid signature.', 400);
|
return response('Invalid signature.', 400);
|
||||||
}
|
}
|
||||||
$eventType = data_get($payload, 'event_type');
|
$eventType = data_get($payload, 'event_type');
|
||||||
ray($eventType);
|
|
||||||
$webhook = Webhook::create([
|
$webhook = Webhook::create([
|
||||||
'type' => 'paddle',
|
'type' => 'paddle',
|
||||||
'payload' => $payload,
|
'payload' => $payload,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user