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

Andras Bacsaieb267870799b
diff --git a/apps/api/src/jobs/infrastructure.ts b/apps/api/src/jobs/infrastructure.ts
index 2514cc6eba..0dda946b70 100644
--- a/apps/api/src/jobs/infrastructure.ts
+++ b/apps/api/src/jobs/infrastructure.ts
@@ -45,18 +45,30 @@ async function checkProxies() {
let portReachable;
const { arch, ipv4, ipv6 } = await listSettings();
+
// Coolify Proxy local
const engine = '/var/run/docker.sock';
const localDocker = await prisma.destinationDocker.findFirst({
- where: { engine, network: 'coolify' }
+ where: { engine, network: 'coolify', isCoolifyProxyUsed: true }
});
- if (localDocker && localDocker.isCoolifyProxyUsed) {
+ if (localDocker) {
portReachable = await isReachable(80, { host: ipv4 || ipv6 })
if (!portReachable) {
await startTraefikProxy(localDocker.id);
}
}
-
+ // Coolify Proxy remote
+ const remoteDocker = await prisma.destinationDocker.findMany({
+ where: { engine, isCoolifyProxyUsed: true, remoteEngine: true }
+ });
+ if (remoteDocker.length > 0) {
+ for (const docker of remoteDocker) {
+ portReachable = await isReachable(80, { host: docker.remoteIpAddress })
+ if (!portReachable) {
+ await startTraefikProxy(docker.id);
+ }
+ }
+ }
// TCP Proxies
const databasesWithPublicPort = await prisma.database.findMany({
where: { publicPort: { not: null } },
diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts
index c3e7944a6e..6b8a84b0c8 100644
--- a/apps/api/src/lib/common.ts
+++ b/apps/api/src/lib/common.ts
@@ -459,13 +459,7 @@ export async function createRemoteEngineConfiguration(id: string) {
// Needed for remote docker compose
const { stdout: numberOfSSHAgentsRunning } = await asyncExecShell(`ps ax | grep [s]sh-agent | grep coolify-ssh-agent.pid | grep -v grep | wc -l`)
if (numberOfSSHAgentsRunning !== '' && Number(numberOfSSHAgentsRunning.trim()) == 0) {
- try {
- const {stdout, stderr } = await asyncExecShell(`eval $(ssh-agent -sa /tmp/coolify-ssh-agent.pid)`)
- console.log({stdout,stderr})
-
- } catch(error) {
- console.log({error})
- }
+ await asyncExecShell(`eval $(ssh-agent -sa /tmp/coolify-ssh-agent.pid)`)
}
await asyncExecShell(`SSH_AUTH_SOCK=/tmp/coolify-ssh-agent.pid ssh-add -q ${sshKeyFile}`)
@@ -1365,6 +1359,7 @@ export function makeLabelForServices(type) {
}
export function errorHandler({ status = 500, message = 'Unknown error.' }: { status: number, message: string | any }) {
if (message.message) message = message.message
+ console.log({ status, message })
throw { status, message };
}
export async function generateSshKeyPair(): Promise<{ publicKey: string; privateKey: string }> {
diff --git a/apps/api/src/routes/api/v1/destinations/handlers.ts b/apps/api/src/routes/api/v1/destinations/handlers.ts
index ea252554ef..88b8d3c51c 100644
--- a/apps/api/src/routes/api/v1/destinations/handlers.ts
+++ b/apps/api/src/routes/api/v1/destinations/handlers.ts
@@ -205,7 +205,7 @@ export async function assignSSHKey(request: FastifyRequest) {
return errorHandler({ status, message })
}
}
-export async function verifyRemoteDockerEngine(request: FastifyRequest, reply: FastifyReply) {
+export async function verifyRemoteDockerEngine(request: FastifyRequest<OnlyId>, reply: FastifyReply) {
try {
const { id } = request.params;
await createRemoteEngineConfiguration(id);
@@ -217,14 +217,12 @@ export async function verifyRemoteDockerEngine(request: FastifyRequest, reply: F
if (!stdout) {
await asyncExecShell(`DOCKER_HOST=${host} docker network create --attachable ${network}`);
}
- const { stdout:coolifyNetwork } = await asyncExecShell(`DOCKER_HOST=${host} docker network ls --filter 'name=coolify-infra' --no-trunc --format "{{json .}}"`);
+ const { stdout: coolifyNetwork } = await asyncExecShell(`DOCKER_HOST=${host} docker network ls --filter 'name=coolify-infra' --no-trunc --format "{{json .}}"`);
if (!coolifyNetwork) {
await asyncExecShell(`DOCKER_HOST=${host} docker network create --attachable coolify-infra`);
}
- if (isCoolifyProxyUsed) {
- await startTraefikProxy(id);
- }
+
await prisma.destinationDocker.update({ where: { id }, data: { remoteVerified: true } })
return reply.code(201).send()