feat: Force restart coolify proxy

fix: Cannot configure coolify proxy
This commit is contained in:
Andras Bacsai
2022-02-15 15:55:55 +01:00
parent bc723b3f15
commit 4487846fd7
5 changed files with 35 additions and 7 deletions

View File

@@ -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>

View File

@@ -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) {