fix: Better proxy check
This commit is contained in:
parent
b9da68ec28
commit
02abd038fa
@ -199,6 +199,7 @@ export async function checkProxyConfigurations() {
|
|||||||
backend_name: backendName,
|
backend_name: backendName,
|
||||||
stats: { lastchg }
|
stats: { lastchg }
|
||||||
} = stat;
|
} = stat;
|
||||||
|
|
||||||
const { fqdn } = await db.listSettings();
|
const { fqdn } = await db.listSettings();
|
||||||
if (fqdn) {
|
if (fqdn) {
|
||||||
const domain = getDomain(fqdn);
|
const domain = getDomain(fqdn);
|
||||||
@ -206,8 +207,15 @@ export async function checkProxyConfigurations() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const application = await db.getApplicationById(name);
|
const application = await db.prisma.application.findUnique({
|
||||||
if (!application) {
|
where: { id: name },
|
||||||
|
include: { destinationDocker: true }
|
||||||
|
});
|
||||||
|
const service = await db.prisma.service.findUnique({
|
||||||
|
where: { id: name },
|
||||||
|
include: { destinationDocker: true }
|
||||||
|
});
|
||||||
|
if (!application && !service) {
|
||||||
const transactionId = await getNextTransactionId();
|
const transactionId = await getNextTransactionId();
|
||||||
await haproxy
|
await haproxy
|
||||||
.delete(`v2/services/haproxy/configuration/backends/${backendName}`, {
|
.delete(`v2/services/haproxy/configuration/backends/${backendName}`, {
|
||||||
@ -218,18 +226,36 @@ export async function checkProxyConfigurations() {
|
|||||||
.json();
|
.json();
|
||||||
return await completeTransaction(transactionId);
|
return await completeTransaction(transactionId);
|
||||||
}
|
}
|
||||||
const found = await checkContainer(application.destinationDocker.engine, name);
|
if (application?.destinationDocker?.engine && lastchg > 120) {
|
||||||
if (!found) {
|
const found = await checkContainer(application.destinationDocker.engine, name);
|
||||||
const transactionId = await getNextTransactionId();
|
if (!found) {
|
||||||
await haproxy
|
const transactionId = await getNextTransactionId();
|
||||||
.delete(`v2/services/haproxy/configuration/backends/${backendName}`, {
|
await haproxy
|
||||||
searchParams: {
|
.delete(`v2/services/haproxy/configuration/backends/${backendName}`, {
|
||||||
transaction_id: transactionId
|
searchParams: {
|
||||||
}
|
transaction_id: transactionId
|
||||||
})
|
}
|
||||||
.json();
|
})
|
||||||
return await completeTransaction(transactionId);
|
.json();
|
||||||
|
return await completeTransaction(transactionId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (service?.destinationDocker?.engine && lastchg > 120) {
|
||||||
|
const found = await checkContainer(service.destinationDocker.engine, name);
|
||||||
|
if (!found) {
|
||||||
|
const transactionId = await getNextTransactionId();
|
||||||
|
await haproxy
|
||||||
|
.delete(`v2/services/haproxy/configuration/backends/${backendName}`, {
|
||||||
|
searchParams: {
|
||||||
|
transaction_id: transactionId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.json();
|
||||||
|
return await completeTransaction(transactionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (lastchg > 120) {
|
if (lastchg > 120) {
|
||||||
const transactionId = await getNextTransactionId();
|
const transactionId = await getNextTransactionId();
|
||||||
await haproxy
|
await haproxy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user