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.

Refactor Dockerfile deployment logic and server validation

Andras Bacsai16281248ac7b
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 25c6c879c7..4c04509203 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -1078,9 +1078,15 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
);
} else {
// Pure Dockerfile based deployment
- $this->execute_remote_command([
- executeInDocker($this->deployment_uuid, "docker build --pull $this->buildTarget $this->addHosts --network host -f {$this->workdir}{$this->dockerfile_location} {$this->build_args} --progress plain -t $this->production_image_name {$this->workdir}"), "hidden" => true
- ]);
+ if ($this->application->dockerfile) {
+ $this->execute_remote_command([
+ executeInDocker($this->deployment_uuid, "docker build --pull $this->buildTarget $this->addHosts --network host -f {$this->workdir}{$this->dockerfile_location} {$this->build_args} --progress plain -t $this->production_image_name {$this->workdir}"), "hidden" => true
+ ]);
+ } else {
+ $this->execute_remote_command([
+ executeInDocker($this->deployment_uuid, "docker build $this->buildTarget $this->addHosts --network host -f {$this->workdir}{$this->dockerfile_location} {$this->build_args} --progress plain -t $this->production_image_name {$this->workdir}"), "hidden" => true
+ ]);
+ }
}
}
diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php
index 74d300c38d..2501568311 100644
--- a/app/Jobs/ContainerStatusJob.php
+++ b/app/Jobs/ContainerStatusJob.php
@@ -23,7 +23,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
public function __construct(public Server $server)
{
- $this->handle();
+ // $this->handle();
}
public function middleware(): array
{
diff --git a/app/Models/Server.php b/app/Models/Server.php
index 788808430d..a868004032 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -169,23 +169,6 @@ class Server extends BaseModel
Sleep::for(5)->seconds();
return;
}
- $this->update([
- 'unreachable_count' => 0,
- ]);
- if (data_get($this, 'unreachable_notification_sent') === true) {
- ray('Server is reachable again, sending notification...');
- $this->team->notify(new Revived($this));
- $this->update(['unreachable_notification_sent' => false]);
- }
- if (
- data_get($this, 'settings.is_reachable') === false ||
- data_get($this, 'settings.is_usable') === false
- ) {
- $this->settings()->update([
- 'is_reachable' => true,
- 'is_usable' => true
- ]);
- }
break;
}
}
@@ -308,19 +291,37 @@ class Server extends BaseModel
{
return $this->settings->is_reachable && $this->settings->is_usable;
}
- public function isDrainLogActivated() {
+ public function isDrainLogActivated()
+ {
return $this->settings->is_logdrain_newrelic_enabled || $this->settings->is_logdrain_highlight_enabled || $this->settings->is_logdrain_axiom_enabled;
}
public function validateConnection()
{
$uptime = instant_remote_process(['uptime'], $this, false);
if (!$uptime) {
- $this->settings->is_reachable = false;
- $this->settings->save();
+ $this->settings()->update([
+ 'is_reachable' => false,
+ 'is_usable' => false
+ ]);
return false;
}
- $this->settings->is_reachable = true;
- $this->settings->save();
+
+ if (data_get($this, 'unreachable_notification_sent') === true) {
+ $this->team->notify(new Revived($this));
+ $this->update(['unreachable_notification_sent' => false]);
+ }
+ if (
+ data_get($this, 'settings.is_reachable') === false ||
+ data_get($this, 'settings.is_usable') === false
+ ) {
+ $this->settings()->update([
+ 'is_reachable' => true,
+ 'is_usable' => true
+ ]);
+ }
+ $this->update([
+ 'unreachable_count' => 0,
+ ]);
return true;
}
public function validateDockerEngine($throwError = false)