feat: add ssh key

This commit is contained in:
Mauricio Siu
2024-10-02 22:50:01 -06:00
parent f13e5d449c
commit d41c8c70c3
24 changed files with 3908 additions and 192 deletions

View File

@@ -2,11 +2,7 @@ import type http from "node:http";
import { spawn } from "node-pty";
import { Client } from "ssh2";
import { WebSocketServer } from "ws";
import {
findServerById,
readSSHKey,
validateWebSocketRequest,
} from "@dokploy/builders";
import { findServerById, validateWebSocketRequest } from "@dokploy/builders";
import { getShell } from "./utils";
export const setupDockerContainerLogsWebSocketServer = (
@@ -52,7 +48,6 @@ export const setupDockerContainerLogsWebSocketServer = (
const server = await findServerById(serverId);
if (!server.sshKeyId) return;
const keys = await readSSHKey(server.sshKeyId);
const client = new Client();
new Promise<void>((resolve, reject) => {
client
@@ -84,7 +79,7 @@ export const setupDockerContainerLogsWebSocketServer = (
host: server.ipAddress,
port: server.port,
username: server.username,
privateKey: keys.privateKey,
privateKey: server.sshKey?.privateKey,
timeout: 99999,
});
});