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.

wip: services

Andras Bacsai3fc78bc760db
diff --git a/app/Actions/Service/StartService.php b/app/Actions/Service/StartService.php
index e9c0ba546b..113792f432 100644
--- a/app/Actions/Service/StartService.php
+++ b/app/Actions/Service/StartService.php
@@ -12,6 +12,7 @@ class StartService
{
$workdir = service_configuration_dir() . "/{$service->uuid}";
$commands[] = "echo '####### Starting service {$service->name} on {$service->server->name}.'";
+ $commands[] = "echo '####### Pulling images.'";
$commands[] = "mkdir -p $workdir";
$commands[] = "cd $workdir";
@@ -22,7 +23,6 @@ class StartService
foreach ($envs as $env) {
$commands[] = "echo '{$env->key}={$env->value}' >> .env";
}
- $commands[] = "echo '####### Pulling images.'";
$commands[] = "docker compose pull --quiet";
$commands[] = "echo '####### Starting containers.'";
$commands[] = "docker compose up -d >/dev/null 2>&1";
diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php
index 76060cdc64..1067d00285 100644
--- a/app/Jobs/ContainerStatusJob.php
+++ b/app/Jobs/ContainerStatusJob.php
@@ -157,7 +157,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
$foundServices[] = "$foundService->id-$serviceName";
$statusFromDb = $foundService->status;
if ($statusFromDb !== $containerStatus) {
- ray('Updating status: ' . $containerStatus);
+ // ray('Updating status: ' . $containerStatus);
$foundService->update(['status' => $containerStatus]);
}
}
@@ -169,14 +169,14 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
$apps = $service->applications()->get();
$dbs = $service->databases()->get();
foreach ($apps as $app) {
- if (in_array("$service->id-$app->name", $foundServices)) {
+ if (in_array("$app->id-$app->name", $foundServices)) {
continue;
} else {
$exitedServices->push($app);
}
}
foreach ($dbs as $db) {
- if (in_array("$service->id-$db->name", $foundServices)) {
+ if (in_array("$db->id-$db->name", $foundServices)) {
continue;
} else {
$exitedServices->push($db);
diff --git a/app/Models/Service.php b/app/Models/Service.php
index 13add6a153..afc9163597 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -117,15 +117,10 @@ class Service extends BaseModel
'service_id' => $this->id
]);
} else {
- if (Str::of($serviceVariables)->contains('SERVICE_FQDN') || Str::of($serviceVariables)->contains('SERVICE_URL')) {
- $defaultUsableFqdn = "http://$serviceName-{$this->uuid}.{$this->server->ip}.sslip.io";
- if (isDev()) {
- $defaultUsableFqdn = "http://$serviceName-{$this->uuid}.127.0.0.1.sslip.io";
- }
- } else {
- $defaultUsableFqdn = null;
+ $defaultUsableFqdn = "http://$serviceName-{$this->uuid}.{$this->server->ip}.sslip.io";
+ if (isDev()) {
+ $defaultUsableFqdn = "http://$serviceName-{$this->uuid}.127.0.0.1.sslip.io";
}
-
$savedService = ServiceApplication::create([
'name' => $serviceName,
'fqdn' => $defaultUsableFqdn,
@@ -155,7 +150,6 @@ class Service extends BaseModel
if ($fqdns) {
$fqdns = collect(Str::of($fqdns)->explode(','));
}
- ray($fqdns);
// Collect ports
$servicePorts = collect(data_get($service, 'ports', []));
$ports->put($serviceName, $servicePorts);