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.

feat: Force restart coolify proxy fix: Cannot configure coolify proxy

Andras Bacsai4487846fd7c0
diff --git a/src/lib/haproxy/index.ts b/src/lib/haproxy/index.ts
index 48b492d634..d1c32acf05 100644
--- a/src/lib/haproxy/index.ts
+++ b/src/lib/haproxy/index.ts
@@ -212,7 +212,7 @@ export async function configureProxyForApplication({ domain, imageId, applicatio
if (backendAvailable.data.forwardfor.enabled === 'enabled') {
if (backendAvailable.data.name === domain) {
if (server.data.check === 'enabled') {
- if (server.data.address === applicationId) {
+ if (server.data.address === imageId) {
if (server.data.port === port) {
serverConfigured = true;
}
diff --git a/src/lib/queues/index.ts b/src/lib/queues/index.ts
index ebe154051c..11d1ee13f7 100644
--- a/src/lib/queues/index.ts
+++ b/src/lib/queues/index.ts
@@ -144,7 +144,7 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {
});
});
-const buildLogQueueName = dev ? cuid() : 'log_queue';
+const buildLogQueueName = 'log_queue';
const buildLogQueue = new Queue(buildLogQueueName, connectionOptions);
const buildLogWorker = new Worker(buildLogQueueName, async (job) => await logger(job), {
concurrency: 1,
diff --git a/src/lib/queues/proxy.ts b/src/lib/queues/proxy.ts
index 9ef0e85f9d..9ab34af347 100644
--- a/src/lib/queues/proxy.ts
+++ b/src/lib/queues/proxy.ts
@@ -54,9 +54,8 @@ export default async function () {
const { fqdn } = await db.listSettings();
if (fqdn) {
const domain = getDomain(fqdn);
- const found = await checkContainer('/var/run/docker.sock', 'coolify-haproxy');
- if (!found) await startCoolifyProxy('/var/run/docker.sock');
- await configureCoolifyProxyOn({ domain });
+ await startCoolifyProxy('/var/run/docker.sock');
+ await configureCoolifyProxyOn(fqdn);
await setWwwRedirection(fqdn);
const isHttps = fqdn.startsWith('https://');
if (isHttps) await forceSSLOnApplication({ domain });
diff --git a/src/routes/destinations/[id]/_LocalDocker.svelte b/src/routes/destinations/[id]/_LocalDocker.svelte
index 76d2c41bdb..646752a3b9 100644
--- a/src/routes/destinations/[id]/_LocalDocker.svelte
+++ b/src/routes/destinations/[id]/_LocalDocker.svelte
@@ -42,6 +42,17 @@
} catch ({ error }) {
return errorNotification(error);
}
+ } else if (state === true && destination.isCoolifyProxyUsed === false) {
+ destination.isCoolifyProxyUsed = !destination.isCoolifyProxyUsed;
+ try {
+ await post(`/destinations/${id}/settings.json`, {
+ isCoolifyProxyUsed: destination.isCoolifyProxyUsed,
+ engine: destination.engine
+ });
+ await startProxy();
+ } catch ({ error }) {
+ return errorNotification(error);
+ }
}
});
async function changeProxySetting() {
@@ -89,6 +100,24 @@
return errorNotification(error);
}
}
+ async function forceRestartProxy() {
+ try {
+ toast.push('Coolify Proxy restarting...');
+ await post(`/destinations/${id}/stop.json`, { engine: destination.engine });
+ await post(`/destinations/${id}/settings.json`, {
+ isCoolifyProxyUsed: false,
+ engine: destination.engine
+ });
+ await post(`/destinations/${id}/start.json`, { engine: destination.engine });
+ await post(`/destinations/${id}/settings.json`, {
+ isCoolifyProxyUsed: true,
+ engine: destination.engine
+ });
+ window.location.reload();
+ } catch ({ error }) {
+ return errorNotification(error);
+ }
+ }
</script>
<div class="flex justify-center px-6 pb-8">
@@ -158,6 +187,7 @@
: ''
}`}
/>
+ <button on:click|preventDefault={forceRestartProxy}>Force Restart Proxy</button>
</ul>
</div>
</form>
diff --git a/src/routes/settings/index.json.ts b/src/routes/settings/index.json.ts
index cad2402330..cdf3ee85db 100644
--- a/src/routes/settings/index.json.ts
+++ b/src/routes/settings/index.json.ts
@@ -87,8 +87,7 @@ export const post: RequestHandler = async (event) => {
}
}
if (fqdn) {
- const found = await checkContainer('/var/run/docker.sock', 'coolify-haproxy');
- if (!found) await startCoolifyProxy('/var/run/docker.sock');
+ await startCoolifyProxy('/var/run/docker.sock');
const domain = getDomain(fqdn);
const isHttps = fqdn.startsWith('https://');
if (domain) {