feat: add swarm router and related Docker service functions

This commit is contained in:
djknaeckebrot
2024-12-17 12:04:49 +01:00
parent 829aa2a63c
commit b592a025e4
3 changed files with 137 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
import {
getApplicationInfo,
getNodeApplications,
getNodeInfo,
getSwarmNodes,
} from "@dokploy/server";
import { z } from "zod";
import { createTRPCRouter, protectedProcedure } from "../trpc";
export const swarmRouter = createTRPCRouter({
getNodes: protectedProcedure.query(async () => {
return await getSwarmNodes();
}),
getNodeInfo: protectedProcedure
.input(z.object({ nodeId: z.string() }))
.query(async ({ input }) => {
return await getNodeInfo(input.nodeId);
}),
getNodeApps: protectedProcedure.query(async () => {
return getNodeApplications();
}),
getAppInfos: protectedProcedure
.input(
z.object({
appName: z.string(),
}),
)
.query(async ({ input }) => {
return await getApplicationInfo(input.appName);
}),
});