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 fox

Andras Bacsaidd99ad0af8f5
diff --git a/app/Livewire/Settings/Configuration.php b/app/Livewire/Settings/Configuration.php
index c2ed5f656c..43f4afb7a0 100644
--- a/app/Livewire/Settings/Configuration.php
+++ b/app/Livewire/Settings/Configuration.php
@@ -71,117 +71,7 @@ class Configuration extends Component
private function setup_instance_fqdn()
{
- $file = "$this->dynamic_config_path/coolify.yaml";
- if (empty($this->settings->fqdn)) {
- instant_remote_process([
- "rm -f $file",
- ], $this->server);
- } else {
- $url = Url::fromString($this->settings->fqdn);
- $host = $url->getHost();
- $schema = $url->getScheme();
- $traefik_dynamic_conf = [
- 'http' =>
- [
- 'routers' =>
- [
- 'coolify-http' =>
- [
- 'entryPoints' => [
- 0 => 'http',
- ],
- 'service' => 'coolify',
- 'rule' => "Host(`{$host}`)",
- ],
- 'coolify-realtime-ws' =>
- [
- 'entryPoints' => [
- 0 => 'http',
- ],
- 'service' => 'coolify-realtime',
- 'rule' => "Host(`{$host}`) && PathPrefix(`/realtime/`)",
- ],
- ],
- 'services' =>
- [
- 'coolify' =>
- [
- 'loadBalancer' =>
- [
- 'servers' =>
- [
- 0 =>
- [
- 'url' => 'http://coolify:80',
- ],
- ],
- ],
- ],
- 'coolify-realtime' =>
- [
- 'loadBalancer' =>
- [
- 'servers' =>
- [
- 0 =>
- [
- 'url' => 'http://coolify-realtime:6001',
- ],
- ],
- ],
- ],
- ],
- ],
- ];
-
- if ($schema === 'https') {
- $traefik_dynamic_conf['http']['routers']['coolify-http']['middlewares'] = [
- 0 => 'redirect-to-https@docker',
- ];
- $traefik_dynamic_conf['http']['routers']['coolify-realtime-wss']['middlewares'] = [
- 0 => 'redirect-to-https@docker',
- ];
- $traefik_dynamic_conf['http']['routers']['coolify-https'] = [
- 'entryPoints' => [
- 0 => 'https',
- ],
- 'service' => 'coolify',
- 'rule' => "Host(`{$host}`)",
- 'tls' => [
- 'certresolver' => 'letsencrypt',
- ],
- ];
- $traefik_dynamic_conf['http']['routers']['coolify-realtime-wss'] = [
- 'entryPoints' => [
- 0 => 'https',
- ],
- 'service' => 'coolify-realtime',
- 'rule' => "Host(`{$host}`) && PathPrefix(`/realtime/`)",
- 'tls' => [
- 'certresolver' => 'letsencrypt',
- ],
- ];
- }
- $this->save_configuration_to_disk($traefik_dynamic_conf, $file);
- }
- }
+ setup_dynamic_configuration();
- private function save_configuration_to_disk(array $traefik_dynamic_conf, string $file)
- {
- $yaml = Yaml::dump($traefik_dynamic_conf, 12, 2);
- $yaml =
- "# This file is automatically generated by Coolify.\n" .
- "# Do not edit it manually (only if you know what are you doing).\n\n" .
- $yaml;
-
- $base64 = base64_encode($yaml);
- instant_remote_process([
- "mkdir -p $this->dynamic_config_path",
- "echo '$base64' | base64 -d > $file",
- ], $this->server);
-
- if (config('app.env') == 'local') {
- ray($yaml);
- }
}
}