Skip to content

Commit 3374737

Browse files
authored
Merge pull request #4059 from Dokploy/feat/add-non-root-user
feat(servers): enhance server setup and validation for user privileges
2 parents 4f5f1ad + 27a67af commit 3374737

6 files changed

Lines changed: 160 additions & 71 deletions

File tree

apps/dokploy/components/dashboard/settings/servers/handle-servers.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
2020
import {
2121
Form,
2222
FormControl,
23+
FormDescription,
2324
FormField,
2425
FormItem,
2526
FormLabel,
@@ -409,7 +410,10 @@ export const HandleServers = ({ serverId, asButton = false }: Props) => {
409410
<FormControl>
410411
<Input placeholder="root" {...field} />
411412
</FormControl>
412-
413+
<FormDescription>
414+
Use &quot;root&quot; or a non-root user with passwordless
415+
sudo access.
416+
</FormDescription>
413417
<FormMessage />
414418
</FormItem>
415419
)}

apps/dokploy/components/dashboard/settings/servers/setup-server.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ export const SetupServer = ({ serverId, asButton = false }: Props) => {
118118
</div>
119119
) : (
120120
<div id="hook-form-add-gitlab" className="grid w-full gap-4">
121-
<AlertBlock type="warning">
122-
Using a root user is required to ensure everything works as
123-
expected.
121+
<AlertBlock type="info">
122+
You can connect as root or as a non-root user with passwordless
123+
sudo access. If using a non-root user, ensure passwordless sudo is
124+
configured.
124125
</AlertBlock>
125126

126127
<Tabs defaultValue="ssh-keys">

apps/dokploy/components/dashboard/settings/servers/validate-server.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,29 @@ export const ValidateServer = ({ serverId }: Props) => {
163163
: "Not Created"
164164
}
165165
/>
166+
<StatusRow
167+
label="Privilege Mode"
168+
isEnabled={
169+
data?.privilegeMode === "root" ||
170+
data?.privilegeMode === "sudo"
171+
}
172+
description={
173+
data?.privilegeMode === "root"
174+
? "Running as root"
175+
: data?.privilegeMode === "sudo"
176+
? "Running with sudo"
177+
: "No sudo access (required for non-root)"
178+
}
179+
/>
180+
<StatusRow
181+
label="Docker Group"
182+
isEnabled={data?.dockerGroupMember}
183+
description={
184+
data?.dockerGroupMember
185+
? "User is in docker group"
186+
: "User is not in docker group"
187+
}
188+
/>
166189
</div>
167190
</div>
168191
</div>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ export const serverRouter = createTRPCRouter({
252252
isDokployNetworkInstalled: boolean;
253253
isSwarmInstalled: boolean;
254254
isMainDirectoryInstalled: boolean;
255+
privilegeMode: string;
256+
dockerGroupMember: boolean;
255257
};
256258
} catch (error) {
257259
throw new TRPCError({

0 commit comments

Comments
 (0)