Skip to content

feat: named resource profiles reusable across applications, databases and compose services - #5188

Open
gkissel wants to merge 2 commits into
Dokploy:canaryfrom
gkissel:feat/resource-profiles
Open

feat: named resource profiles reusable across applications, databases and compose services#5188
gkissel wants to merge 2 commits into
Dokploy:canaryfrom
gkissel:feat/resource-profiles

Conversation

@gkissel

@gkissel gkissel commented Aug 25, 2026

Copy link
Copy Markdown

Fixes #5106

Description

Adds organization-level Resource Groups containing named Resource Profiles (the same 4 values already used by services today, in the same units/format), so resource sizing no longer has to be copy-pasted on every service and can be changed in one place.

What's included

Schema (migration 0186)

  • resource_group (org-scoped, unique name per org)
  • resource_profile (belongs to a group; holds memoryReservation / memoryLimit / cpuReservation / cpuLimit, unique name per group)
  • compose_service_resource_profile (per compose service assignment with per-field overrides)

Applications & databases

  • New nullable resourceProfileId column on application, postgres, mysql, mariadb, mongo, redis, libsql
  • The existing 4 resource fields act as per-field overrides — effective value = override ?? profile value
  • Resolution happens at deploy time in the existing path (builders, database builders, rollbacks), applied on the next deploy/redeploy with no implicit restarts
  • Services without a profile behave exactly as before

Docker Compose

  • Compose settings (Advanced tab) list the services parsed from the file and allow assigning a profile (+ overrides) per service
  • At deploy time Dokploy injects deploy.resources.limits/reservations into the generated stack file; if the service already defines deploy.resources, the Dokploy assignment wins and the UI shows a warning badge

Settings UI

  • New "Resource Profiles" section (same pattern as S3 Destinations): CRUD for groups/profiles, usage counts shown per profile, deleting a group/profile still in use is blocked with a clear error
  • Resources tab now has a Group → Profile selector; inherited values show as placeholders and each field remains individually overridable

Screenshots

Settings — empty state Create group dialog
Create profile dialog Profiles list with usage badges
Application Resources tab Profile dropdown expanded

Compose Advanced — per-service profile assignment

Demo

https://github.com/gkissel/dokploy/releases/download/resource-profiles-screenshots/resource-profiles-demo.webm

Testing

Verified locally against a running dev instance:

  • ✅ tRPC CRUD for groups/profiles via live API
  • ✅ Deleting an in-use profile returns CONFLICT with a clear message; unused profiles delete fine
  • resolveEffectiveResources: profile inheritance verified live (profile 1GB/0.5CPU → effective limits), override precedence verified (app-level 2GB memory wins over profile, remaining fields inherit)
  • ✅ Compose injection: parsed YAML with assigned service gets deploy.resources.limits.memory=1073741824 + override cpus=0.75; unassigned service untouched
  • ✅ Migration 0186 applies cleanly to Postgres
  • pnpm run typecheck, Biome lint/format clean, unit tests pass (the only failing tests are the pre-existing network-dependent application.real.test.ts clone tests, which fail identically on a clean canary checkout in this environment)
  • ✅ Profile select correctly displays linked profile on load (Radix Select controlled-value race fixed)
  • ✅ Org-boundary authorization: cross-org profile access returns 404/CONFLICT

@gkissel
gkissel requested a review from Siumauricio as a code owner August 25, 2026 17:56
@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Aug 25, 2026
Comment thread apps/dokploy/server/api/routers/resource-profile.ts Outdated
Comment thread apps/dokploy/server/api/routers/resource-profile.ts
Comment thread apps/dokploy/server/api/routers/resource-profile.ts
Add named resource profiles grouped at the organization level that can
be linked to applications, databases and compose services instead of
typing resource limits by hand on every service.

- New resource_group and resource_profile tables plus a
  compose_service_resource_profile mapping table (migration 0186)
- Applications, postgres, mysql, mariadb, mongo, redis and libsql get a
  resourceProfileId column; existing resource fields act as per-field
  overrides of the profile values
- Effective values are resolved at deploy time in the same path as the
  previous static fields (builders, database builders and rollbacks)
- Compose services can be assigned a profile with overrides; Dokploy
  injects deploy.resources.limits/reservations into the generated stack
  file and wins over resources defined in the compose file itself
- New Settings > Resource Profiles section with CRUD for groups and
  profiles, usage counts and delete protection while in use
- Resources tab shows a group/profile selector; inherited values appear
  as placeholders and each field can still be overridden

Fixes Dokploy#5106
- Fix Radix Select controlled value race: remove onValueChange from
  group Select, use useRef-based effect to clear profile only on
  user-initiated group changes
- Filter empty string from profile Select onValueChange (Radix fires
  on controlled value mismatch during re-render cascade)
- Fix compose assignment endpoint missing authorization (Greptile review)
- Add oneProfile tenant bypass for single-org setups (Greptile review)
- Add findComposeServiceAssignmentById helper
@gkissel
gkissel force-pushed the feat/resource-profiles branch from 9e58db2 to 87aa39d Compare August 27, 2026 17:21
@gkissel

gkissel commented Aug 27, 2026

Copy link
Copy Markdown
Author

@Siumauricio Could you look at this pr when possible? Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Named resource profiles (organization-level groups) reusable across applications, databases and compose services

1 participant