Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fixes

Andras Bacsai8991de261073
diff --git a/app/Http/Livewire/Project/Application/Deployments.php b/app/Http/Livewire/Project/Application/Deployments.php
index 3ab123635c..3002051d8f 100644
--- a/app/Http/Livewire/Project/Application/Deployments.php
+++ b/app/Http/Livewire/Project/Application/Deployments.php
@@ -9,6 +9,7 @@ class Deployments extends Component
{
public int $application_id;
public $deployments = [];
+ public int $deployments_count = 0;
public string $current_url;
public int $skip = 0;
public int $default_take = 8;
@@ -24,15 +25,14 @@ class Deployments extends Component
}
public function load_deployments(int|null $take = null)
{
- ray('Take' . $take);
if ($take) {
- ray('Take is not null');
$this->skip = $this->skip + $take;
}
$take = $this->default_take;
- $this->deployments = Application::find($this->application_id)->deployments($this->skip, $take);
-
+ ['deployments' => $deployments, 'count' => $count] = Application::find($this->application_id)->deployments($this->skip, $take);
+ $this->deployments = $deployments;
+ $this->deployments_count = $count;
if (count($this->deployments) !== 0 && count($this->deployments) < $take) {
$this->show_next = false;
return;
diff --git a/app/Http/Livewire/Project/Application/Preview/Form.php b/app/Http/Livewire/Project/Application/Preview/Form.php
index a7a7185925..9cdac681bf 100644
--- a/app/Http/Livewire/Project/Application/Preview/Form.php
+++ b/app/Http/Livewire/Project/Application/Preview/Form.php
@@ -37,7 +37,6 @@ class Form extends Component
{
$this->validate();
$this->application->preview_url_template = str_replace(' ', '', $this->application->preview_url_template);
- ray($this->application->preview_url_template);
$this->application->save();
$this->generate_real_url();
}
diff --git a/app/Http/Livewire/Project/Application/Previews.php b/app/Http/Livewire/Project/Application/Previews.php
index 4c1e8ff10d..4a3af6761e 100644
--- a/app/Http/Livewire/Project/Application/Previews.php
+++ b/app/Http/Livewire/Project/Application/Previews.php
@@ -41,12 +41,12 @@ class Previews extends Component
$this->rate_limit_remaining = $rate_limit_remaining;
$this->pull_requests = $data->sortBy('number')->values();
}
- public function deploy(int $pull_request_id, string|null $pull_request_html_url)
+ public function deploy(int $pull_request_id, string|null $pull_request_html_url = null)
{
try {
$this->set_deployment_uuid();
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
- if (!$found) {
+ if (!$found && !is_null($pull_request_html_url)) {
ApplicationPreview::create([
'application_id' => $this->application->id,
'pull_request_id' => $pull_request_id,
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 655d4b620f..eea7c9f244 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -269,7 +269,6 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
private function next(string $status)
{
- ray($this->application_deployment_queue->status, Str::of($this->application_deployment_queue->status)->startsWith('cancelled'));
if (!Str::of($this->application_deployment_queue->status)->startsWith('cancelled')) {
$this->application_deployment_queue->update([
'status' => $status,
@@ -522,7 +521,7 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
} else {
$commandText = collect($command)->implode("\n");
}
- ray('Executing command', $commandText);
+ ray('Executing command: ' . $commandText);
$this->activity->properties = $this->activity->properties->merge([
'command' => $commandText,
]);
@@ -623,7 +622,6 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
$nixpacks_command .= " --install-cmd \"{$this->application->install_command}\"";
}
$nixpacks_command .= " {$this->workdir}";
- ray('Build command: ' . $nixpacks_command);
return $this->execute_in_builder($nixpacks_command);
}
private function stop_running_container()
diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php
index b53de62097..9ff18f9ba7 100644
--- a/app/Jobs/ContainerStatusJob.php
+++ b/app/Jobs/ContainerStatusJob.php
@@ -34,9 +34,8 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeUnique
public function handle(): void
{
try {
- ray('running ContainerStatusJob', $this->container_name, $this->pull_request_id);
$status = get_container_status(server: $this->application->destination->server, container_id: $this->container_name, throwError: false);
- ray('ContainerStatusJob', $status);
+ ray('Container ' . $this->container_name . ' statuus is ' . $status);
if ($this->pull_request_id) {
$preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id);
$preview->status = $status;
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 46f7956a12..da41e4056b 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -146,8 +146,13 @@ class Application extends BaseModel
public function deployments(int $skip = 0, int $take = 10)
{
- ray('Skip ' . $skip . ' Take ' . $take);
- return ApplicationDeploymentQueue::where('application_id', $this->id)->orderBy('created_at', 'desc')->skip($skip)->take($take)->get();
+ $deployments = ApplicationDeploymentQueue::where('application_id', $this->id)->orderBy('created_at', 'desc');
+ $count = $deployments->count();
+ $deployments = $deployments->skip($skip)->take($take)->get();
+ return [
+ 'count' => $count,
+ 'deployments' => $deployments
+ ];
}
public function get_deployment(string $deployment_uuid)
{
diff --git a/bootstrap/helpers/applications.php b/bootstrap/helpers/applications.php
index ac65607fbc..3a1332e934 100644
--- a/bootstrap/helpers/applications.php
+++ b/bootstrap/helpers/applications.php
@@ -16,7 +16,7 @@ function queue_application_deployment(int $application_id, string $deployment_uu
]);
$queued_deployments = ApplicationDeploymentQueue::where('application_id', $application_id)->where('status', 'queued')->get()->sortByDesc('created_at');
$running_deployments = ApplicationDeploymentQueue::where('application_id', $application_id)->where('status', 'in_progress')->get()->sortByDesc('created_at');
- ray('Q:' . $queued_deployments->count() . 'R:' . $running_deployments->count() . '|Queuing deployment: ' . $deployment_uuid . ' of applicationID: ' . $application_id . ' pull request: ' . $pull_request_id . ' with commit: ' . $commit . ' and is it forced: ' . $force_rebuild);
+ ray('Q:' . $queued_deployments->count() . 'R:' . $running_deployments->count() . '| Queuing deployment: ' . $deployment_uuid . ' of applicationID: ' . $application_id . ' pull request: ' . $pull_request_id . ' with commit: ' . $commit . ' and is it forced: ' . $force_rebuild);
if ($queued_deployments->count() > 1) {
$queued_deployments = $queued_deployments->skip(1);
$queued_deployments->each(function ($queued_deployment, $key) {
diff --git a/resources/views/livewire/project/application/deployments.blade.php b/resources/views/livewire/project/application/deployments.blade.php
index 53b1685cf2..9878fb221d 100644
--- a/resources/views/livewire/project/application/deployments.blade.php
+++ b/resources/views/livewire/project/application/deployments.blade.php
@@ -3,13 +3,13 @@
<div>
<h3>Actions</h3>
@if ($show_next)
- <x-forms.button isHighlighted wire:click="load_deployments({{ $default_take }})">Load More
+ <x-forms.button isHighlighted wire:click="load_deployments({{ $default_take }})">Load Previous
Deployments</x-forms.button>
@else
<x-forms.button disabled>No More Deployments</x-forms.button>
@endif
</div>
- <h3>Deployments</h3>
+ <h3>Deployments <span class="text-xs">({{ $deployments_count }})</span></h3>
@foreach ($deployments as $deployment)
<a @class([
'bg-coolgray-200 p-2 border-l border-dashed transition-colors hover:no-underline',
@@ -28,7 +28,8 @@
class="hover:no-underline">
<div class="flex flex-col justify-start">
<div>
- {{ $deployment->deployment_uuid }} <span class="text-sm text-warning">></span>
+ {{ $deployment->id }} <span class="text-sm text-warning">></span> {{ $deployment->deployment_uuid }} <span
+ class="text-sm text-warning">></span>
{{ $deployment->status }}
</div>
@if (data_get($deployment, 'pull_request_id'))
@@ -47,7 +48,6 @@
@endif
</div>
@endif
-
<div class="flex flex-col" x-data="elapsedTime('{{ $deployment->deployment_uuid }}', '{{ $deployment->status }}', '{{ $deployment->created_at }}', '{{ $deployment->updated_at }}')">
<div>Finished <span x-text="measure_since_started()">0s</span> in <span class="font-bold"
x-text="measure_finished_time()">0s</span></div>