feat(v5): deploy nginx applications through Flux

Create nginx containers through Flux image and container primitives instead of SSH, and allow selecting a custom nginx image from the dashboard.
This commit is contained in:
Andras Bacsai
2026-06-21 22:39:16 +02:00
parent ec3e5dc9eb
commit e543d2b376
7 changed files with 315 additions and 103 deletions
@@ -2,31 +2,34 @@
use App\Actions\V5\Application\DeployNginxApplication;
use App\Models\V5\Application;
use App\Services\Flux\FluxClient;
use Tests\TestCase;
uses(TestCase::class);
it('verifies nginx is running before marking the application running', function () {
it('builds an nginx container spec for the coold mesh runtime', function () {
$application = new Application([
'name' => 'nginx-test',
'image' => 'docker.io/library/nginx:alpine',
'container_name' => 'coolify-v5-nginx-test',
'mesh_namespace' => 'default',
'status' => 'creating',
]);
$action = new DeployNginxApplication;
$method = new ReflectionMethod($action, 'remoteCommand');
$action = new DeployNginxApplication(Mockery::mock(FluxClient::class));
$method = new ReflectionMethod($action, 'containerSpec');
$method->setAccessible(true);
$remoteCommand = $method->invoke($action, $application);
$spec = $method->invoke($action, $application);
expect($remoteCommand)
->toContain('if [ "$(id -u)" = "0" ]; then podman=podman; else podman="sudo -n podman"; fi')
->toContain("--network 'coolify-default-mesh'")
->toContain("--network-alias 'coolify-v5-nginx-test'")
->toContain('$podman inspect')
->not->toContain('docker run')
->not->toContain('docker inspect')
->toContain('.State.Running')
->toContain('Container did not stay running')
->toContain('exit 1');
expect($spec)
->toMatchArray([
'name' => 'coolify-v5-nginx-test',
'image' => 'docker.io/library/nginx:alpine',
'networks' => ['coolify-default-mesh'],
'network_aliases' => ['coolify-v5-nginx-test'],
'dns_search' => ['default.coolify.internal'],
'restart_policy' => 'unless-stopped',
])
->not->toHaveKey('command')
->not->toHaveKey('privileged');
});