mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat: add ssh key
This commit is contained in:
1
apps/dokploy/drizzle/0038_mushy_blindfold.sql
Normal file
1
apps/dokploy/drizzle/0038_mushy_blindfold.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE "ssh-key" ADD COLUMN "privateKey" text DEFAULT '' NOT NULL;
|
||||
3830
apps/dokploy/drizzle/meta/0038_snapshot.json
Normal file
3830
apps/dokploy/drizzle/meta/0038_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -267,6 +267,13 @@
|
||||
"when": 1726988289562,
|
||||
"tag": "0037_legal_namor",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 38,
|
||||
"version": "6",
|
||||
"when": 1727903587684,
|
||||
"tag": "0038_mushy_blindfold",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -63,7 +63,7 @@ void app.prepare().then(async () => {
|
||||
}
|
||||
|
||||
if (IS_CLOUD) {
|
||||
await migration();
|
||||
// await migration(); //TODO: Fix migration
|
||||
}
|
||||
|
||||
server.listen(PORT);
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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 setupDockerContainerTerminalWebSocketServer = (
|
||||
@@ -53,7 +49,6 @@ export const setupDockerContainerTerminalWebSocketServer = (
|
||||
if (!server.sshKeyId)
|
||||
throw new Error("No SSH key available for this server");
|
||||
|
||||
const keys = await readSSHKey(server.sshKeyId);
|
||||
const conn = new Client();
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
@@ -109,7 +104,7 @@ export const setupDockerContainerTerminalWebSocketServer = (
|
||||
host: server.ipAddress,
|
||||
port: server.port,
|
||||
username: server.username,
|
||||
privateKey: keys.privateKey,
|
||||
privateKey: server.sshKey?.privateKey,
|
||||
timeout: 99999,
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -2,11 +2,7 @@ import { spawn } from "node:child_process";
|
||||
import type http from "node:http";
|
||||
import { Client } from "ssh2";
|
||||
import { WebSocketServer } from "ws";
|
||||
import {
|
||||
findServerById,
|
||||
readSSHKey,
|
||||
validateWebSocketRequest,
|
||||
} from "@dokploy/builders";
|
||||
import { findServerById, validateWebSocketRequest } from "@dokploy/builders";
|
||||
|
||||
export const setupDeploymentLogsWebSocketServer = (
|
||||
server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>,
|
||||
@@ -51,7 +47,6 @@ export const setupDeploymentLogsWebSocketServer = (
|
||||
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
|
||||
@@ -83,7 +78,7 @@ export const setupDeploymentLogsWebSocketServer = (
|
||||
host: server.ipAddress,
|
||||
port: server.port,
|
||||
username: server.username,
|
||||
privateKey: keys.privateKey,
|
||||
privateKey: server.sshKey?.privateKey,
|
||||
timeout: 99999,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"outDir": "dist/",
|
||||
"target": "ESNext",
|
||||
"isolatedModules": false,
|
||||
"noEmit": false,
|
||||
"moduleResolution": "Node",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "./server/**/*"]
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"outDir": "dist/",
|
||||
"target": "ESNext",
|
||||
"isolatedModules": false,
|
||||
"noEmit": false,
|
||||
"moduleResolution": "Node",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "./server/**/*"]
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user