Repository navigation
Conversation
07ce7c1 to
4b965d5
Compare
|
How are envs in docker compose / env / project treated? |
|
Hi @luixo, I added it. You can now set env: |
LOG_LEVEL=info
environments:
- name: production
env: |
API_URL=https://api.example.com
applications:
- name: web-api
env: |
LOG_LEVEL=${{project.LOG_LEVEL}}
PUBLIC_URL=${{environment.API_URL}}
|
|
Awesome, thanks! |
|
So the feedback for my case - backing up my projects and restoring that backup on a new machine:
|
`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 <1525421+nurikk@users.noreply.github.com>
- env on project, environments and every service; buildArgs and buildSecrets on applications, all sent through the existing update path - export omits them unless --include-env; --verbose masks their values - environments matched on create (the auto-created production) now get their description and env applied instead of being skipped - planning fails when serverName would move an existing service, instead of silently ignoring it
- export writes the file with mode 0600 so --include-env secrets stay private - includeEnv is a required export option instead of a silent default - tests for env updates on existing resources and for keeping a service on the server it already runs on
- a file can hold several YAML documents; an optional kind: Organization document manages SSH keys, servers, S3 destinations, registries, certificates, notifications and secret managers by name, applied before projects (secret managers after, so they can be assigned to them) - apply --prune deletes environments, services and their domains, ports, mounts, redirects, basic auth and schedules missing from the file; the default environment is emptied, database data mounts and compose volumes are kept, organization settings are never pruned - export --all writes the organization plus every project, sorted by name; -p accepts a project id or name; --include-secrets adds passwords, keys and tokens on top of --include-env - serverName resolves at execution time so a server declared in the same file can be used by the services that follow
0692312 to
838ee23
Compare
hi I updated based on your feedback |
|
Thanks, I appreciate it a lot, that's great fit for my usecase!
Found this in the README. What does that mean? If I backed them up and reapplied later, why would I need to change them from the dashboard? I miss some context here.
What does that mean? |
What is this PR about?
Finishes #30 by @nurikk (credited as co-author), rebuilt on the commander/OpenAPI CLI that replaced oclif in April. It implements the plan in Dokploy/dokploy#4008:
One project per file, matched by name; create and update only; env vars stay out of the file. See
examples/dokploy.yamland the README section.Depends on #52.
applyneeds parameterized GETs, which are broken onmain. #52's commit is included here unchanged so this branch builds and runs; it drops out on rebase once #52 merges. This PR's own change is the singlefeat:commit and does not touchsrc/client.ts.Changes from #30
application.one/compose.onedon't return schedules; they're now read viaschedule.list.postgres.updatewith a newdatabasePasswordstores it without runningALTER USER(that'schangePassword), so the dashboard and the database disagree afterwards.project.all, which returns database summaries without names, so existing databases were planned as new. Planning now usesproject.one.publishMode,permanent, ...) from the server instead of from schema defaults, which used to overwrite values the file never set.databasePasswordfor a new DB) fails before any change is made.Three additions go beyond #4008. They're listed on the issue for sign-off, and I'm happy to drop any of them:
gitProvider: <name>resolves togithubId/gitlabId/..., so GitHub-sourced apps can deploy.export(listed as out of scope in #4008, but part of feat: add declarative apply & export commands #30) never writes passwords, and--verbosemasks them.Testing
pnpm build && pnpm test: 52 tests, covering 99% of lines and 91% of branches insrc/lib/applyand the two commands. They mock the API atclient.tsand assert exact call sequences, including the payload of every create endpoint (project, environment, all seven service types, all six child types), update merging, credential handling, failure isolation, exit codes and error messages.apply --dry-runof each export reports everything unchanged.apply(viagitProvider) deployed successfully.serverNameresolved against a registered remote server, and exported back by name.Screenshots
apply --dry-runfor a new project:Issues related
Closes #30. Implements Dokploy/dokploy#4008. Depends on #52.