mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor(cloud): add is cloud flag to cluters
This commit is contained in:
parent
3747db08d4
commit
daa87c0dc7
@ -48,10 +48,7 @@ RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh && rm
|
||||
|
||||
# Install Nixpacks and tsx
|
||||
# | VERBOSE=1 VERSION=1.21.0 bash
|
||||
RUN curl -sSL https://nixpacks.com/install.sh -o install.sh \
|
||||
&& chmod +x install.sh \
|
||||
&& ./install.sh \
|
||||
&& pnpm install -g tsx
|
||||
RUN pnpm install -g tsx
|
||||
|
||||
# Install buildpacks
|
||||
COPY --from=buildpacksio/pack:0.35.0 /usr/local/bin/pack /usr/local/bin/pack
|
||||
|
@ -2,10 +2,18 @@ import { getPublicIpWithFallback } from "@/server/wss/terminal";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { z } from "zod";
|
||||
import { createTRPCRouter, protectedProcedure } from "../trpc";
|
||||
import { execAsync, docker, type DockerNode } from "@dokploy/builders";
|
||||
import {
|
||||
execAsync,
|
||||
docker,
|
||||
type DockerNode,
|
||||
IS_CLOUD,
|
||||
} from "@dokploy/builders";
|
||||
|
||||
export const clusterRouter = createTRPCRouter({
|
||||
getNodes: protectedProcedure.query(async () => {
|
||||
if (IS_CLOUD) {
|
||||
return [];
|
||||
}
|
||||
const workers: DockerNode[] = await docker.listNodes();
|
||||
|
||||
return workers;
|
||||
@ -17,6 +25,12 @@ export const clusterRouter = createTRPCRouter({
|
||||
}),
|
||||
)
|
||||
.mutation(async ({ input }) => {
|
||||
if (IS_CLOUD) {
|
||||
throw new TRPCError({
|
||||
code: "UNAUTHORIZED",
|
||||
message: "Functionality not available in cloud version",
|
||||
});
|
||||
}
|
||||
try {
|
||||
await execAsync(
|
||||
`docker node update --availability drain ${input.nodeId}`,
|
||||
@ -32,6 +46,12 @@ export const clusterRouter = createTRPCRouter({
|
||||
}
|
||||
}),
|
||||
addWorker: protectedProcedure.query(async ({ input }) => {
|
||||
if (IS_CLOUD) {
|
||||
return {
|
||||
command: "",
|
||||
version: "",
|
||||
};
|
||||
}
|
||||
const result = await docker.swarmInspect();
|
||||
const docker_version = await docker.version();
|
||||
|
||||
@ -43,6 +63,12 @@ export const clusterRouter = createTRPCRouter({
|
||||
};
|
||||
}),
|
||||
addManager: protectedProcedure.query(async ({ input }) => {
|
||||
if (IS_CLOUD) {
|
||||
return {
|
||||
command: "",
|
||||
version: "",
|
||||
};
|
||||
}
|
||||
const result = await docker.swarmInspect();
|
||||
const docker_version = await docker.version();
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user