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(proxy) update traefik proxy config for docker swarm

Hederson Boechat071cabdc31d7
diff --git a/app/Actions/Proxy/StartProxy.php b/app/Actions/Proxy/StartProxy.php
index 9bc506d9b5..3139f02e25 100644
--- a/app/Actions/Proxy/StartProxy.php
+++ b/app/Actions/Proxy/StartProxy.php
@@ -28,13 +28,13 @@ class StartProxy
$docker_compose_yml_base64 = base64_encode($configuration);
$server->proxy->last_applied_settings = str($docker_compose_yml_base64)->pipe('md5')->value();
$server->save();
- if ($server->isSwarm()) {
+ if ($server->isSwarmManager()) {
$commands = $commands->merge([
"mkdir -p $proxy_path/dynamic",
"cd $proxy_path",
"echo 'Creating required Docker Compose file.'",
"echo 'Starting coolify-proxy.'",
- 'docker stack deploy -c docker-compose.yml coolify-proxy',
+ 'docker stack deploy --detach=true -c docker-compose.yml coolify-proxy',
"echo 'Successfully started coolify-proxy.'",
]);
} else {
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index a6d3bc1a25..65856633a4 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -1145,7 +1145,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$this->application_deployment_queue->addLogEntry('Rolling update started.');
$this->execute_remote_command(
[
- executeInDocker($this->deployment_uuid, "docker stack deploy --with-registry-auth -c {$this->workdir}{$this->docker_compose_location} {$this->application->uuid}"),
+ executeInDocker($this->deployment_uuid, "docker stack deploy --detach=true --with-registry-auth -c {$this->workdir}{$this->docker_compose_location} {$this->application->uuid}"),
],
);
$this->application_deployment_queue->addLogEntry('Rolling update completed.');
diff --git a/bootstrap/helpers/proxy.php b/bootstrap/helpers/proxy.php
index 463e89b6f8..6a258d52b9 100644
--- a/bootstrap/helpers/proxy.php
+++ b/bootstrap/helpers/proxy.php
@@ -187,7 +187,6 @@ function generate_default_proxy_configuration(Server $server)
'--entryPoints.https.http2.maxConcurrentStreams=50',
'--entrypoints.https.http3',
'--providers.file.directory=/traefik/dynamic/',
- '--providers.docker.exposedbydefault=false',
'--providers.file.watch=true',
'--certificatesresolvers.letsencrypt.acme.httpchallenge=true',
'--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=http',
@@ -212,7 +211,8 @@ function generate_default_proxy_configuration(Server $server)
data_forget($config, 'services.traefik.restart');
data_forget($config, 'services.traefik.labels');
- $config['services']['traefik']['command'][] = '--providers.docker.swarmMode=true';
+ $config['services']['traefik']['command'][] = '--providers.swarm.endpoint=unix:///var/run/docker.sock';
+ $config['services']['traefik']['command'][] = '--providers.swarm.exposedbydefault=false';
$config['services']['traefik']['deploy'] = [
'labels' => $labels,
'placement' => [
@@ -223,6 +223,7 @@ function generate_default_proxy_configuration(Server $server)
];
} else {
$config['services']['traefik']['command'][] = '--providers.docker=true';
+ $config['services']['traefik']['command'][] = '--providers.docker.exposedbydefault=false';
}
} elseif ($proxy_type === 'CADDY') {
$config = [