feat(mount): customizable uid/gid/mode for volume mounts#101
Open
AminDhouib wants to merge 5 commits into
Open
feat(mount): customizable uid/gid/mode for volume mounts#101AminDhouib wants to merge 5 commits into
AminDhouib wants to merge 5 commits into
Conversation
(cherry picked from commit 07b4731)
(cherry picked from commit 84f60ac)
- Updated the `mode` field in the mount schema to require a regex validation for octal values, ensuring it matches formats like 755 or 0644. (cherry picked from commit 99fed39)
Regenerated the drizzle migration locally against the fork's canary chain (renumbered from generated 0175 to slot 0182, when=1784005000000) so it does not collide with sibling migration PRs. Adds nullable uid/gid/mode columns to the mount table backing the volume ownership/permissions feature. Co-authored-by: Mauricio Siu <siumauricio@icloud.com>
The uid/gid/mode form fields use `z.preprocess`, whose `z.input` is `unknown` in zod 4; `@hookform/resolvers` 5 then infers a resolver input type that does not match `useForm<AddMount>` (the `z.output`), so the discriminated-union form fails `tsc`. Cast the resolver to the form's value type in add-volumes.tsx and update-volume.tsx. Runtime behaviour is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional Unix ownership (uid/gid) and permission mode to volume / bind / file mounts, so containers running as a non-root user can own their mounted data. After a mount with ownership set is created or updated, dokploy applies
chown/chmodto the target (bind path, file path, or a one-shotalpinecontainer for named volumes) on the local or remote server.packages/server/src/db/schema/mount.ts: add nullableuid(integer),gid(integer),mode(text) columns; expose them onapiCreateMount;modevalidated as octal (/^[0-7]{3,4}$/).packages/server/src/services/mount.ts:applyMountPermissions()(+hasOwnership/buildChownArghelpers) runs chown/chmod for bind/file/volume mounts; invoked fromcreateMount/updateMountwhen ownership is set.apps/dokploy/components/dashboard/application/advanced/volumes/{add-volumes,update-volume,show-volumes}.tsx+ newcomponents/shared/permission-mode.tsx: UID/GID/mode inputs and labels in the volume UI.apps/dokploy/drizzle/0182_sturdy_vision.sql(+ snapshot/journal): migration adding the threemountcolumns.Ports Dokploy#2517 by @divaltor (feature) with migration + octal validation by @Siumauricio; authorship preserved via cherry-pick, migration regenerated locally and co-credited.
Addresses Dokploy#497.
Adaptations
0175_careless_marvex.sql/ snapshot / journal were dropped; the migration was regenerated against the fork's canary chain and renumbered to slot 0182 (when=1784005000000) so it does not collide with sibling migration PRs. The SQL is identical (ALTER TABLE "mount" ADD COLUMN "uid"/"gid"/"mode").mounttable, notapplications— no interaction with the 100-column ceiling, no relational-query changes.services/mount.tsmerged cleanly onto the fork's rewritten version (which already providesgetServerId/getBaseFilesPath); the portedapplyMountPermissionsreuses them unchanged.Merge-order note
Carries drizzle migration slot 0182. Merge after fork #11/#12 (slots 0175/0176) and after the sibling PR holding slot 0181; sibling migration PRs conflict only in
apps/dokploy/drizzle/meta/_journal.json— keep both entries, idx-ordered.Verification
pnpm --filter=dokploy run typecheckpasses on this branch.