Repository navigation
Conversation
nurikk
marked this pull request as draft
March 16, 2026 09:08
- Use .one endpoints (application.one, postgres.one, etc.) to fetch full resource details with child resources instead of non-existent list endpoints (port.byApplicationId, redirect.byApplicationId, etc.) - Fix mount router name from 'mount' to 'mounts' (matching server registration) - Fix project ID extraction from createProject response (nested under .project) - Handle pre-existing default environment when creating projects - Fix port publishMode default from 'host' to 'ingress' (matching server behavior) - Clean up exporter to strip git-provider fields, runtime fields, and auto-created database mounts for cleaner YAML output
resolveServer() adds _resolvedServerId to config objects, but it was not in IGNORED_FIELDS. This caused spurious "update" actions for every resource with a serverName, since remote objects never contain this internal field.
- Add environment update support: executeEnvironmentAction now handles "update" actions instead of silently dropping them - Preserve schedule enabled field: stop stripping `enabled` from exports so disabled schedules survive export/apply roundtrip (use DEFAULTS to omit only when true) - Narrow mount duplicate detection: only swallow 409 or 400 with "already" message, not all 400 errors - Guard createProject response: throw immediately if projectId is missing instead of propagating undefined
Move the API client from src/lib/apply/api-client.ts to src/utils/api.ts so it can serve as the canonical HTTP layer for the entire CLI, not just the apply/export commands. - src/utils/api.ts: canonical location with trpcQuery/trpcMutation helpers - src/lib/apply/api-client.ts: re-exports from utils/api for compatibility - src/utils/shared.ts: rewritten to use api client instead of raw axios - src/lib/apply/exporter.ts: removed duplicate fetchProject function
All 30 command files now use src/utils/api.ts instead of direct axios calls. axios is imported in exactly one place. - Migrated: authenticate, verify, project/create, environment/create, environment/delete, env/push, app/* (4 files), database/*/* (20 files) - Added lifecycle endpoints to api.ts: deploy, stop, remove for all service types; getUser for auth validation - Removed unused src/utils/http.ts
|
Hey @nurikk — thanks for putting this together. The design in #4008 plus the export round-trip in this PR are exactly the model we'd hoped for. We're about to wire up a small production workload on Dokploy (one Compose app + Postgres + a domain) and were planning to bridge with the existing CLI until
Either way, looking forward to using it once it ships. |
Contributor
|
Hey @nurikk I appreciate the PR, can you update and fix the conflicts? |
pavliha
added a commit
to pavliha/cli
that referenced
this pull request
Oct 12, 2026
`dokploy apply -f dokploy.yaml` creates or updates a project from a YAML file, matching projects, environments and services by name. `--dry-run` prints the plan and `--verbose` shows field-level changes. `dokploy export -p <project>` writes an existing project as a dokploy.yaml that applies back as unchanged. Ported from Dokploy#30 onto the commander CLI, with these changes: - read schedules through schedule.list, since application.one and compose.one do not return them (re-applying duplicated every schedule) - treat database credentials as create-only: update would overwrite the stored password without running ALTER USER, so the dashboard and the database would disagree - apply every field to new mysql, mariadb, mongo and redis services, not only postgres - send only changed fields on update; child updates fill required fields from the server instead of schema defaults that overwrote values the file never set - after creating a database, diff its mounts against the auto-created data volume instead of adding a second mount on the same path - resolve `gitProvider` by name so GitHub-sourced apps can deploy - reject unknown keys, and fail before any change when a new resource is missing fields the server needs to create it - match services through project.one; project.all returns database summaries without names - export only declarative fields and never write passwords, and mask passwords in --verbose diffs Implements Dokploy/dokploy#4008. Co-authored-by: nurikk <[email protected]>
15 tasks
Author
|
superseded by #60 |
pavliha
added a commit
to pavliha/cli
that referenced
this pull request
Oct 15, 2026
`dokploy apply -f dokploy.yaml` creates or updates a project from a YAML file, matching projects, environments and services by name. `--dry-run` prints the plan and `--verbose` shows field-level changes. `dokploy export -p <project>` writes an existing project as a dokploy.yaml that applies back as unchanged. Ported from Dokploy#30 onto the commander CLI, with these changes: - read schedules through schedule.list, since application.one and compose.one do not return them (re-applying duplicated every schedule) - treat database credentials as create-only: update would overwrite the stored password without running ALTER USER, so the dashboard and the database would disagree - apply every field to new mysql, mariadb, mongo and redis services, not only postgres - send only changed fields on update; child updates fill required fields from the server instead of schema defaults that overwrote values the file never set - after creating a database, diff its mounts against the auto-created data volume instead of adding a second mount on the same path - resolve `gitProvider` by name so GitHub-sourced apps can deploy - reject unknown keys, and fail before any change when a new resource is missing fields the server needs to create it - match services through project.one; project.all returns database summaries without names - export only declarative fields and never write passwords, and mask passwords in --verbose diffs Implements Dokploy/dokploy#4008. Co-authored-by: nurikk <[email protected]>
pavliha
added a commit
to pavliha/cli
that referenced
this pull request
Nov 4, 2026
`dokploy apply -f dokploy.yaml` creates or updates a project from a YAML file, matching projects, environments and services by name. `--dry-run` prints the plan and `--verbose` shows field-level changes. `dokploy export -p <project>` writes an existing project as a dokploy.yaml that applies back as unchanged. Ported from Dokploy#30 onto the commander CLI, with these changes: - read schedules through schedule.list, since application.one and compose.one do not return them (re-applying duplicated every schedule) - treat database credentials as create-only: update would overwrite the stored password without running ALTER USER, so the dashboard and the database would disagree - apply every field to new mysql, mariadb, mongo and redis services, not only postgres - send only changed fields on update; child updates fill required fields from the server instead of schema defaults that overwrote values the file never set - after creating a database, diff its mounts against the auto-created data volume instead of adding a second mount on the same path - resolve `gitProvider` by name so GitHub-sourced apps can deploy - reject unknown keys, and fail before any change when a new resource is missing fields the server needs to create it - match services through project.one; project.all returns database summaries without names - export only declarative fields and never write passwords, and mask passwords in --verbose diffs Implements Dokploy/dokploy#4008. Co-authored-by: nurikk <[email protected]>
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 two new commands to the Dokploy CLI for managing resources as code (ref: Dokploy/dokploy#3872, Dokploy/dokploy#4008):
dokploy apply -f dokploy.yaml— Apply a declarative YAML config to create or update resources on the serverdokploy export -p <project> -f out.yaml— Export an existing project as adokploy.yamlconfig fileThese commands enable round-tripping: export a project, check the YAML into git, modify it, and apply changes back.
applycommandserverNamefield for multi-server deploymentsdokploy env pushexportcommandapplyschema exactly (round-trip safe)Architecture
New dependencies
yaml— YAML parsing and serializationzod— Schema validationTest plan
--helpcommands render correctly