Skip to content

Commit a7d67e4

Browse files
committed
fix: copy large compose files through scp (not ssh)
1 parent dfd5cc9 commit a7d67e4

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

app/Models/Service.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
use Illuminate\Database\Eloquent\Relations\HasMany;
88
use Illuminate\Database\Eloquent\SoftDeletes;
99
use Illuminate\Support\Collection;
10+
use Illuminate\Support\Facades\Storage;
1011
use OpenApi\Attributes as OA;
1112
use Spatie\Url\Url;
12-
use Symfony\Component\Yaml\Yaml;
13+
use Visus\Cuid2\Cuid2;
1314

1415
#[OA\Schema(
1516
description: 'Service model',
@@ -999,14 +1000,18 @@ public function workdir()
9991000
public function saveComposeConfigs()
10001001
{
10011002
$workdir = $this->workdir();
1002-
$commands[] = "mkdir -p $workdir";
1003-
$commands[] = "cd $workdir";
10041003

1005-
$json = Yaml::parse($this->docker_compose);
1006-
$this->docker_compose = Yaml::dump($json, 10, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK);
1007-
$docker_compose_base64 = base64_encode($this->docker_compose);
1004+
instant_remote_process([
1005+
"mkdir -p $workdir",
1006+
"cd $workdir",
1007+
], $this->server);
1008+
1009+
$filename = new Cuid2.'-docker-compose.yml';
1010+
Storage::disk('local')->put("tmp/{$filename}", $this->docker_compose);
1011+
$path = Storage::path("tmp/{$filename}");
1012+
instant_scp($path, "{$workdir}/docker-compose.yml", $this->server);
1013+
Storage::disk('local')->delete("tmp/{$filename}");
10081014

1009-
$commands[] = "echo $docker_compose_base64 | base64 -d | tee docker-compose.yml > /dev/null";
10101015
$commands[] = 'rm -f .env || true';
10111016

10121017
$envs_from_coolify = $this->environment_variables()->get();

bootstrap/helpers/shared.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3544,7 +3544,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
35443544

35453545
$parsedServices->put($serviceName, $payload);
35463546
}
3547-
ray($parsedServices);
35483547
$topLevel->put('services', $parsedServices);
35493548
$customOrder = ['services', 'volumes', 'networks', 'configs', 'secrets'];
35503549

0 commit comments

Comments
 (0)