Skip to content

Commit b1d1763

Browse files
authored
Merge pull request #1535 from Dokploy/canary
🚀 Release v0.20.8
2 parents b5d1990 + 9118305 commit b1d1763

File tree

4 files changed

+33
-31
lines changed

4 files changed

+33
-31
lines changed

apps/dokploy/components/dashboard/settings/cluster/nodes/add-node.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ExternalLink, PlusIcon } from "lucide-react";
1212
import Link from "next/link";
1313
import { AddManager } from "./manager/add-manager";
1414
import { AddWorker } from "./workers/add-worker";
15+
import { AlertBlock } from "@/components/shared/alert-block";
1516

1617
interface Props {
1718
serverId?: string;
@@ -48,6 +49,10 @@ export const AddNode = ({ serverId }: Props) => {
4849
Architecture
4950
<ExternalLink className="h-4 w-4" />
5051
</Link>
52+
<AlertBlock type="warning">
53+
Make sure you use the same architecture as the node you are
54+
adding.
55+
</AlertBlock>
5156
</DialogDescription>
5257
</DialogHeader>
5358
<div className="flex flex-col gap-2">

apps/dokploy/components/dashboard/settings/cluster/nodes/show-nodes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export const ShowNodes = ({ serverId }: Props) => {
144144
<DropdownMenuContent align="end">
145145
<DropdownMenuLabel>Actions</DropdownMenuLabel>
146146
<ShowNodeData data={node} />
147-
{node?.ManagerStatus?.Leader && (
147+
{!node?.ManagerStatus?.Leader && (
148148
<DialogAction
149149
title="Delete Node"
150150
description="Are you sure you want to delete this node from the cluster?"

apps/dokploy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dokploy",
3-
"version": "v0.20.7",
3+
"version": "v0.20.8",
44
"private": true,
55
"license": "Apache-2.0",
66
"type": "module",

apps/dokploy/server/api/routers/cluster.ts

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { getPublicIpWithFallback } from "@/server/wss/terminal";
22
import {
33
type DockerNode,
4-
IS_CLOUD,
54
execAsync,
5+
execAsyncRemote,
6+
findServerById,
67
getRemoteDocker,
78
} from "@dokploy/server";
89
import { TRPCError } from "@trpc/server";
@@ -16,10 +17,6 @@ export const clusterRouter = createTRPCRouter({
1617
}),
1718
)
1819
.query(async ({ input }) => {
19-
if (IS_CLOUD) {
20-
return [];
21-
}
22-
2320
const docker = await getRemoteDocker(input.serverId);
2421
const workers: DockerNode[] = await docker.listNodes();
2522

@@ -33,17 +30,17 @@ export const clusterRouter = createTRPCRouter({
3330
}),
3431
)
3532
.mutation(async ({ input }) => {
36-
if (IS_CLOUD) {
37-
throw new TRPCError({
38-
code: "UNAUTHORIZED",
39-
message: "Functionality not available in cloud version",
40-
});
41-
}
4233
try {
43-
await execAsync(
44-
`docker node update --availability drain ${input.nodeId}`,
45-
);
46-
await execAsync(`docker node rm ${input.nodeId} --force`);
34+
const drainCommand = `docker node update --availability drain ${input.nodeId}`;
35+
const removeCommand = `docker node rm ${input.nodeId} --force`;
36+
37+
if (input.serverId) {
38+
await execAsyncRemote(input.serverId, drainCommand);
39+
await execAsyncRemote(input.serverId, removeCommand);
40+
} else {
41+
await execAsync(drainCommand);
42+
await execAsync(removeCommand);
43+
}
4744
return true;
4845
} catch (error) {
4946
throw new TRPCError({
@@ -60,20 +57,20 @@ export const clusterRouter = createTRPCRouter({
6057
}),
6158
)
6259
.query(async ({ input }) => {
63-
if (IS_CLOUD) {
64-
return {
65-
command: "",
66-
version: "",
67-
};
68-
}
6960
const docker = await getRemoteDocker(input.serverId);
7061
const result = await docker.swarmInspect();
7162
const docker_version = await docker.version();
7263

64+
let ip = await getPublicIpWithFallback();
65+
if (input.serverId) {
66+
const server = await findServerById(input.serverId);
67+
ip = server?.ipAddress;
68+
}
69+
7370
return {
7471
command: `docker swarm join --token ${
7572
result.JoinTokens.Worker
76-
} ${await getPublicIpWithFallback()}:2377`,
73+
} ${ip}:2377`,
7774
version: docker_version.Version,
7875
};
7976
}),
@@ -84,19 +81,19 @@ export const clusterRouter = createTRPCRouter({
8481
}),
8582
)
8683
.query(async ({ input }) => {
87-
if (IS_CLOUD) {
88-
return {
89-
command: "",
90-
version: "",
91-
};
92-
}
9384
const docker = await getRemoteDocker(input.serverId);
9485
const result = await docker.swarmInspect();
9586
const docker_version = await docker.version();
87+
88+
let ip = await getPublicIpWithFallback();
89+
if (input.serverId) {
90+
const server = await findServerById(input.serverId);
91+
ip = server?.ipAddress;
92+
}
9693
return {
9794
command: `docker swarm join --token ${
9895
result.JoinTokens.Manager
99-
} ${await getPublicIpWithFallback()}:2377`,
96+
} ${ip}:2377`,
10097
version: docker_version.Version,
10198
};
10299
}),

0 commit comments

Comments
 (0)