diff --git a/app/Actions/Proxy/StartProxy.php b/app/Actions/Proxy/StartProxy.php index 2050e2ca1..5e1c79aee 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 file diff --git a/app/Http/Livewire/Server/Proxy.php b/app/Http/Livewire/Server/Proxy.php index 5d3c1ebba..d38eaa76d 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 Component return 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 Component return 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 Component return general_error_handler(err: $e); } } -} +} \ No newline at end of file diff --git a/app/Http/Livewire/Server/Proxy/Deploy.php b/app/Http/Livewire/Server/Proxy/Deploy.php index c1ca4ab57..74e75a071 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.php index e4d18e4a2..068402b9e 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 Component ray($e->getMessage()); } } -} +} \ No newline at end of file diff --git a/docker/dev-ssu/Dockerfile b/docker/dev-ssu/Dockerfile index e01de4a96..dc999f785 100644 --- a/docker/dev-ssu/Dockerfile +++ b/docker/dev-ssu/Dockerfile @@ -1,18 +1,18 @@ FROM serversideup/php:8.2-fpm-nginx ARG POSTGRES_VERSION=15 -RUN apt-get update +RUN apt-get update # Postgres version requirements RUN apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https curl -y RUN curl -fSsL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/postgresql.gpg > /dev/null RUN 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 update RUN 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 lsof RUN 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/Dockerfile index 5bcbaa1f2..0804ee076 100644 --- a/docker/prod-ssu/Dockerfile +++ b/docker/prod-ssu/Dockerfile @@ -15,18 +15,18 @@ FROM serversideup/php:8.2-fpm-nginx WORKDIR /var/www/html ARG POSTGRES_VERSION=15 -RUN apt-get update +RUN apt-get update # Postgres version requirements RUN apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https curl -y RUN curl -fSsL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/postgresql.gpg > /dev/null RUN 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 update RUN 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 lsof RUN 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.conf diff --git a/docker/testing-host/Dockerfile b/docker/testing-host/Dockerfile index 1fdce8a9d..6cd5cc682 100644 --- a/docker/testing-host/Dockerfile +++ b/docker/testing-host/Dockerfile @@ -14,7 +14,7 @@ ARG NIXPACKS_VERSION=1.9.0 USER root WORKDIR /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 lsof RUN mkdir -p ~/.docker/cli-plugins RUN 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.php index 41b951e11..4859b3a29 100644 --- a/resources/views/livewire/server/proxy.blade.php +++ b/resources/views/livewire/server/proxy.blade.php @@ -1,14 +1,14 @@
@if ($server->settings->is_usable) @if ($server->proxy->type) -
+
@if ($selectedProxy->value === 'TRAEFIK_V2') -
+

Proxy

Save @if ($server->proxy->status === 'exited') - Switch Proxy + Switch Proxy @endif
@@ -26,15 +26,15 @@
-
+
-
+
@if ($proxy_settings)
- + Reset configuration to default
@@ -48,7 +48,7 @@
Select a proxy you would like to use on this server.
+ wire:click="select_proxy('{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}')"> Traefik v2 diff --git a/resources/views/livewire/server/proxy/deploy.blade.php b/resources/views/livewire/server/proxy/deploy.blade.php index 99c09d5bf..a3e4467be 100644 --- a/resources/views/livewire/server/proxy/deploy.blade.php +++ b/resources/views/livewire/server/proxy/deploy.blade.php @@ -1,14 +1,24 @@
+ + +

This proxy will be stopped. It is not reversible.
All resources will be unavailable. +
Please think + again. +

+
+
+ + +

This will start the proxy on this server and stop any running process that is + using port 80 and + 443. +
Please think + again. +

+
+
@if (data_get($server, 'proxy.type')) @if (data_get($server, 'proxy.status') === 'running') - - -

This proxy will be stopped. It is not reversible.
All resources will be unavailable. -
Please think - again. -

-
-
- {{--
- - -
--}} - - + Stop - {{--
- - -
--}}
@else - + @endif @endif
diff --git a/resources/views/livewire/server/proxy/status.blade.php b/resources/views/livewire/server/proxy/status.blade.php index e27c95dda..032c534c6 100644 --- a/resources/views/livewire/server/proxy/status.blade.php +++ b/resources/views/livewire/server/proxy/status.blade.php @@ -1,4 +1,4 @@ -
+
@if ($server->proxy->status === 'running') @elseif ($server->proxy->status === 'restarting')