Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: Add HTTP proxy checks

Andras Bacsai3a252509d050
diff --git a/src/lib/haproxy/index.ts b/src/lib/haproxy/index.ts
index 618d410d5d..9aa3797b4a 100644
--- a/src/lib/haproxy/index.ts
+++ b/src/lib/haproxy/index.ts
@@ -127,10 +127,10 @@ export async function startTcpProxy(
const containerName = `haproxy-for-${publicPort}`;
const found = await checkContainer(engine, containerName);
- const foundDB = await checkContainer(engine, id);
+ const foundDependentContainer = await checkContainer(engine, id);
try {
- if (foundDB && !found) {
+ if (foundDependentContainer && !found) {
const { stdout: Config } = await asyncExecShell(
`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 found = await checkContainer(engine, containerName);
- const foundDB = await checkContainer(engine, id);
+ const foundDependentContainer = await checkContainer(engine, id);
try {
- if (foundDB && !found) {
+ if (foundDependentContainer && !found) {
const { stdout: Config } = await asyncExecShell(
`DOCKER_HOST="${host}" docker network inspect bridge --format '{{json .IPAM.Config }}'`
);
diff --git a/src/lib/queues/proxyTcpHttp.ts b/src/lib/queues/proxyTcpHttp.ts
index 00b5d759e7..f9c509587a 100644
--- a/src/lib/queues/proxyTcpHttp.ts
+++ b/src/lib/queues/proxyTcpHttp.ts
@@ -1,11 +1,12 @@
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 | {
status: number;
body: { message: string; error: string };
}> {
try {
+ // TCP Proxies
const databasesWithPublicPort = await prisma.database.findMany({
where: { publicPort: { not: null } },
include: { settings: true, destinationDocker: true }
@@ -28,6 +29,19 @@ export default async function (): Promise<void | {
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) {
return ErrorHandler(error.response?.body || error);
}