Commit Graph
1180 Commits
Author SHA1 Message Date
Jose Diaz-Gonzalez c776fbc7a4 test: expect the global MAILTO reset in cron-3 2026-09-30 21:40:31 -04:00
Jose Diaz-Gonzalez b158f482ef fix: reset MAILTO after a cron entry that sets its own
A task with its own `MAILTO` is now written in place, followed by a line resetting `MAILTO` to the global value, or to the `dokku` user when none is set, rather than grouped at the end of the crontab, so no other task is mailed to its recipient whatever order the tasks are written in.
2026-09-30 17:47:27 -04:00
Jose Diaz-Gonzalez f91b1f7fc7 feat: allow cron-entries to set a per-entry MAILTO
The `cron-entries` trigger is now passed `json` as a second argument, and plugins may print each task as a json object on its own line. A task that sets a `mailto` is written to the crontab under a `MAILTO` of its own, and its output is mailed to that address as well as appended to its log file, so plugins such as the datastore plugins can have the output of a specific scheduled task mailed to a specific person.
2026-09-30 17:01:25 -04:00
Jose Diaz-Gonzalez 46776fa87c fix: allow enabling nginx-vhosts when skipped at install
Installing with the `dokku/nginx_enable` debconf option set to `false` left the nginx-vhosts plugin disabled with no way to turn it back on, as `dokku plugin:enable nginx-vhosts` reported that the plugin does not exist. The plugin can now be enabled after installation, and the debconf documentation explains the option's effect and how to reverse it.
2026-09-29 12:11:17 -04:00
Jose Diaz-Gonzalez 7a0404a2ec fix: report stored node-sysctls images globally
The `--scheduler-k3s-global-node-sysctls-image` and `--scheduler-k3s-global-node-sysctls-pause-image` report flags returned the built-in default when nothing was stored, so an unset image could not be told apart from one set to the default. They now report the stored value like every other global flag, and new `--scheduler-k3s-computed-node-sysctls-image` and `--scheduler-k3s-computed-node-sysctls-pause-image` flags report the image that is actually used.
2026-09-26 01:14:15 -04:00
Jose Diaz-Gonzalez 8802ae69b4 fix: verify existing apps in git commands 2026-09-25 21:20:21 -04:00
Jose Diaz-Gonzalez 3796c666d1 Merge pull request #9081 from dokku/run-logs-args
fix: validate run:logs arguments
2026-09-25 18:05:11 -04:00
Jose Diaz-Gonzalez 9294aafcbf Merge pull request #9080 from dokku/apps-create-existing-dir
Check app directory when creating a new app
2026-09-25 17:54:16 -04:00
Jose Diaz-Gonzalez 1516f84cee fix: validate run:logs arguments 2026-09-24 18:43:50 -04:00
Jose Diaz-Gonzalez 1058e1f5ad fix: check app directory when creating a new app 2026-09-24 18:25:56 -04:00
Jose Diaz-Gonzalez a4484d354b fix: validate app name in app-scoped commands 2026-09-24 18:14:53 -04:00
Jose Diaz-Gonzalez 1f8a814047 fix: respect quoting in procfile commands
Procfile commands for the `docker-local` scheduler were split differently on deploy and on `dokku run`. Deploys failed on escaped quotes, and `dokku run` ignored quotes entirely. Both now split commands using shell quoting rules, and commands containing bare shell operators fail with a clear error, matching the `k3s` scheduler.
2026-09-24 01:24:27 -04:00
Jose Diaz-Gonzalez db42d0a039 fix: validate app.json healthcheck path and scheme 2026-09-23 23:12:58 -04:00
Jose Diaz-Gonzalez 5dd9111d44 Merge pull request #9074 from dokku/9072-allow-storage-mount-replace-to-vary-mount-time-fields-per-mount
Allow storage:mount --replace to vary fields per mount
2026-09-23 04:02:02 -04:00
Jose Diaz-Gonzalez 551c6b1c43 feat: report each node-sysctls scope's stored map
`scheduler-k3s:node-sysctls:report` renders each scope's resolved set, so a profile's entry carries every globally-set sysctl underneath its own and there is no way to read back the map the profile itself stores. Since `node-sysctls:set --replace --profile` and `node-sysctls:clear --profile` write only that map, a tool converging a profile against a declared map sees permanent drift. The new `--stored` flag reports the map each scope owns, and `--global` and `--profile` narrow the report to a single scope. The default output is unchanged.
2026-09-23 02:09:33 -04:00
Jose Diaz-Gonzalez bf26539949 feat: allow storage:mount --replace to vary fields per mount
`storage:mount --replace` writes one process type's whole attachment set in a single call, but only part of an attachment could vary between the mounts in that call: each mount carried its own `ro` and Docker mount options while `--phase`, `--volume-subpath` and `--volume-chown` were fixed for the whole call, so an app whose mounts differ only in subpath still needed one call per mount, which is the non-atomic convergence `--replace` exists to remove. Each mount's option list now also carries `phase=`, `volume-subpath=` and `volume-chown=` tokens alongside `ro`, its new opposite `rw` and the Docker options it already passed through, and so that each attribute has exactly one spelling the five matching flags are now rejected with `--replace` - one of which, `--volume-options`, was previously accepted and silently dropped. `--process-type` still scopes the whole call, since it selects which mounts the call is authoritative over rather than describing any one of them. Every mount is parsed and validated before anything is written, so a rejected token leaves the stored mounts untouched. The documentation added for `--replace` was also marked as new in 0.38.28 in four places, but it shipped in 0.38.29.
2026-09-23 01:10:49 -04:00
Jose Diaz-Gonzalez b612285392 fix: honor storage attachment process types at deploy time
An attachment's process type was recorded, reported and used to scope `storage:mount --replace` and `storage:unmount --all`, but nothing read it when the volume was actually mounted, so `storage:mount <app> <entry> --container-dir <path> --process-type web` bound the volume into every process rather than only `web`. Both schedulers now scope a mount to the process type it was declared for, and containers that belong to no process type - a `dokku run` one-off, an `app.json` deploy task, a k3s cron job - receive default-scoped mounts only. A container path can now be claimed by a single mount per process type, and `storage:migrate` drains process-scoped `-v` lines out of `docker-options` rather than only the default-scoped ones.
2026-09-21 18:08:42 -04:00
Jose Diaz-Gonzalez 6f938dd12b fix: assert the forwarded set, not a sample variable
The test used `DOKKU_IMAGE` as a variable that does not cross the privilege drop, which stopped being true once every environment-overridable variable was forwarded. It now reads the `--preserve-env` argument itself, so it tests the contract rather than one member of the list.
2026-09-20 17:31:56 -04:00
Jose Diaz-Gonzalez 63e4b92a52 fix: forward every environment-overridable dokku variable
`DOKKU_INIT_SYSTEM` reaches the `dokku` user only through the environment while the Docker image is being built, so narrowing the forwarded set left `nginx:reload` taking the systemd branch during `debian/postinst` and blocking on a sudo password prompt until the build timed out. The forwarded set now covers every variable `dokku` honours from the environment, and `DOKKU_PRESERVE_ENV` still carries anything beyond it.
2026-09-20 16:25:34 -04:00
Jose Diaz-Gonzalez 6b1b7bc6f6 fix: preserve global flags when sudo is sudo-rs
`sudo-rs`, the default sudo on Ubuntu 25.10 and later, does not support preserving the entire environment, so `--quiet`, `--trace`, `--force` and `--app` stopped taking effect once `dokku` re-executed itself as the `dokku` user, and a warning was printed on every invocation. Variables outside the set dokku forwards no longer cross that boundary and can be named in `DOKKU_PRESERVE_ENV` instead.
2026-09-20 04:11:15 -04:00
Jose Diaz-Gonzalez c04e74c668 Merge pull request #9058 from dokku/8991-add-a-whole-set-form-for-an-app-s-storage-attachments
Add a whole-set form for an app's storage mounts
2026-09-20 04:09:37 -04:00
Jose Diaz-Gonzalez d5b2e699f2 Merge pull request #9062 from dokku/explicit-datastore-destroy-force
Pass force to the datastore command that owns it
2026-09-20 04:09:03 -04:00
Jose Diaz-Gonzalez 11b09fb375 fix: pass force to the datastore command that owns it
The datastore destroys were written with dokku's global `--force`, which works only because dokku translates it into `DOKKU_APPS_FORCE_DELETE` and the plugin reads that environment variable back. The flag belongs to the subcommand, which declares it, so it is passed there instead.

Only the datastore calls move. `network:destroy` and `storage:destroy` are dokku's own commands and keep dokku's own convention.
2026-09-20 02:58:02 -04:00
Jose Diaz-Gonzalez 57bbe917b0 fix: call the datastore create command the way it is documented
The ports and app-json tests passed the app name to `postgres:create` and `redis:create` a second time, as a positional the command has never taken. The bash datastore plugins parsed their arguments with getopts and simply stopped at it; those plugins now dispatch to a binary that reports the count instead, so every dokku pull request fails on `This command requires 2 arguments, 3 arguments given`.

The documented form takes the service alone, as `docs/deployment/application-deployment.md` shows. The `:link` and `:unlink` calls beside these are unchanged, since those do take two.
2026-09-20 02:53:32 -04:00
Jose Diaz-Gonzalez 1d0985428a feat: add a whole-set form for an app's storage mounts
The `storage` plugin mounted and unmounted one attachment at a time, so matching an app's mounts to a declared set meant reading `storage:list`, computing the difference in both directions and issuing one `storage:mount` or `storage:unmount` per addition and removal, with a failure partway through leaving the app holding a mixture of the two sets.

A `--replace` flag on `storage:mount` now writes the declared set in a single call, taking `name:container-dir` pairs whose optional third field carries the same mount options the legacy colon form accepts. Every pair is parsed and validated before anything is written, so a rejected pair leaves the stored mounts untouched. The remaining mount-time flags scope the whole call the way `--process-type` already scoped a single mount, which means an omitted `--process-type` replaces the `_default_` scope and leaves mounts scoped to a named process type in place.

An empty pair list is rejected rather than treated as a request to unmount everything, so a generated list that expands to nothing cannot silently drop an app's storage. `storage:unmount --all` handles that case instead, taking an optional `--process-type` filter and treating a scope that matches nothing as a no-op so it stays idempotent.

`storage:unmount` also accepts more than one mount at a time, naming each by entry name or by the colon form, and resolves every argument against the app's attachments before removing any of them.

The help listing now carries one entry per subcommand with its flags inline rather than a row per variant, and the command listing at the top of the storage documentation matches it line for line. Folding those rows together also surfaced `--global` on `storage:report` and `storage:migrate`, neither of which both listings had mentioned.

Finally, `--volume-chown` is now validated on mount, where a typo previously exited zero and wrote a value that only the report ever read.
2026-09-20 01:06:14 -04:00
Jose Diaz-Gonzalez f36512a19d Merge pull request #9055 from dokku/9037-nginx-conf-sigil-pre-validation-chowns-proxy-cache-path-directories-to-nobody-breaking-the-running-nginx-for-the-whole-build
Validate nginx templates as the running nginx user
2026-09-19 21:20:56 -04:00
Jose Diaz-Gonzalez 624eea1959 feat: add registry:auth-status to read back login state
There was no way to ask whether Dokku was already logged in to a registry with a given credential, so tooling converging a declared state onto a server had to re-run `registry:login` on every pass purely to discover that nothing needed to change. The new `registry:auth-status` command compares a supplied credential against the stored one and reports the result through its exit code alone, distinguishing a server with no credential from one whose credential differs, and from one whose secret a docker credential helper or an identity token puts out of reach. An `auth-servers` triad on `registry:report` exposes which servers have credentials without emitting any part of one.
2026-09-19 19:19:57 -04:00
Jose Diaz-Gonzalez 2e3d144aca fix: erase the docker hub credential on registry:logout
Docker stores Docker Hub under the index server address rather than the hostname the user logged in with, and `docker logout` only erases the exact key it is given, so `registry:logout docker.io` reported success while leaving the credential in place. The server is now resolved to the key docker actually stores before the logout runs.
2026-09-19 18:56:46 -04:00
Jose Diaz-Gonzalez 3423779f0f fix: validate nginx templates as the running nginx user
The wrapper config used to run `nginx -t` against an app's rendered `nginx.conf` declared no `user` directive, so nginx fell back to its compile-time default and chowned every `proxy_cache_path` directory to that user, including directories that already existed. On Debian and Ubuntu that default is `nobody`, so deploying an app shipping a custom `nginx.conf.sigil` took the running server's live cache directory away for the length of the build and turned every request the cache would serve into an HTTP 500, healing only once the deploy's own reload restored the ownership. The wrapper now declares the same `user` as the host's main nginx config, which is also exposed to custom `validate-config` templates as `$.NGINX_USER`.
2026-09-19 10:06:35 -04:00
Jose Diaz-Gonzalez cf5487c2df fix: honor the pinned chart version when upgrading
`scheduler-k3s:ensure-charts` announced the pinned chart version but installed whatever the chart repository had published most recently, and an affected cluster could not be brought back in line because a version mismatch was reported and then skipped. Charts now install at the version dokku pins, and a release that has drifted is reconciled back to it. Dokku also no longer registers helm repositories it never read, and the previously undocumented `ensure-charts` and `initialize` flags now appear in the help output.
2026-09-18 15:41:17 -04:00
Jose Diaz-Gonzalez c37a71b90b feat: add a whole-set form for scheduler-k3s metadata
The `scheduler-k3s` metadata commands were all per-key, so matching an app's stored annotations, labels or node sysctls to a declared set meant reading the report, computing the difference in both directions and issuing one command per added, changed and removed key, with a failure partway through leaving a mixture of the two sets. A `--replace` flag on `annotations:set`, `labels:set`, `node-sysctls:set` and `autoscaling-auth:set` now writes the declared map in a single call, taking trailing `key=value` pairs everywhere except `autoscaling-auth:set`, which keeps its repeatable `--metadata` flag. Every pair is parsed before anything is written, so a rejected pair leaves the stored map untouched, and a pair ending in `=` stores an empty value, which the per-key form cannot express. An empty pair list is rejected rather than treated as a request to remove everything, so a generated list that expands to nothing cannot silently drop an app's metadata; `annotations:clear`, `labels:clear` and `node-sysctls:clear` handle that case, taking the same optional filters as their report commands. The `--resource-type` flag and the app name are now validated on the set commands as well, where a typo previously exited zero and wrote a property that no report and no deploy ever read.
2026-09-18 05:14:51 -04:00
Jose Diaz-Gonzalez 55ffe6809b Merge pull request #9011 from visheshgubrani/scheduler-k3s-run-exit-code
Propagate command exit code on dokku run
2026-09-18 04:08:45 -04:00
Jose Diaz-Gonzalez be4689e771 Merge pull request #9049 from dokku/9043-config-set-reports-success-even-when-writing-the-env-file-fails
Report config write failures instead of exiting 0
2026-09-18 04:08:19 -04:00
Jose Diaz-Gonzalez ffa2991abf fix: reject negative process counts when scaling
A process count below zero was accepted and stored verbatim, leaving the scheduler to reject the value long after the command reported success. Counts below zero are now rejected, as are process tuples that omit a process type, across `ps:scale`, the `ps-set-scale` trigger and the `formation` key of `app.json`. A negative count persisted by an earlier version stays readable so it can be corrected with `ps:scale`.
2026-09-18 02:50:34 -04:00
Jose Diaz-Gonzalez 0c3ae47299 fix: report config write failures instead of exiting 0
`config:set`, `config:unset` and `config:clear` discarded the result of writing the app's environment, so a write that never landed still printed `Setting config vars`, still fired the `post-config-update` trigger, still restarted the app and still exited 0. The `config-set` and `config-unset` plugin triggers behaved the same way, which meant an `app.json` `env` block that could not be persisted deployed anyway with the variables missing. The environment is now staged in a temporary file and renamed into place, so a write that fails partway leaves the previous environment intact, and that file is created at `0600` rather than being created at `0644` and chmodded afterwards. `apps:clone` and `apps:rename` never applied that chmod at all and left the new app's environment world-readable.
2026-09-18 00:36:38 -04:00
Jose Diaz-Gonzalez 1ab7095016 Merge pull request #9033 from mvysny/fix/git-sync-build-record-leak
Discard the build record git:sync starts when nothing is built
2026-09-17 17:24:09 -04:00
Jose Diaz-Gonzalez 3f38478dca Merge pull request #9010 from visheshgubrani/8994-storage-mount-scheduler-mismatch
Reject scheduler mismatch at mount time
2026-09-14 23:26:04 -04:00
Martin VysnyandClaude Opus 5 dc27668e09 fix: discard the build record git:sync starts when nothing is built
cmd-git-sync calls dokku_setup_build_capture before the clone/fetch,
because it cannot know whether there is anything to deploy until it has
fetched. Both paths that then decline to build - a plain `git:sync` with
no build flag, and a `--build-if-changes` poll that finds the remote
unchanged - returned without ever finalizing that record.

The record stayed at status=running forever, which has three
consequences on an app polled on a timer:

- PruneAppBuilds only runs from builds-record-finalize, so nothing
  prunes the ticks while the app is idle; they accumulate without bound,
  invisibly, because builds:list caps output at the retention count.
- The next real deploy's ReapAbandonedBuilds finalizes each of them as
  status=failed, exit_code=-1, with finished_at stamped at the moment of
  reaping - indistinguishable on disk from a build that really failed,
  and with a duration that grew to the polling interval.
- That same deploy's prune then keeps the newest records by started_at,
  which after an idle stretch are the ticks, deleting the last real
  deploy's record and log.

Add a builds-record-discard trigger that removes a non-terminal record
and its log, and call it from both no-op paths in cmd-git-sync. The
trigger leaves missing and already-terminal records alone, so it can
never delete real history.

Fixes #9030

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 17:00:39 +03:00
Jose Diaz-Gonzalez b29bf2e6af Merge pull request #8975 from BetterAndBetterII/fix/caddy-is-app-listening-gate
Treat is_app_listening as a boolean, not a non-empty string
2026-09-05 20:08:37 -04:00
Vishesh 08147b5d93 fix(scheduler-k3s): propagate command exit code on dokku run 2026-09-04 22:35:35 +05:30
Vishesh 76cacdcda4 fix(storage): reject scheduler mismatch at mount time (#8994) 2026-09-03 20:20:32 +05:30
Jose Diaz-Gonzalez 96521de322 feat: distinct git:auth-status exit codes for netrc state
The `git:auth-status` command returned `1` both when a host had no `netrc` entry and when it had one that differed, so tooling wanting to tell a credential that would be created apart from one that would be replaced had to issue a second call with no username purely to find out which of the two it was. A host with no entry now exits `1`, a host whose entry differs from what was passed exits `2`, and invalid arguments exit `3`, leaving `0` to mean the stored state already matches. Called without a username the requested state is that no entry exists, so an existing entry is reported as `2` and `1` is never returned. Callers that only test zero versus non-zero are unaffected.
2026-09-02 18:07:19 -04:00
Jose Diaz-Gonzalez db45f8608b feat: add --clear and --replace flags to ps:scale
The `ps:scale` command merges the specified process types into the existing formation, so replacing an entire formation from the CLI required reading the current scale, diffing it, and issuing a second call to zero out each unlisted process type. The `--replace` flag treats the specified process types as the whole formation and sets the process count for every unspecified process type to zero, while the `--clear` flag resets the formation to the scale a newly created app has. The two flags cannot be combined, `--replace` requires at least one process type, and `--clear` accepts none. Process types cleared this way are now scaled down as part of the same command rather than being left running with a stale formation.
2026-09-02 14:55:16 -04:00
Jose Diaz-Gonzalez 326607e356 feat: add fingerprint and serial to certs:report
The report described an installed certificate without carrying anything that identified it, so the only exact way to tell whether an app was serving a given certificate was to pull the full PEM back with `certs:show` and compare bytes. That moves certificate material off the server on every check, and the same command with `key` returns the private key. The new `--ssl-fingerprint` and `--ssl-serial` flags answer the same question in a single report read that discloses nothing sensitive. The sample output in the ssl documentation has also been corrected to match what the command actually prints.
2026-09-02 03:56:02 -04:00
Yuzhong Zhang 50a90cade1 fix(caddy-vhosts): treat is_app_listening as a boolean, not a non-empty string
The docker-args-process-deploy trigger initialized is_app_listening to
the string "false" and then tested it with [[ -n ... ]], which is always
true. Apps with domains, tls-internal, and no http/https port mapping
got a stray caddy.tls=internal label.

Fixes #8973
2026-08-31 02:15:45 +00:00
Jose Diaz-Gonzalez a21145fc57 fix: validate k3s profile names against derived release name
`scheduler-k3s:profiles:add` accepted profile names it could not later derive a valid helm release name from, so a profile was created successfully and only failed on commands with no obvious relationship to it: `profiles:remove` could not delete the profile it created, and a single bad name broke every subsequent node sysctls change, including the global scope and unrelated profiles. Names are now refused at add time against the release name they derive rather than against the profile name alone, and the paths that have to cope with a profile stored before this check keep working instead of erroring.
2026-08-29 19:13:46 -04:00
Jose Diaz-Gonzalez 96d726c43c fix: retire cron containers past their active deadline
Cron containers were never reaped once they exceeded their active deadline, so a hung cron task ran indefinitely instead of being retired after 24 hours as documented. `cron:run` now also accepts a `--ttl-seconds` argument, matching the one `dokku run` already takes.
2026-08-12 13:11:34 -04:00
Jose Diaz-Gonzalez 81a929d768 fix: report traefik dns-provider env vars as global keys
The dynamic `dns-provider-*` properties were reported as `--traefik-dns-provider-<env_var>`, outside the `global`/`computed` namespace every other traefik property uses, so a consumer reading the json report could not tell which of the two a key represented. They are now reported as `--traefik-global-dns-provider-<env_var>`. The `basic-auth-password` property is a credential as well and is now masked in the default report output on the same terms as the dns provider values, meaning the raw value is returned only for `--format json` or when the flag is queried by name.
2026-08-12 03:22:04 -04:00
Jose Diaz-Gonzalez 25a5bacde9 docs: note the preserved ENV file can be deleted
The preserved copy holds everything the legacy file was not allowed to import, which includes keys that had been `config:unset` on purpose, so a revoked secret can outlive its revocation in a file `dokku config:*` no longer reads. Nothing said the copy was the operator's to remove once reviewed.
2026-08-11 19:11:06 -04:00
Jose Diaz-Gonzalez 685f16e6b1 fix: do not import an already-migrated ENV file
Releases 0.38.0 through 0.38.25 recorded the ENV file migration and deliberately left the file at the old path, so 0.38.26 treating a leftover file as a hand-edit replayed the environment as it stood at that upgrade over every `config:set` and `config:unset` made since, reinstating variables and secrets that had been deliberately unset. A file found at the old path once its migration is on record is no longer imported: it is removed when it agrees with the current config, and is otherwise moved aside to `ENV.migrated` with the keys it disagrees on named in a warning. That warning now reaches the operator during an upgrade rather than being swallowed, which is why the overwrite went unreported.
2026-08-10 17:58:10 -04:00