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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: proxy UI
Andras Bacsai5b6406d09d9b
diff --git a/app/Actions/Proxy/StartProxy.php b/app/Actions/Proxy/StartProxy.phpindex 2050e2ca16..5e1c79aee7 100644--- a/app/Actions/Proxy/StartProxy.php+++ b/app/Actions/Proxy/StartProxy.php@@ -50,13 +50,15 @@ class StartProxy"echo 'Creating Docker Compose file...'","echo 'Pulling docker image...'",'docker compose pull -q',- "echo 'Stopping old proxy...'",+ "echo 'Stopping existing proxy...'",'docker compose down -v --remove-orphans',- "echo 'Starting new proxy...'",+ "lsof -nt -i:80 | xargs -r kill -9",+ "lsof -nt -i:443 | xargs -r kill -9",+ "echo 'Starting proxy...'",'docker compose up -d --remove-orphans',"echo 'Proxy installed successfully...'"], $server);return $activity;}-}+}\ No newline at end of filediff --git a/app/Http/Livewire/Server/Proxy.php b/app/Http/Livewire/Server/Proxy.phpindex 5d3c1ebba4..d38eaa76d9 100644--- a/app/Http/Livewire/Server/Proxy.php+++ b/app/Http/Livewire/Server/Proxy.php@@ -25,29 +25,20 @@ class Proxy extends Component{$this->server->refresh();}- public function switchProxy()+ public function change_proxy(){$this->server->proxy = null;$this->server->save();$this->emit('proxyStatusUpdated');}- public function setProxy(string $proxy_type)+ public function select_proxy(string $proxy_type){$this->server->proxy->type = $proxy_type;$this->server->proxy->status = 'exited';$this->server->save();$this->emit('proxyStatusUpdated');}- public function stopProxy()- {- instant_remote_process([- "docker rm -f coolify-proxy",- ], $this->server);- $this->server->proxy->status = 'exited';- $this->server->save();- $this->emit('proxyStatusUpdated');- }- public function saveConfiguration()+ public function submit(){try {$proxy_path = config('coolify.proxy_config_path');@@ -67,7 +58,7 @@ class Proxy extends Componentreturn general_error_handler(err: $e);}}- public function resetProxy()+ public function reset_proxy_configuration(){try {$this->proxy_settings = resolve(CheckProxySettingsInSync::class)($this->server, true);@@ -75,7 +66,7 @@ class Proxy extends Componentreturn general_error_handler(err: $e);}}- public function checkProxySettingsInSync()+ public function load_proxy_configuration(){try {$this->proxy_settings = resolve(CheckProxySettingsInSync::class)($this->server);@@ -83,4 +74,4 @@ class Proxy extends Componentreturn general_error_handler(err: $e);}}-}+}\ No newline at end of filediff --git a/app/Http/Livewire/Server/Proxy/Deploy.php b/app/Http/Livewire/Server/Proxy/Deploy.phpindex c1ca4ab578..74e75a071f 100644--- a/app/Http/Livewire/Server/Proxy/Deploy.php+++ b/app/Http/Livewire/Server/Proxy/Deploy.php@@ -16,7 +16,7 @@ class Deploy extends Component{$this->server->refresh();}- public function deploy()+ public function start_proxy(){if ($this->server->proxy->last_applied_settings &&diff --git a/app/Http/Livewire/Server/Proxy/Status.php b/app/Http/Livewire/Server/Proxy/Status.phpindex e4d18e4a25..068402b9e5 100644--- a/app/Http/Livewire/Server/Proxy/Status.php+++ b/app/Http/Livewire/Server/Proxy/Status.php@@ -14,7 +14,7 @@ class Status extends Component{$this->server->refresh();}- public function proxyStatus()+ public function get_status(){try {dispatch_sync(new ProxyContainerStatusJob(@@ -25,4 +25,4 @@ class Status extends Componentray($e->getMessage());}}-}+}\ No newline at end of filediff --git a/docker/dev-ssu/Dockerfile b/docker/dev-ssu/Dockerfileindex e01de4a968..dc999f785c 100644--- a/docker/dev-ssu/Dockerfile+++ b/docker/dev-ssu/Dockerfile@@ -1,18 +1,18 @@FROM serversideup/php:8.2-fpm-nginxARG POSTGRES_VERSION=15-RUN apt-get update+RUN apt-get update# Postgres version requirementsRUN apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https curl -yRUN curl -fSsL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/postgresql.gpg > /dev/nullRUN echo deb [arch=amd64,arm64,ppc64el signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main | tee -a /etc/apt/sources.list.d/postgresql.list-RUN apt-get update+RUN apt-get updateRUN apt-get install postgresql-client-$POSTGRES_VERSION -y# Coolify requirements-RUN apt-get install -y php-pgsql openssh-client git git-lfs jq+RUN apt-get install -y php-pgsql openssh-client git git-lfs jq lsofRUN apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*diff --git a/docker/prod-ssu/Dockerfile b/docker/prod-ssu/Dockerfileindex 5bcbaa1f25..0804ee076f 100644--- a/docker/prod-ssu/Dockerfile+++ b/docker/prod-ssu/Dockerfile@@ -15,18 +15,18 @@ FROM serversideup/php:8.2-fpm-nginxWORKDIR /var/www/htmlARG POSTGRES_VERSION=15-RUN apt-get update+RUN apt-get update# Postgres version requirementsRUN apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https curl -yRUN curl -fSsL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/postgresql.gpg > /dev/nullRUN echo deb [arch=amd64,arm64,ppc64el signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main | tee -a /etc/apt/sources.list.d/postgresql.list-RUN apt-get update+RUN apt-get updateRUN apt-get install postgresql-client-$POSTGRES_VERSION -y# Coolify requirements-RUN apt-get install -y php-pgsql openssh-client git git-lfs jq+RUN apt-get install -y php-pgsql openssh-client git git-lfs jq lsofRUN apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*COPY docker/prod-ssu/nginx.conf /etc/nginx/conf.d/custom.confdiff --git a/docker/testing-host/Dockerfile b/docker/testing-host/Dockerfileindex 1fdce8a9d5..6cd5cc682c 100644--- a/docker/testing-host/Dockerfile+++ b/docker/testing-host/Dockerfile@@ -14,7 +14,7 @@ ARG NIXPACKS_VERSION=1.9.0USER rootWORKDIR /root-RUN apk add --no-cache bash curl git git-lfs openssh-client openssh-server tar tini postgresql-client+RUN apk add --no-cache bash curl git git-lfs openssh-client openssh-server tar tini postgresql-client lsofRUN mkdir -p ~/.docker/cli-pluginsRUN if [[ ${TARGETPLATFORM} == 'linux/amd64' ]]; then \curl -sSL https://github.com/docker/buildx/releases/download/v${DOCKER_BUILDX_VERSION}/buildx-v${DOCKER_BUILDX_VERSION}.linux-amd64 -o ~/.docker/cli-plugins/docker-buildx && \diff --git a/resources/views/livewire/server/proxy.blade.php b/resources/views/livewire/server/proxy.blade.phpindex 41b951e115..4859b3a292 100644--- a/resources/views/livewire/server/proxy.blade.php+++ b/resources/views/livewire/server/proxy.blade.php@@ -1,14 +1,14 @@<div>@if ($server->settings->is_usable)@if ($server->proxy->type)- <div x-init="$wire.checkProxySettingsInSync">+ <div x-init="$wire.load_proxy_configuration">@if ($selectedProxy->value === 'TRAEFIK_V2')- <form wire:submit.prevent='saveConfiguration'>+ <form wire:submit.prevent='submit'><div class="flex items-center gap-2"><h2>Proxy</h2><x-forms.button type="submit">Save</x-forms.button>@if ($server->proxy->status === 'exited')- <x-forms.button wire:click.prevent="switchProxy">Switch Proxy</x-forms.button>+ <x-forms.button wire:click.prevent="change_proxy">Switch Proxy</x-forms.button>@endif<livewire:server.proxy.status :server="$server" /></div>@@ -26,15 +26,15 @@</div><x-forms.input placeholder="https://coolify.io" id="redirect_url" label="Default Redirect 404"helper="All urls that has no service available will be redirected to this domain.<span class='text-helper'>You can set to your main marketing page or your social media link.</span>" />- <div wire:loading wire:target="checkProxySettingsInSync" class="pt-4">+ <div wire:loading wire:target="load_proxy_configuration" class="pt-4"><x-loading text="Loading proxy configuration..." /></div>- <div wire:loading.remove wire:target="checkProxySettingsInSync">+ <div wire:loading.remove wire:target="load_proxy_configuration">@if ($proxy_settings)<div class="flex flex-col gap-2 pt-2"><x-forms.textarea label="Configuration file: traefik.conf" name="proxy_settings"wire:model.defer="proxy_settings" rows="30" />- <x-forms.button wire:click.prevent="resetProxy">+ <x-forms.button wire:click.prevent="reset_proxy_configuration">Reset configuration to default</x-forms.button></div>@@ -48,7 +48,7 @@<div class="pt-2 pb-10 ">Select a proxy you would like to use on this server.</div><div class="flex gap-2"><x-forms.button class="w-32 box"- wire:click="setProxy('{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}')">+ wire:click="select_proxy('{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}')">Traefikv2</x-forms.button>diff --git a/resources/views/livewire/server/proxy/deploy.blade.php b/resources/views/livewire/server/proxy/deploy.blade.phpindex 99c09d5bf8..a3e4467be3 100644--- a/resources/views/livewire/server/proxy/deploy.blade.php+++ b/resources/views/livewire/server/proxy/deploy.blade.php@@ -1,14 +1,24 @@<div>+ <x-modal yesOrNo modalId="stopProxy" modalTitle="Stop Proxy" action="stop">+ <x-slot:modalBody>+ <p>This proxy will be stopped. It is not reversible. <br>All resources will be unavailable.+ <br>Please think+ again.+ </p>+ </x-slot:modalBody>+ </x-modal>+ <x-modal yesOrNo modalId="startProxy" modalTitle="Start Proxy" action="start_proxy">+ <x-slot:modalBody>+ <p>This will start the proxy on this server and <span class="text-warning">stop any running process that is+ using port 80 and+ 443</span>.+ <br>Please think+ again.+ </p>+ </x-slot:modalBody>+ </x-modal>@if (data_get($server, 'proxy.type'))@if (data_get($server, 'proxy.status') === 'running')- <x-modal yesOrNo modalId="stopProxy" modalTitle="Stop Proxy" action="stop">- <x-slot:modalBody>- <p>This proxy will be stopped. It is not reversible. <br>All resources will be unavailable.- <br>Please think- again.- </p>- </x-slot:modalBody>- </x-modal><div class="flex gap-4"><button><a target="_blank" href="{{ base_ip() }}:8080">@@ -16,91 +26,27 @@<x-external-link /></a></button>- {{-- <div class="group">- <label tabindex="0" class="flex items-center gap-2 cursor-pointer hover:text-white"> Links- <x-chevron-down />- </label>- <div class="absolute hidden group-hover:block ">- <ul tabindex="0"- class="relative text-xs text-white normal-case rounded -ml-28 min-w-max menu bg-coolgray-200">- <li>-- </li>- </ul>- </div>- </div> --}}- <button wire:click='deploy'- class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-warning" viewBox="0 0 24 24"- stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"- stroke-linejoin="round">- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>- <path- d="M10.09 4.01l.496 -.495a2 2 0 0 1 2.828 0l7.071 7.07a2 2 0 0 1 0 2.83l-7.07 7.07a2 2 0 0 1 -2.83 0l-7.07 -7.07a2 2 0 0 1 0 -2.83l3.535 -3.535h-3.988">- </path>- <path d="M7.05 11.038v-3.988"></path>- </svg>- Restart- </button><x-forms.button isModal noStyle modalId="stopProxy"class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"- stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"- stroke-linejoin="round">+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" stroke-width="2"+ stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"></path><path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"></path></svg>Stop</x-forms.button>- {{-- <div class="group">- <label tabindex="0" class="flex items-center gap-2 cursor-pointer hover:text-white"> Actions- <x-chevron-down />- </label>- <div class="absolute hidden group-hover:block ">- <ul tabindex="0"- class="relative text-xs text-white normal-case rounded min-w-max menu bg-coolgray-200 -ml-14">- <li>- <div class="rounded-none hover:bg-coollabs hover:text-white" wire:click='deploy'><svg- xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24"- stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"- stroke-linejoin="round">- <path stroke="none" d="M0 0h24v24H0z" fill="none" />- <path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4" />- <path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4" />- <path d="M12 9l0 3" />- <path d="M12 15l.01 0" />- </svg>Restart</div>- </li>- <li>- <x-forms.button isModal noStyle modalId="stopProxy"- class="rounded-none hover:bg-red-500 hover:text-white">- <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24"- stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"- stroke-linejoin="round">- <path stroke="none" d="M0 0h24v24H0z" fill="none" />- <path d="M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5" />- <path d="M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5" />- <path d="M14 5.5a1.5 1.5 0 0 1 3 0v6.5" />- <path- d="M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47" />- </svg>Stop- </x-forms.button>-- </li>- </ul>- </div>- </div> --}}</div>@else- <button wire:click='deploy' class="flex items-center gap-2 cursor-pointer hover:text-white">+ <x-forms.button isModal noStyle modalId="startProxy"+ class="flex items-center gap-2 cursor-pointer hover:text-white"><svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-warning" viewBox="0 0 24 24"stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path d="M7 4v16l13 -8z" /></svg>Start Proxy- </button>+ </x-forms.button>@endif@endif</div>diff --git a/resources/views/livewire/server/proxy/status.blade.php b/resources/views/livewire/server/proxy/status.blade.phpindex e27c95ddab..032c534c65 100644--- a/resources/views/livewire/server/proxy/status.blade.php+++ b/resources/views/livewire/server/proxy/status.blade.php@@ -1,4 +1,4 @@-<div wire:poll.10000ms="proxyStatus" x-init="$wire.proxyStatus">+<div wire:poll.10000ms="get_status" x-init="$wire.get_status">@if ($server->proxy->status === 'running')<x-status.running />@elseif ($server->proxy->status === 'restarting')