mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat: add show cluster
This commit is contained in:
17
server/api/routers/cluster.ts
Normal file
17
server/api/routers/cluster.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { docker } from "@/server/constants";
|
||||
import { createTRPCRouter, protectedProcedure } from "../trpc";
|
||||
import { getPublicIpWithFallback } from "@/server/wss/terminal";
|
||||
|
||||
export const clusterRouter = createTRPCRouter({
|
||||
getWorkers: protectedProcedure.query(async () => {
|
||||
const workers = await docker.listNodes();
|
||||
// console.log(workers);
|
||||
return workers;
|
||||
}),
|
||||
addWorker: protectedProcedure.query(async ({ input }) => {
|
||||
const result = await docker.swarmInspect();
|
||||
return `docker swarm join --token ${
|
||||
result.JoinTokens.Worker
|
||||
} ${await getPublicIpWithFallback()}:2377`;
|
||||
}),
|
||||
});
|
||||
Reference in New Issue
Block a user