fix: Add HTTP proxy checks
This commit is contained in:
parent
2bd3802a6f
commit
3a252509d0
@ -127,10 +127,10 @@ export async function startTcpProxy(
|
|||||||
|
|
||||||
const containerName = `haproxy-for-${publicPort}`;
|
const containerName = `haproxy-for-${publicPort}`;
|
||||||
const found = await checkContainer(engine, containerName);
|
const found = await checkContainer(engine, containerName);
|
||||||
const foundDB = await checkContainer(engine, id);
|
const foundDependentContainer = await checkContainer(engine, id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (foundDB && !found) {
|
if (foundDependentContainer && !found) {
|
||||||
const { stdout: Config } = await asyncExecShell(
|
const { stdout: Config } = await asyncExecShell(
|
||||||
`DOCKER_HOST="${host}" docker network inspect bridge --format '{{json .IPAM.Config }}'`
|
`DOCKER_HOST="${host}" docker network inspect bridge --format '{{json .IPAM.Config }}'`
|
||||||
);
|
);
|
||||||
@ -157,10 +157,10 @@ export async function startHttpProxy(
|
|||||||
|
|
||||||
const containerName = `haproxy-for-${publicPort}`;
|
const containerName = `haproxy-for-${publicPort}`;
|
||||||
const found = await checkContainer(engine, containerName);
|
const found = await checkContainer(engine, containerName);
|
||||||
const foundDB = await checkContainer(engine, id);
|
const foundDependentContainer = await checkContainer(engine, id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (foundDB && !found) {
|
if (foundDependentContainer && !found) {
|
||||||
const { stdout: Config } = await asyncExecShell(
|
const { stdout: Config } = await asyncExecShell(
|
||||||
`DOCKER_HOST="${host}" docker network inspect bridge --format '{{json .IPAM.Config }}'`
|
`DOCKER_HOST="${host}" docker network inspect bridge --format '{{json .IPAM.Config }}'`
|
||||||
);
|
);
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import { ErrorHandler, generateDatabaseConfiguration, prisma } from '$lib/database';
|
import { ErrorHandler, generateDatabaseConfiguration, prisma } from '$lib/database';
|
||||||
import { checkContainer, startTcpProxy } from '$lib/haproxy';
|
import { startHttpProxy, startTcpProxy } from '$lib/haproxy';
|
||||||
|
|
||||||
export default async function (): Promise<void | {
|
export default async function (): Promise<void | {
|
||||||
status: number;
|
status: number;
|
||||||
body: { message: string; error: string };
|
body: { message: string; error: string };
|
||||||
}> {
|
}> {
|
||||||
try {
|
try {
|
||||||
|
// TCP Proxies
|
||||||
const databasesWithPublicPort = await prisma.database.findMany({
|
const databasesWithPublicPort = await prisma.database.findMany({
|
||||||
where: { publicPort: { not: null } },
|
where: { publicPort: { not: null } },
|
||||||
include: { settings: true, destinationDocker: true }
|
include: { settings: true, destinationDocker: true }
|
||||||
@ -28,6 +29,19 @@ export default async function (): Promise<void | {
|
|||||||
await startTcpProxy(destinationDocker, `${id}-ftp`, ftpPublicPort, 22);
|
await startTcpProxy(destinationDocker, `${id}-ftp`, ftpPublicPort, 22);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HTTP Proxies
|
||||||
|
const minioInstances = await prisma.minio.findMany({
|
||||||
|
where: { publicPort: { not: null } },
|
||||||
|
include: { service: { include: { destinationDocker: true } } }
|
||||||
|
});
|
||||||
|
for (const minio of minioInstances) {
|
||||||
|
const { service, publicPort } = minio;
|
||||||
|
const { destinationDockerId, destinationDocker, id } = service;
|
||||||
|
if (destinationDockerId) {
|
||||||
|
await startHttpProxy(destinationDocker, id, publicPort, 9000);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return ErrorHandler(error.response?.body || error);
|
return ErrorHandler(error.response?.body || error);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user