commit
0df0322d36
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "coolify",
|
"name": "coolify",
|
||||||
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
||||||
"version": "2.0.8",
|
"version": "2.0.10",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "docker compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",
|
"dev": "docker compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",
|
||||||
|
@ -41,7 +41,7 @@ export function ErrorHandler(e) {
|
|||||||
e = new Error(e.toString());
|
e = new Error(e.toString());
|
||||||
}
|
}
|
||||||
let truncatedError = e;
|
let truncatedError = e;
|
||||||
if (e.message.includes('docker run')) {
|
if (e.message?.includes('docker run')) {
|
||||||
let truncatedArray = [];
|
let truncatedArray = [];
|
||||||
truncatedArray = truncatedError.message.split('-').filter((line) => {
|
truncatedArray = truncatedError.message.split('-').filter((line) => {
|
||||||
if (!line.startsWith('e ')) {
|
if (!line.startsWith('e ')) {
|
||||||
@ -50,7 +50,7 @@ export function ErrorHandler(e) {
|
|||||||
});
|
});
|
||||||
truncatedError.message = truncatedArray.join('-');
|
truncatedError.message = truncatedArray.join('-');
|
||||||
}
|
}
|
||||||
if (e.message.includes('git clone')) {
|
if (e.message?.includes('git clone')) {
|
||||||
truncatedError.message = 'git clone failed';
|
truncatedError.message = 'git clone failed';
|
||||||
}
|
}
|
||||||
sentry.captureException(truncatedError);
|
sentry.captureException(truncatedError);
|
||||||
@ -61,11 +61,11 @@ export function ErrorHandler(e) {
|
|||||||
error: truncatedError.error || truncatedError.message
|
error: truncatedError.error || truncatedError.message
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (truncatedError.name === 'NotFoundError') {
|
if (truncatedError?.name === 'NotFoundError') {
|
||||||
payload.status = 404;
|
payload.status = 404;
|
||||||
}
|
}
|
||||||
if (truncatedError instanceof P.PrismaClientKnownRequestError) {
|
if (truncatedError instanceof P.PrismaClientKnownRequestError) {
|
||||||
if (truncatedError.code === 'P2002') {
|
if (truncatedError?.code === 'P2002') {
|
||||||
payload.body.message = 'Already exists. Choose another name.';
|
payload.body.message = 'Already exists. Choose another name.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,11 +107,7 @@ export async function forceSSLOffApplication({ domain }) {
|
|||||||
export async function forceSSLOnApplication({ domain }) {
|
export async function forceSSLOnApplication({ domain }) {
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
const haproxy = await haproxyInstance();
|
const haproxy = await haproxyInstance();
|
||||||
try {
|
|
||||||
await checkHAProxy(haproxy);
|
await checkHAProxy(haproxy);
|
||||||
} catch (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const transactionId = await getNextTransactionId();
|
const transactionId = await getNextTransactionId();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -162,11 +158,7 @@ export async function forceSSLOnApplication({ domain }) {
|
|||||||
|
|
||||||
export async function deleteProxy({ id }) {
|
export async function deleteProxy({ id }) {
|
||||||
const haproxy = await haproxyInstance();
|
const haproxy = await haproxyInstance();
|
||||||
try {
|
|
||||||
await checkHAProxy(haproxy);
|
await checkHAProxy(haproxy);
|
||||||
} catch (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const transactionId = await getNextTransactionId();
|
const transactionId = await getNextTransactionId();
|
||||||
try {
|
try {
|
||||||
await haproxy.get(`v2/services/haproxy/configuration/backends/${id}`).json();
|
await haproxy.get(`v2/services/haproxy/configuration/backends/${id}`).json();
|
||||||
@ -198,11 +190,7 @@ export async function reloadHaproxy(engine) {
|
|||||||
}
|
}
|
||||||
export async function configureProxyForApplication({ domain, imageId, applicationId, port }) {
|
export async function configureProxyForApplication({ domain, imageId, applicationId, port }) {
|
||||||
const haproxy = await haproxyInstance();
|
const haproxy = await haproxyInstance();
|
||||||
try {
|
|
||||||
await checkHAProxy(haproxy);
|
await checkHAProxy(haproxy);
|
||||||
} catch (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let serverConfigured = false;
|
let serverConfigured = false;
|
||||||
let backendAvailable: any = null;
|
let backendAvailable: any = null;
|
||||||
@ -283,11 +271,7 @@ export async function configureProxyForApplication({ domain, imageId, applicatio
|
|||||||
export async function configureCoolifyProxyOff(fqdn) {
|
export async function configureCoolifyProxyOff(fqdn) {
|
||||||
const domain = getDomain(fqdn);
|
const domain = getDomain(fqdn);
|
||||||
const haproxy = await haproxyInstance();
|
const haproxy = await haproxyInstance();
|
||||||
try {
|
|
||||||
await checkHAProxy(haproxy);
|
await checkHAProxy(haproxy);
|
||||||
} catch (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const transactionId = await getNextTransactionId();
|
const transactionId = await getNextTransactionId();
|
||||||
@ -308,22 +292,21 @@ export async function configureCoolifyProxyOff(fqdn) {
|
|||||||
throw error?.response?.body || error;
|
throw error?.response?.body || error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function checkHAProxy(haproxy) {
|
export async function checkHAProxy(haproxy?: any) {
|
||||||
if (!haproxy) haproxy = await haproxyInstance();
|
if (!haproxy) haproxy = await haproxyInstance();
|
||||||
try {
|
try {
|
||||||
await haproxy.get('v2/info');
|
await haproxy.get('v2/info');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw 'HAProxy is not running, but it should be!';
|
throw {
|
||||||
|
message:
|
||||||
|
'Coolify Proxy is not running, but it should be!<br><br>Start it in the "Destinations" menu.'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function configureCoolifyProxyOn(fqdn) {
|
export async function configureCoolifyProxyOn(fqdn) {
|
||||||
const domain = getDomain(fqdn);
|
const domain = getDomain(fqdn);
|
||||||
const haproxy = await haproxyInstance();
|
const haproxy = await haproxyInstance();
|
||||||
try {
|
|
||||||
await checkHAProxy(haproxy);
|
await checkHAProxy(haproxy);
|
||||||
} catch (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let serverConfigured = false;
|
let serverConfigured = false;
|
||||||
let backendAvailable: any = null;
|
let backendAvailable: any = null;
|
||||||
try {
|
try {
|
||||||
@ -460,7 +443,7 @@ export async function startCoolifyProxy(engine) {
|
|||||||
);
|
);
|
||||||
const ip = JSON.parse(Config)[0].Gateway;
|
const ip = JSON.parse(Config)[0].Gateway;
|
||||||
await asyncExecShell(
|
await asyncExecShell(
|
||||||
`DOCKER_HOST="${host}" docker run -e HAPROXY_USERNAME=${proxyUser} -e HAPROXY_PASSWORD=${proxyPassword} --restarts always --add-host 'host.docker.internal:host-gateway' --add-host 'host.docker.internal:${ip}' -v coolify-ssl-certs:/usr/local/etc/haproxy/ssl --network coolify-infra -p "80:80" -p "443:443" -p "8404:8404" -p "5555:5555" -p "5000:5000" --name coolify-haproxy -d coollabsio/${defaultProxyImage}`
|
`DOCKER_HOST="${host}" docker run -e HAPROXY_USERNAME=${proxyUser} -e HAPROXY_PASSWORD=${proxyPassword} --restart always --add-host 'host.docker.internal:host-gateway' --add-host 'host.docker.internal:${ip}' -v coolify-ssl-certs:/usr/local/etc/haproxy/ssl --network coolify-infra -p "80:80" -p "443:443" -p "8404:8404" -p "5555:5555" -p "5000:5000" --name coolify-haproxy -d coollabsio/${defaultProxyImage}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await configureNetworkCoolifyProxy(engine);
|
await configureNetworkCoolifyProxy(engine);
|
||||||
@ -572,12 +555,7 @@ export async function configureSimpleServiceProxyOn({ id, domain, port }) {
|
|||||||
|
|
||||||
export async function configureSimpleServiceProxyOff({ domain }) {
|
export async function configureSimpleServiceProxyOff({ domain }) {
|
||||||
const haproxy = await haproxyInstance();
|
const haproxy = await haproxyInstance();
|
||||||
try {
|
|
||||||
await checkHAProxy(haproxy);
|
await checkHAProxy(haproxy);
|
||||||
} catch (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await haproxy.get(`v2/services/haproxy/configuration/backends/${domain}`).json();
|
await haproxy.get(`v2/services/haproxy/configuration/backends/${domain}`).json();
|
||||||
const transactionId = await getNextTransactionId();
|
const transactionId = await getNextTransactionId();
|
||||||
@ -596,12 +574,7 @@ export async function configureSimpleServiceProxyOff({ domain }) {
|
|||||||
|
|
||||||
export async function removeWwwRedirection(domain) {
|
export async function removeWwwRedirection(domain) {
|
||||||
const haproxy = await haproxyInstance();
|
const haproxy = await haproxyInstance();
|
||||||
try {
|
await checkHAProxy();
|
||||||
await checkHAProxy(haproxy);
|
|
||||||
} catch (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rules: any = await haproxy
|
const rules: any = await haproxy
|
||||||
.get(`v2/services/haproxy/configuration/http_request_rules`, {
|
.get(`v2/services/haproxy/configuration/http_request_rules`, {
|
||||||
searchParams: {
|
searchParams: {
|
||||||
@ -631,11 +604,7 @@ export async function removeWwwRedirection(domain) {
|
|||||||
}
|
}
|
||||||
export async function setWwwRedirection(fqdn) {
|
export async function setWwwRedirection(fqdn) {
|
||||||
const haproxy = await haproxyInstance();
|
const haproxy = await haproxyInstance();
|
||||||
try {
|
|
||||||
await checkHAProxy(haproxy);
|
await checkHAProxy(haproxy);
|
||||||
} catch (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const transactionId = await getNextTransactionId();
|
const transactionId = await getNextTransactionId();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -15,8 +15,7 @@ export const post: RequestHandler = async (event) => {
|
|||||||
status: 200
|
status: 200
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return ErrorHandler(error);
|
|
||||||
} finally {
|
|
||||||
await stopCoolifyProxy(engine);
|
await stopCoolifyProxy(engine);
|
||||||
|
return ErrorHandler(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -110,23 +110,23 @@
|
|||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMount(async () => {
|
// onMount(async () => {
|
||||||
if (
|
// if (
|
||||||
service.type &&
|
// service.type &&
|
||||||
service.destinationDockerId &&
|
// service.destinationDockerId &&
|
||||||
service.version &&
|
// service.version &&
|
||||||
service.fqdn &&
|
// service.fqdn &&
|
||||||
!isRunning
|
// !isRunning
|
||||||
) {
|
// ) {
|
||||||
try {
|
// try {
|
||||||
await post(`/services/${service.id}/${service.type}/stop.json`, {});
|
// await post(`/services/${service.id}/${service.type}/stop.json`, {});
|
||||||
} catch ({ error }) {
|
// } catch ({ error }) {
|
||||||
return errorNotification(error);
|
// return errorNotification(error);
|
||||||
} finally {
|
// } finally {
|
||||||
loading = false;
|
// loading = false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav class="nav-side">
|
<nav class="nav-side">
|
||||||
|
@ -5,6 +5,7 @@ import yaml from 'js-yaml';
|
|||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
import { letsEncrypt } from '$lib/letsencrypt';
|
import { letsEncrypt } from '$lib/letsencrypt';
|
||||||
import {
|
import {
|
||||||
|
checkHAProxy,
|
||||||
configureSimpleServiceProxyOn,
|
configureSimpleServiceProxyOn,
|
||||||
reloadHaproxy,
|
reloadHaproxy,
|
||||||
setWwwRedirection,
|
setWwwRedirection,
|
||||||
@ -22,6 +23,7 @@ export const post: RequestHandler = async (event) => {
|
|||||||
const { id } = event.params;
|
const { id } = event.params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await checkHAProxy();
|
||||||
const service = await db.getService({ id, teamId });
|
const service = await db.getService({ id, teamId });
|
||||||
const {
|
const {
|
||||||
type,
|
type,
|
||||||
|
@ -33,8 +33,12 @@ export const post: RequestHandler = async (event) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
await stopTcpHttpProxy(destinationDocker, publicPort);
|
await stopTcpHttpProxy(destinationDocker, publicPort);
|
||||||
await configureSimpleServiceProxyOff({ domain });
|
await configureSimpleServiceProxyOff({ domain });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -4,7 +4,12 @@ import { promises as fs } from 'fs';
|
|||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
import { letsEncrypt } from '$lib/letsencrypt';
|
import { letsEncrypt } from '$lib/letsencrypt';
|
||||||
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
|
import {
|
||||||
|
checkHAProxy,
|
||||||
|
configureSimpleServiceProxyOn,
|
||||||
|
reloadHaproxy,
|
||||||
|
setWwwRedirection
|
||||||
|
} from '$lib/haproxy';
|
||||||
import { getDomain } from '$lib/components/common';
|
import { getDomain } from '$lib/components/common';
|
||||||
import { ErrorHandler } from '$lib/database';
|
import { ErrorHandler } from '$lib/database';
|
||||||
|
|
||||||
@ -15,6 +20,7 @@ export const post: RequestHandler = async (event) => {
|
|||||||
const { id } = event.params;
|
const { id } = event.params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await checkHAProxy();
|
||||||
const service = await db.getService({ id, teamId });
|
const service = await db.getService({ id, teamId });
|
||||||
const { type, version, fqdn, destinationDockerId, destinationDocker } = service;
|
const { type, version, fqdn, destinationDockerId, destinationDocker } = service;
|
||||||
|
|
||||||
@ -58,7 +64,6 @@ export const post: RequestHandler = async (event) => {
|
|||||||
status: 200
|
status: 200
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
|
||||||
return ErrorHandler(error);
|
return ErrorHandler(error);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -27,7 +27,11 @@ export const post: RequestHandler = async (event) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
await configureSimpleServiceProxyOff({ domain });
|
await configureSimpleServiceProxyOff({ domain });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -4,7 +4,12 @@ import { promises as fs } from 'fs';
|
|||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
import { letsEncrypt } from '$lib/letsencrypt';
|
import { letsEncrypt } from '$lib/letsencrypt';
|
||||||
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
|
import {
|
||||||
|
checkHAProxy,
|
||||||
|
configureSimpleServiceProxyOn,
|
||||||
|
reloadHaproxy,
|
||||||
|
setWwwRedirection
|
||||||
|
} from '$lib/haproxy';
|
||||||
import { getDomain } from '$lib/components/common';
|
import { getDomain } from '$lib/components/common';
|
||||||
import { ErrorHandler } from '$lib/database';
|
import { ErrorHandler } from '$lib/database';
|
||||||
|
|
||||||
@ -15,6 +20,7 @@ export const post: RequestHandler = async (event) => {
|
|||||||
const { id } = event.params;
|
const { id } = event.params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await checkHAProxy();
|
||||||
const service = await db.getService({ id, teamId });
|
const service = await db.getService({ id, teamId });
|
||||||
const {
|
const {
|
||||||
type,
|
type,
|
||||||
|
@ -37,7 +37,11 @@ export const post: RequestHandler = async (event) => {
|
|||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
await configureSimpleServiceProxyOff({ domain });
|
await configureSimpleServiceProxyOff({ domain });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -4,7 +4,12 @@ import { promises as fs } from 'fs';
|
|||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
import { letsEncrypt } from '$lib/letsencrypt';
|
import { letsEncrypt } from '$lib/letsencrypt';
|
||||||
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
|
import {
|
||||||
|
checkHAProxy,
|
||||||
|
configureSimpleServiceProxyOn,
|
||||||
|
reloadHaproxy,
|
||||||
|
setWwwRedirection
|
||||||
|
} from '$lib/haproxy';
|
||||||
import { getDomain } from '$lib/components/common';
|
import { getDomain } from '$lib/components/common';
|
||||||
import { getServiceImage, ErrorHandler } from '$lib/database';
|
import { getServiceImage, ErrorHandler } from '$lib/database';
|
||||||
|
|
||||||
@ -15,6 +20,7 @@ export const post: RequestHandler = async (event) => {
|
|||||||
const { id } = event.params;
|
const { id } = event.params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await checkHAProxy();
|
||||||
const service = await db.getService({ id, teamId });
|
const service = await db.getService({ id, teamId });
|
||||||
const { type, version, fqdn, destinationDockerId, destinationDocker } = service;
|
const { type, version, fqdn, destinationDockerId, destinationDocker } = service;
|
||||||
|
|
||||||
|
@ -27,7 +27,11 @@ export const post: RequestHandler = async (event) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
await configureSimpleServiceProxyOff({ domain });
|
await configureSimpleServiceProxyOff({ domain });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -4,7 +4,12 @@ import { promises as fs } from 'fs';
|
|||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
import { letsEncrypt } from '$lib/letsencrypt';
|
import { letsEncrypt } from '$lib/letsencrypt';
|
||||||
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
|
import {
|
||||||
|
checkHAProxy,
|
||||||
|
configureSimpleServiceProxyOn,
|
||||||
|
reloadHaproxy,
|
||||||
|
setWwwRedirection
|
||||||
|
} from '$lib/haproxy';
|
||||||
import { getDomain } from '$lib/components/common';
|
import { getDomain } from '$lib/components/common';
|
||||||
import { ErrorHandler } from '$lib/database';
|
import { ErrorHandler } from '$lib/database';
|
||||||
|
|
||||||
@ -15,6 +20,7 @@ export const post: RequestHandler = async (event) => {
|
|||||||
const { id } = event.params;
|
const { id } = event.params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await checkHAProxy();
|
||||||
const service = await db.getService({ id, teamId });
|
const service = await db.getService({ id, teamId });
|
||||||
const {
|
const {
|
||||||
type,
|
type,
|
||||||
|
@ -27,7 +27,11 @@ export const post: RequestHandler = async (event) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
await configureSimpleServiceProxyOff({ domain });
|
await configureSimpleServiceProxyOff({ domain });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
status: 200
|
status: 200
|
||||||
|
@ -4,7 +4,12 @@ import { promises as fs } from 'fs';
|
|||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
import { letsEncrypt } from '$lib/letsencrypt';
|
import { letsEncrypt } from '$lib/letsencrypt';
|
||||||
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
|
import {
|
||||||
|
checkHAProxy,
|
||||||
|
configureSimpleServiceProxyOn,
|
||||||
|
reloadHaproxy,
|
||||||
|
setWwwRedirection
|
||||||
|
} from '$lib/haproxy';
|
||||||
import { getDomain } from '$lib/components/common';
|
import { getDomain } from '$lib/components/common';
|
||||||
import { ErrorHandler } from '$lib/database';
|
import { ErrorHandler } from '$lib/database';
|
||||||
|
|
||||||
@ -15,6 +20,7 @@ export const post: RequestHandler = async (event) => {
|
|||||||
const { id } = event.params;
|
const { id } = event.params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await checkHAProxy();
|
||||||
const service = await db.getService({ id, teamId });
|
const service = await db.getService({ id, teamId });
|
||||||
const {
|
const {
|
||||||
type,
|
type,
|
||||||
|
@ -30,7 +30,11 @@ export const post: RequestHandler = async (event) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
await configureSimpleServiceProxyOff({ domain });
|
await configureSimpleServiceProxyOff({ domain });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user