debug cpu usage
This commit is contained in:
@@ -7,6 +7,7 @@ import { checkContainer } from '../lib/docker';
|
|||||||
try {
|
try {
|
||||||
const { default: isReachable } = await import('is-port-reachable');
|
const { default: isReachable } = await import('is-port-reachable');
|
||||||
let portReachable;
|
let portReachable;
|
||||||
|
|
||||||
const { arch, ipv4, ipv6 } = await listSettings();
|
const { arch, ipv4, ipv6 } = await listSettings();
|
||||||
// Coolify Proxy local
|
// Coolify Proxy local
|
||||||
const engine = '/var/run/docker.sock';
|
const engine = '/var/run/docker.sock';
|
||||||
@@ -14,15 +15,8 @@ import { checkContainer } from '../lib/docker';
|
|||||||
where: { engine, network: 'coolify' }
|
where: { engine, network: 'coolify' }
|
||||||
});
|
});
|
||||||
if (localDocker && localDocker.isCoolifyProxyUsed) {
|
if (localDocker && localDocker.isCoolifyProxyUsed) {
|
||||||
// Remove HAProxy
|
|
||||||
const found = await checkContainer({ dockerId: localDocker.id, container: 'coolify-haproxy' });
|
|
||||||
if (found) {
|
|
||||||
await executeDockerCmd({
|
|
||||||
dockerId: localDocker.id,
|
|
||||||
command: `docker stop -t 0 coolify-haproxy && docker rm coolify-haproxy`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
portReachable = await isReachable(80, { host: ipv4 || ipv6 })
|
portReachable = await isReachable(80, { host: ipv4 || ipv6 })
|
||||||
|
console.log({ port: 80, portReachable });
|
||||||
if (!portReachable) {
|
if (!portReachable) {
|
||||||
await startTraefikProxy(localDocker.id);
|
await startTraefikProxy(localDocker.id);
|
||||||
}
|
}
|
||||||
@@ -37,17 +31,8 @@ import { checkContainer } from '../lib/docker';
|
|||||||
const { destinationDockerId, destinationDocker, publicPort, id } = database;
|
const { destinationDockerId, destinationDocker, publicPort, id } = database;
|
||||||
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
||||||
const { privatePort } = generateDatabaseConfiguration(database, arch);
|
const { privatePort } = generateDatabaseConfiguration(database, arch);
|
||||||
// Remove HAProxy
|
|
||||||
const found = await checkContainer({
|
|
||||||
dockerId: localDocker.id, container: `haproxy-for-${publicPort}`
|
|
||||||
});
|
|
||||||
if (found) {
|
|
||||||
await executeDockerCmd({
|
|
||||||
dockerId: localDocker.id,
|
|
||||||
command: `docker stop -t 0 haproxy-for-${publicPort} && docker rm haproxy-for-${publicPort}`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
portReachable = await isReachable(publicPort, { host: destinationDocker.remoteIpAddress || ipv4 || ipv6 })
|
portReachable = await isReachable(publicPort, { host: destinationDocker.remoteIpAddress || ipv4 || ipv6 })
|
||||||
|
console.log({ publicPort, portReachable });
|
||||||
if (!portReachable) {
|
if (!portReachable) {
|
||||||
await startTraefikTCPProxy(destinationDocker, id, publicPort, privatePort);
|
await startTraefikTCPProxy(destinationDocker, id, publicPort, privatePort);
|
||||||
}
|
}
|
||||||
@@ -61,15 +46,8 @@ import { checkContainer } from '../lib/docker';
|
|||||||
const { service, ftpPublicPort } = ftp;
|
const { service, ftpPublicPort } = ftp;
|
||||||
const { destinationDockerId, destinationDocker, id } = service;
|
const { destinationDockerId, destinationDocker, id } = service;
|
||||||
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
||||||
// Remove HAProxy
|
|
||||||
const found = await checkContainer({ dockerId: localDocker.id, container: `haproxy-for-${ftpPublicPort}` });
|
|
||||||
if (found) {
|
|
||||||
await executeDockerCmd({
|
|
||||||
dockerId: localDocker.id,
|
|
||||||
command: `docker stop -t 0 haproxy -for-${ftpPublicPort} && docker rm haproxy-for-${ftpPublicPort}`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
portReachable = await isReachable(ftpPublicPort, { host: destinationDocker.remoteIpAddress || ipv4 || ipv6 })
|
portReachable = await isReachable(ftpPublicPort, { host: destinationDocker.remoteIpAddress || ipv4 || ipv6 })
|
||||||
|
console.log({ ftpPublicPort, portReachable });
|
||||||
if (!portReachable) {
|
if (!portReachable) {
|
||||||
await startTraefikTCPProxy(destinationDocker, id, ftpPublicPort, 22, 'wordpressftp');
|
await startTraefikTCPProxy(destinationDocker, id, ftpPublicPort, 22, 'wordpressftp');
|
||||||
}
|
}
|
||||||
@@ -85,15 +63,8 @@ import { checkContainer } from '../lib/docker';
|
|||||||
const { service, publicPort } = minio;
|
const { service, publicPort } = minio;
|
||||||
const { destinationDockerId, destinationDocker, id } = service;
|
const { destinationDockerId, destinationDocker, id } = service;
|
||||||
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
||||||
// Remove HAProxy
|
|
||||||
const found = await checkContainer({ dockerId: localDocker.id, container: `${id}-${publicPort}` });
|
|
||||||
if (found) {
|
|
||||||
await executeDockerCmd({
|
|
||||||
dockerId: localDocker.id,
|
|
||||||
command: `docker stop -t 0 ${id}-${publicPort} && docker rm ${id}-${publicPort} `
|
|
||||||
})
|
|
||||||
}
|
|
||||||
portReachable = await isReachable(publicPort, { host: destinationDocker.remoteIpAddress || ipv4 || ipv6 })
|
portReachable = await isReachable(publicPort, { host: destinationDocker.remoteIpAddress || ipv4 || ipv6 })
|
||||||
|
console.log({ publicPort, portReachable });
|
||||||
if (!portReachable) {
|
if (!portReachable) {
|
||||||
await startTraefikTCPProxy(destinationDocker, id, publicPort, 9000);
|
await startTraefikTCPProxy(destinationDocker, id, publicPort, 9000);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user