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.

fix: copy large compose files through scp (not ssh)

Andras Bacsaia7d67e44cae5
diff --git a/app/Models/Service.php b/app/Models/Service.php
index e55c0bea53..df44bb2315 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -7,9 +7,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Storage;
use OpenApi\Attributes as OA;
use Spatie\Url\Url;
-use Symfony\Component\Yaml\Yaml;
+use Visus\Cuid2\Cuid2;
#[OA\Schema(
description: 'Service model',
@@ -999,14 +1000,18 @@ class Service extends BaseModel
public function saveComposeConfigs()
{
$workdir = $this->workdir();
- $commands[] = "mkdir -p $workdir";
- $commands[] = "cd $workdir";
- $json = Yaml::parse($this->docker_compose);
- $this->docker_compose = Yaml::dump($json, 10, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK);
- $docker_compose_base64 = base64_encode($this->docker_compose);
+ instant_remote_process([
+ "mkdir -p $workdir",
+ "cd $workdir",
+ ], $this->server);
+
+ $filename = new Cuid2.'-docker-compose.yml';
+ Storage::disk('local')->put("tmp/{$filename}", $this->docker_compose);
+ $path = Storage::path("tmp/{$filename}");
+ instant_scp($path, "{$workdir}/docker-compose.yml", $this->server);
+ Storage::disk('local')->delete("tmp/{$filename}");
- $commands[] = "echo $docker_compose_base64 | base64 -d | tee docker-compose.yml > /dev/null";
$commands[] = 'rm -f .env || true';
$envs_from_coolify = $this->environment_variables()->get();
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index e7b42ea2c7..aa114dec1f 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -3544,7 +3544,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
$parsedServices->put($serviceName, $payload);
}
- ray($parsedServices);
$topLevel->put('services', $parsedServices);
$customOrder = ['services', 'volumes', 'networks', 'configs', 'secrets'];