mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 10:42:23 +00:00
Sentry self-hosted (getsentry/self-hosted 26.8.0) could not be deployed as a Docker Compose application. Three separate problems blocked it: - YAML collection aliases: the first fix raised the limit to 256 only in Application::oldRawParser(). The safety check added in v4.4.0 (validateDockerComposeForInjection) and all other Compose parse calls still used the Symfony default of 128, so the Sentry file (133 aliases) failed with "Maximum number of collection aliases (128) exceeded". Add parseDockerComposeYaml() and use it for every Compose parse. - Argument list too long: the deployment job sent the generated Compose file as base64 inside the SSH command. Linux limits one argument to 128 KiB, and the Sentry file is about 370 KB. execute_remote_command() now accepts an 'input' key that streams content over SSH stdin, and the job writes the Compose file with it. - A list-style build arg without a value (build.args: [SENTRY_IMAGE]) merged into a map environment kept its numeric key, so Docker Compose rejected the file with "non-string key in ...environment: 0". It now becomes NAME with no value, as in Compose. Closes #11725
71 lines
2.9 KiB
PHP
71 lines
2.9 KiB
PHP
<?php
|
|
|
|
use App\Models\Application;
|
|
use App\Models\Server;
|
|
use App\Models\StandaloneDocker;
|
|
use Illuminate\Support\Facades\Process;
|
|
use Symfony\Component\Yaml\Yaml;
|
|
use Tests\TestCase;
|
|
|
|
uses(TestCase::class);
|
|
|
|
it('parses valid Docker Compose files with more than 128 collection aliases', function () {
|
|
Process::fake();
|
|
|
|
$services = collect(range(1, 129))
|
|
->mapWithKeys(fn (int $index): array => ["service-{$index}" => [
|
|
'<<' => '*defaults',
|
|
]])
|
|
->map(fn (array $service, string $name): string => " {$name}:\n <<: {$service['<<']}\n")
|
|
->implode('');
|
|
|
|
$application = new Application;
|
|
$application->docker_compose_raw = "x-defaults: &defaults\n image: alpine:latest\nservices:\n{$services}";
|
|
|
|
$server = new Server;
|
|
$server->ip = '127.0.0.1';
|
|
$server->user = 'root';
|
|
|
|
$destination = new StandaloneDocker;
|
|
$destination->setRelation('server', $server);
|
|
$application->setRelation('destination', $destination);
|
|
|
|
$application->oldRawParser();
|
|
|
|
$parsedCompose = Yaml::parse($application->docker_compose_raw);
|
|
|
|
expect(data_get($parsedCompose, 'services'))->toHaveCount(129)
|
|
->and(data_get($parsedCompose, 'services.service-129.image'))->toBe('alpine:latest')
|
|
->and(data_get($parsedCompose, 'services.service-129.labels'))->toContain('coolify.managed=true');
|
|
});
|
|
|
|
it('keeps a finite collection alias limit for Docker Compose files', function () {
|
|
$services = collect(range(1, Application::MAX_DOCKER_COMPOSE_COLLECTION_ALIASES + 1))
|
|
->map(fn (int $index): string => " service-{$index}:\n <<: *defaults\n")
|
|
->implode('');
|
|
|
|
$application = new Application;
|
|
$application->docker_compose_raw = "x-defaults: &defaults\n image: alpine:latest\nservices:\n{$services}";
|
|
|
|
$application->oldRawParser();
|
|
})->throws(RuntimeException::class, 'Maximum number of collection aliases (256) exceeded');
|
|
|
|
it('accepts Docker Compose files with more than 128 collection aliases during the safety check', function () {
|
|
$services = collect(range(1, 129))
|
|
->map(fn (int $index): string => " service-{$index}:\n <<: *defaults\n")
|
|
->implode('');
|
|
|
|
validateDockerComposeForInjection("x-defaults: &defaults\n image: alpine:latest\nservices:\n{$services}");
|
|
|
|
expect(parseDockerComposeYaml("x-defaults: &defaults\n image: alpine:latest\nservices:\n{$services}"))
|
|
->toHaveKey('services.service-129.image', 'alpine:latest');
|
|
});
|
|
|
|
it('keeps a finite collection alias limit during the Docker Compose safety check', function () {
|
|
$services = collect(range(1, Application::MAX_DOCKER_COMPOSE_COLLECTION_ALIASES + 1))
|
|
->map(fn (int $index): string => " service-{$index}:\n <<: *defaults\n")
|
|
->implode('');
|
|
|
|
validateDockerComposeForInjection("x-defaults: &defaults\n image: alpine:latest\nservices:\n{$services}");
|
|
})->throws(Exception::class, 'Maximum number of collection aliases (256) exceeded');
|