fix: high cpu usage
This commit is contained in:
parent
db16a357e8
commit
c53f0dbb30
@ -107,11 +107,11 @@ fastify.listen({ port, host }, async (err: any, address: any) => {
|
|||||||
await scheduler.start('cleanupPrismaEngines');
|
await scheduler.start('cleanupPrismaEngines');
|
||||||
await scheduler.start('checkProxies');
|
await scheduler.start('checkProxies');
|
||||||
|
|
||||||
// setInterval(async () => {
|
setInterval(async () => {
|
||||||
// if (!scheduler.workers.has('deployApplication')) {
|
if (!scheduler.workers.has('deployApplication')) {
|
||||||
// scheduler.run('deployApplication');
|
scheduler.run('deployApplication');
|
||||||
// }
|
}
|
||||||
// }, 2000)
|
}, 2000)
|
||||||
|
|
||||||
// Check for update & if no build is running
|
// Check for update & if no build is running
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
|
@ -5,6 +5,8 @@ import { checkContainer } from '../lib/docker';
|
|||||||
(async () => {
|
(async () => {
|
||||||
if (parentPort) {
|
if (parentPort) {
|
||||||
try {
|
try {
|
||||||
|
const { default: isReachable } = await import('is-port-reachable');
|
||||||
|
let portReachable;
|
||||||
const { arch } = await listSettings();
|
const { arch } = await listSettings();
|
||||||
// Coolify Proxy local
|
// Coolify Proxy local
|
||||||
const engine = '/var/run/docker.sock';
|
const engine = '/var/run/docker.sock';
|
||||||
@ -20,7 +22,11 @@ import { checkContainer } from '../lib/docker';
|
|||||||
command: `docker stop -t 0 coolify-haproxy && docker rm coolify-haproxy`
|
command: `docker stop -t 0 coolify-haproxy && docker rm coolify-haproxy`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
await startTraefikProxy(localDocker.id);
|
portReachable = await isReachable(80, { host: 'localhost' })
|
||||||
|
console.log({ port: 80, portReachable })
|
||||||
|
if (!portReachable) {
|
||||||
|
await startTraefikProxy(localDocker.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TCP Proxies
|
// TCP Proxies
|
||||||
@ -42,7 +48,11 @@ import { checkContainer } from '../lib/docker';
|
|||||||
command: `docker stop -t 0 haproxy-for-${publicPort} && docker rm haproxy-for-${publicPort}`
|
command: `docker stop -t 0 haproxy-for-${publicPort} && docker rm haproxy-for-${publicPort}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
await startTraefikTCPProxy(destinationDocker, id, publicPort, privatePort);
|
portReachable = await isReachable(publicPort, { host: destinationDocker.remoteIpAddress || 'localhost' })
|
||||||
|
console.log({ publicPort, portReachable })
|
||||||
|
if (!portReachable) {
|
||||||
|
await startTraefikTCPProxy(destinationDocker, id, publicPort, privatePort);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const wordpressWithFtp = await prisma.wordpress.findMany({
|
const wordpressWithFtp = await prisma.wordpress.findMany({
|
||||||
@ -61,7 +71,11 @@ import { checkContainer } from '../lib/docker';
|
|||||||
command: `docker stop -t 0 haproxy -for-${ftpPublicPort} && docker rm haproxy-for-${ftpPublicPort}`
|
command: `docker stop -t 0 haproxy -for-${ftpPublicPort} && docker rm haproxy-for-${ftpPublicPort}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
await startTraefikTCPProxy(destinationDocker, id, ftpPublicPort, 22, 'wordpressftp');
|
portReachable = await isReachable(ftpPublicPort, { host: destinationDocker.remoteIpAddress || 'localhost' })
|
||||||
|
console.log({ ftpPublicPort, portReachable })
|
||||||
|
if (!portReachable) {
|
||||||
|
await startTraefikTCPProxy(destinationDocker, id, ftpPublicPort, 22, 'wordpressftp');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +96,11 @@ import { checkContainer } from '../lib/docker';
|
|||||||
command: `docker stop -t 0 ${id}-${publicPort} && docker rm ${id}-${publicPort} `
|
command: `docker stop -t 0 ${id}-${publicPort} && docker rm ${id}-${publicPort} `
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
await startTraefikTCPProxy(destinationDocker, id, publicPort, 9000);
|
portReachable = await isReachable(publicPort, { host: destinationDocker.remoteIpAddress || 'localhost' })
|
||||||
|
console.log({ publicPort, portReachable })
|
||||||
|
if (!portReachable) {
|
||||||
|
await startTraefikTCPProxy(destinationDocker, id, publicPort, 9000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user