Commit Graph

4626 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
8282981361 feat: accept --global on :report subcommands
Every `:report` subcommand now recognizes `--global` as a scope selector that limits the report to globally-configured properties, including in JSON form via `--global --format json`. Previously this combination was rejected because `--global` was treated as an info flag, conflicting with `--format`. The shared `common.ParseReportArgs` helper now returns a `ReportArgs` struct exposing the parsed scope; each Go and bash report selects a global-only flag map when scope is global, and skips per-app verification.
2026-04-29 10:30:59 -04:00
Jose Diaz-Gonzalez
ec70e10c5d Merge pull request #8528 from dokku/6998-dokku-ps-retire-or-cron-job-trying-to-retire-running-app
Skip retiring images still in use by app containers
2026-04-29 10:28:18 -04:00
Jose Diaz-Gonzalez
63958b99ef Merge pull request #8537 from dokku/dependabot/go_modules/plugins/scheduler-k3s/github.com/traefik/traefik/v2-2.11.44
chore(deps): bump github.com/traefik/traefik/v2 from 2.11.43 to 2.11.44 in /plugins/scheduler-k3s
2026-04-29 10:26:16 -04:00
dependabot[bot]
3267cb2ac8 chore(deps): bump github.com/traefik/traefik/v2
Bumps [github.com/traefik/traefik/v2](https://github.com/traefik/traefik) from 2.11.43 to 2.11.44.
- [Release notes](https://github.com/traefik/traefik/releases)
- [Changelog](https://github.com/traefik/traefik/blob/v2.11.44/CHANGELOG.md)
- [Commits](https://github.com/traefik/traefik/compare/v2.11.43...v2.11.44)

---
updated-dependencies:
- dependency-name: github.com/traefik/traefik/v2
  dependency-version: 2.11.44
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-29 14:24:21 +00:00
Jose Diaz-Gonzalez
73238b7c97 Merge pull request #8524 from dokku/7827-pre-validate-the-nginx-conf-prior-to-starting-a-deploy
Pre-validate custom nginx.conf.sigil during core-post-extract
2026-04-29 08:47:56 -04:00
Jose Diaz-Gonzalez
3a7d74cdaa fix: ensure leading space when injecting --entrypoint launcher
The trigger output started with `--entrypoint` and relied on the caller
to provide a trailing space. `scheduler-deploy-process-container` does
that, but `scheduler-run` does not when `DOKKU_TRACE` is unset, so the
flag concatenated onto the previous arg as `--env=KEY--entrypoint`,
leaving `launcher` as the image positional argument and causing
`docker container create` to fail with `Unable to find image 'launcher:latest'`.
Match the leading-space convention used by the other docker-args triggers
(`config/docker-args-run`, `builder-herokuish/docker-args-run`).
2026-04-29 05:48:43 -04:00
Jose Diaz-Gonzalez
effa9d37cf fix: add launcher entrypoint for CNB images on dokku run and cron:run
The scheduler-run script classified CNB-based images as `herokuish` because
`is_image_herokuish_based` returns true for them, which caused the
`docker-args-process-run` trigger for builder-pack to skip injecting
`--entrypoint launcher`. Without that flag the container fell back to the
image entrypoint (`/cnb/process/web`) and dropped the user-supplied
arguments. Mirror the deploy-side detection so CNB images set
`IMAGE_SOURCE_TYPE=pack`, allowing the launcher entrypoint to be added.
2026-04-29 05:39:56 -04:00
Jose Diaz-Gonzalez
d88e8f137f fix: skip retiring images still in use by app containers
When ps:rebuild runs against an image-based deploy via git:from-image, the resulting image often shares the same SHA as the previous deployment, so retiring the old container's image would target the live image of the new container. The retirement is now skipped when another running container of the same app still references the image, and the cron retire loop self-heals previously stuck entries the next time it encounters them.
2026-04-29 05:36:04 -04:00
Jose Diaz-Gonzalez
ec7841a07b fix: inject placeholder listener for pre-validation upstream blocks
When pre-validating a custom nginx.conf.sigil before the build phase, no app listeners exist yet on first deploys. Templates that emit `proxy_pass http://app-port` while gating the matching upstream block on `DOKKU_APP_WEB_LISTENERS` render an undefined upstream, causing `nginx -t` to fail with "host not found in upstream". Pre-validation now passes a `127.0.0.1:5000` placeholder for `DOKKU_APP_WEB_LISTENERS` so the upstream block emits a static server entry and the template can be validated for syntax without depending on live listeners.
2026-04-29 05:12:05 -04:00
Jose Diaz-Gonzalez
63b809f64c feat: pre-validate custom nginx.conf.sigil during core-post-extract
Renders the user-supplied nginx.conf.sigil via sigil into a tmp file and runs `nginx -t` against a wrapped copy as soon as the template is extracted from the source tree, so syntactically invalid templates abort the deploy before the build phase runs. Skipped when `proxy-type` is not `nginx`, when `disable-custom-config=true`, or when no custom template was extracted. Closes #7827.
2026-04-29 05:01:25 -04:00
Jose Diaz-Gonzalez
9b6c32f39c Merge pull request #8516 from dokku/2441-process-scoped-docker-options
Scope docker-options to specific procfile processes
2026-04-29 04:45:23 -04:00
Jose Diaz-Gonzalez
9a795fcf91 test: cover migration via go unit test
The bats test for migration idempotency invoked the install binary directly via sudo, which kept hitting fresh missing env vars on each iteration (DOKKU_LIB_ROOT, then PLUGIN_PATH, etc). The dokku launcher script exports a chain of vars that the install path reads via common.MustGetEnv, and mirroring that chain in a bats test is fragile. Migration is pure file IO plus a property marker - perfect for a Go unit test that isolates itself with t.TempDir and t.Setenv. The new test covers parsing comments and blank lines, the marker-based no-op on re-run, and the rule that a manually re-created legacy file is left untouched after the marker is set.
2026-04-29 03:14:17 -04:00
Jose Diaz-Gonzalez
d51726b7cb Merge pull request #8522 from dokku/fix-keda-scaling
Only emit keda fallback when a non-cpu/memory trigger exists
2026-04-29 02:27:03 -04:00
Jose Diaz-Gonzalez
177eac4ef1 Merge pull request #8517 from dokku/6833-send-sigterm-immediately-to-old-containers-when-deploying-via-docker-local
Send SIGTERM to old containers immediately on deploy
2026-04-29 01:50:35 -04:00
Jose Diaz-Gonzalez
f728fc8cd7 fix: only emit keda fallback when a non-cpu/memory trigger exists
Keda 2.17+ rejects ScaledObjects whose spec.fallback is set unless at least one trigger is not a cpu or memory scaler, so unconditionally emitting fallback broke deploys for apps autoscaled on cpu or memory alone. The chart now skips the fallback block when every configured trigger is cpu or memory and keeps the existing behavior otherwise.
2026-04-29 01:10:34 -04:00
Jose Diaz-Gonzalez
8a6c853ccd Merge pull request #8515 from dokku/fix-vector-data-dir
Fix vector mount directory config
2026-04-29 00:36:40 -04:00
Jose Diaz-Gonzalez
97b86707e7 fix: docker-options:list flag parsing and ci test fixes
The :list subcommand had `SetInterspersed(false)` which forced flags to come before positional arguments; in practice users invoke it as `docker-options:list <app> --process X --phase Y`. Drop the non-interspersed setting so flags can appear after the app name. Two existing buildpacks/dockerfile tests appended directly to the legacy `DOCKER_OPTIONS_DEPLOY` file - that path is no longer the source of truth, so switch them to `docker-options:add`. The new migration test invoked `dokku plugin:trigger install` which fans out to every plugin and trips on unrelated permission errors; call the docker-options install binary directly instead. Tighten the report and JSON assertions to match the actual output format (`.` becomes a space in the display key, and JSON values may concatenate options).
2026-04-29 00:35:26 -04:00
Jose Diaz-Gonzalez
1161dda05e feat: send SIGTERM to old containers immediately on deploy
The docker-local scheduler now sends `SIGTERM` to old containers immediately after a successful deploy via `docker container kill --signal=SIGTERM`, rather than waiting `wait-to-retire` seconds before signaling. This matches Heroku's graceful-shutdown contract and lets applications begin draining in-flight work as soon as proxy traffic switches. The existing `wait-to-retire` grace period and `stop-timeout-seconds` hard-stop continue to apply unchanged as the authoritative cleanup path.
2026-04-27 18:18:39 -04:00
Jose Diaz-Gonzalez
9c8d5f54fb feat: scope docker-options to specific procfile processes
Adds a `--process` flag (repeatable) to docker-options:add/remove/clear/list and the new docker-options:list subcommand for querying a single process+phase pair. Process scoping is supported only for the deploy phase since build runs once per app and run covers ad-hoc commands and cron tasks where no Procfile process type is available. Storage moves from `$DOKKU_ROOT/$APP/DOCKER_OPTIONS_*` files to property lists under `/var/lib/dokku/config/docker-options/$APP/{processType}.{phase}`, with `_default_` as the sentinel for app-wide options. The install trigger migrates pre-existing DOCKER_OPTIONS_* files into property lists once and renames them to `.migrated`; a global marker makes re-runs strictly no-op. The legacy docker-args-{build,deploy,run} bash triggers are reimplemented in Go alongside a new docker-args-process-deploy trigger that surfaces per-process options to the scheduler. The :report command exposes one dynamic flag per configured `process.deploy` pair (e.g. `--docker-options-deploy.web`) and supports `--format json`. There is no `--global` flag; omitting `--process` keeps the historical default behaviour, since `--global` elsewhere in dokku means "across all apps". Closes #2441.
2026-04-27 18:12:52 -04:00
Jose Diaz-Gonzalez
c0f23528af fix: just use an emptyDir
Let vector decide how to handle the directory.
2026-04-27 17:53:23 -04:00
Jose Diaz-Gonzalez
f19227dcd9 Merge pull request #8514 from dokku/migrate-docker-options-to-go
Migrate docker-options subcommands to go
2026-04-27 17:29:22 -04:00
Jose Diaz-Gonzalez
8e7d158ac2 chore: revert transforms changes 2026-04-27 16:06:45 -04:00
Jose Diaz-Gonzalez
5dcefe7ffa fix: use extraVolumeMount just for the vector state 2026-04-27 16:06:07 -04:00
Jose Diaz-Gonzalez
87dd39e0b3 refactor: collect docker-options file helpers in functions.go
Moves `copyPhaseFile` and `removePhaseFile` next to the other phase-file helpers so the package keeps a single home for filesystem plumbing.
2026-04-27 15:58:40 -04:00
Jose Diaz-Gonzalez
eaaf0e41c2 fix: clear auto-detected port maps when re-enabling vhost
Re-enabling vhost on an app that was previously deployed with no global VHOST left the auto-assigned random high port behind in the ports plugin's `map-detected` property, so nginx kept listening on that port and the new catch-all default vhost rejected requests for the app's own domain on port 80.
2026-04-27 15:43:33 -04:00
Jose Diaz-Gonzalez
af6267f3b5 fix: restore default domains and reset proxy ports on vhost enable
Re-enabling vhost (via `proxy:enable`, `domains:enable`, or `domains:add` with no global VHOST) was leaving the app pinned to the random high port and the empty VHOST file from the previous disabled state, so the new catch-all vhost intercepted requests for the app's domain. The `domains-enable` trigger now restores default vhosts via `domains_enable`, and `pre-enable-vhost` clears any stored proxy ports so they can be recomputed to 80/443. Also fixes the netrc lookup in the `git:auth` test to read dokku's netrc file directly.
2026-04-27 14:43:20 -04:00
Jose Diaz-Gonzalez
d7c88ae298 feat: ship default catch-all site on fresh apt install
Fresh apt installs now drop a catch-all server block at `/etc/nginx/conf.d/00-default-vhost.conf` that uses `ssl_reject_handshake on` and `return 444` to drop requests with unknown Host headers. Conflicting upstream nginx default vhosts are renamed to `*.dokku-disabled` rather than deleted, preserving any local edits. The new `dokku/install_default_site` debconf flag opts out of the install. Upgrades leave existing nginx config untouched.
2026-04-27 14:43:20 -04:00
Jose Diaz-Gonzalez
a4f26a356a feat: add nginx:reload command
Reloads the nginx server config after validating it with `nginx -t`. Useful for picking up changes to globally managed nginx configs without restarting the running process.
2026-04-27 14:43:20 -04:00
Jose Diaz-Gonzalez
099c358a1e fix: set the defaultVolumeMounts instead of using extraVolumeMounts
Without this, the daemonset will inject customConfig.data_dir as a default mount, which will collide with extraVolumeMounts.
2026-04-27 14:27:05 -04:00
Jose Diaz-Gonzalez
4eb42f1b82 refactor: migrate docker-options subcommands to go
Ports the user-facing CLI subcommands and lifecycle triggers from bash to go, mirroring the layout used by the ports plugin. The on-disk format (`DOCKER_OPTIONS_BUILD/DEPLOY/RUN` files), the `docker-args-build/deploy/run` triggers, and every exported helper consumed by other plugins are unchanged. Reserves the `--process` and `--global` flags on add, remove, and clear so usage today exits with a not-yet-implemented error and the surface is locked in ahead of the process-scoping work tracked in #2441.
2026-04-27 14:11:37 -04:00
Jose Diaz-Gonzalez
da13367ca8 feat: add version-aware helm chart upgrade callbacks
Some helm chart upgrades require side-effects that a plain `helm upgrade` cannot perform, such as deleting deployments whose immutable selectors changed. Charts may now register pre and post upgrade hooks against a target version; applicable hooks fire in ascending semver order, each bracketed around an upgrade to its version, with a final upgrade to the chart's configured version when needed. The new `keda-add-ons-http` 0.12.2 hook deletes the chart-managed deployments before the upgrade so the new selectors take effect cleanly.
2026-04-27 07:57:38 -04:00
Jose Diaz-Gonzalez
db1308a2ab feat: upgrade keda to 2.19.0 and keda-add-ons-http to 0.12.2
While there are breaking changes in the addon, none of these impact how Dokku exposes the addon.
2026-04-27 07:32:38 -04:00
Jose Diaz-Gonzalez
b92310c4c8 Merge pull request #8508 from dokku/8230-renaming-app-clears-the-set-domain
Preserve all domains when renaming an app
2026-04-27 07:19:48 -04:00
Jose Diaz-Gonzalez
4927ca092d fix: retire orphaned containers when scaling down
When scaling a process type to a smaller count, the indices above the
new count had their `CONTAINER.<proctype>.<idx>` state files deleted but
the underlying Docker containers were never registered for retirement,
so they remained running indefinitely. The cleanup block now reads each
orphaned state file and registers its container id with the existing
`scheduler-register-retired` trigger before the file is removed.
2026-04-27 03:23:15 -04:00
Jose Diaz-Gonzalez
e54fcc4035 Merge pull request #6716 from dokku/1558-move-env
Move app and global ENV files to consolidated config path
2026-04-27 02:50:24 -04:00
Jose Diaz-Gonzalez
c2a07c3f1c fix: preserve all domains when renaming an app
The `post-app-rename-setup` trigger redirected `sed` output to the new
app's VHOST file inside a loop over global vhosts, so each iteration
clobbered the previous one and only the last global subdomain was
rewritten. When no global vhost was set, the loop never ran and the
new app's VHOST file was never written, leaving the renamed app with
no domains.

Copy the old app's VHOST file once as a baseline, then apply `sed -i`
in place for each global vhost so substitutions accumulate. Guard
against a missing global VHOST file and skip blank lines.
2026-04-27 01:47:50 -04:00
Jose Diaz-Gonzalez
8847fcb6b0 Merge pull request #8505 from dokku/8504-git-auth-status
Add git:auth-status to check netrc match
2026-04-27 01:25:46 -04:00
Jose Diaz-Gonzalez
aa45f748b1 fix: create DOKKU_ROOT app dir in Go tests and set global ENV permissions
- config_test.go: create app dir at DOKKU_ROOT for VerifyAppName and
  ensure global config parent directory exists
- migrateGlobalEnv: set dokku:dokku ownership on global ENV file after
  writing so deploy processes running as dokku can read it
2026-04-27 01:06:32 -04:00
Jose Diaz-Gonzalez
c3db713c27 fix: ensure app ENV directory exists at DOKKU_LIB_ROOT/config/{app}
The post-create trigger only created the property directory at
DOKKU_LIB_ROOT/config/config/{app}/, but getAppFile() writes the
ENV file to DOKKU_LIB_ROOT/config/{app}/ENV. Add setupAppConfigDir
to create and permission the ENV directory in both post-create and
install triggers, and clean it up on post-delete.
2026-04-27 01:06:32 -04:00
Jose Diaz-Gonzalez
17c549ee63 fix: run global env migration before listing apps and set DOKKU_LIB_ROOT in tests
- Move migrateGlobalEnv() before UnfilteredDokkuApps() so the global
  config directory is created even on fresh installs with no apps
- Add DOKKU_LIB_ROOT to Go test env vars in tests.mk
2026-04-27 01:06:32 -04:00
Jose Diaz-Gonzalez
d846324fd5 fix: correct global env path, migration join, and test app dirs
- Use DOKKU_LIB_ROOT instead of DOKKU_ROOT in getGlobalFile() to match
  the intended new config path layout
- Add missing comma in filepath.Join for old app ENV migration path
- Revert common_test.go app dirs to DOKKU_ROOT since app detection
  still uses AppRoot()
2026-04-27 01:06:32 -04:00
Jose Diaz-Gonzalez
30e4123949 fix: migrate global env vars 2026-04-27 01:06:31 -04:00
Jose Diaz-Gonzalez
81e6cdf5a5 fix: ensure config properties for an app are setup prior to usage 2026-04-27 01:06:31 -04:00
Jose Diaz-Gonzalez
f2f6e0b473 refactor: move the env files to the new path on upgrade
Refs #1558
2026-04-27 01:06:29 -04:00
Jose Diaz-Gonzalez
38c6b180af fix: reference env from config dir 2026-04-27 01:05:41 -04:00
Jose Diaz-Gonzalez
365e300eb6 Merge pull request #8506 from dokku/8499-add-format-json-support-to-nginx-report-and-git-report
Add --format json to git:report and nginx:report
2026-04-27 01:04:52 -04:00
Jose Diaz-Gonzalez
66c4b3b30e feat: add --format json to git:report and nginx:report
Mirrors the JSON output convention already used by scheduler:report, builder:report, network:report, and traefik:report. Both plugins now accept `--format json` to emit a single-line JSON object whose keys are the property names with the plugin prefix stripped. Combining `--format` with an info flag is rejected with an error message that matches the Go-based report helper.

Closes #8499
2026-04-26 23:30:22 -04:00
Jose Diaz-Gonzalez
65bdbefbea feat: add git:auth-status to check netrc match
Adds `git:auth-status HOST [USERNAME] [PASSWORD]` which exits 0 when the
configured `.netrc` entry matches the requested state and 1 otherwise,
allowing external tooling to detect whether `git:auth` would change
anything without reading `$DOKKU_ROOT/.netrc` directly. Both `git:auth`
and `git:auth-status` now also accept the password via `STDIN`.
2026-04-26 23:10:30 -04:00
Jose Diaz-Gonzalez
34c336c668 feat: add post-create support for env key in app.json
Closes #4498
2026-04-26 22:43:32 -04:00
dependabot[bot]
ef51f1f942 chore(deps): bump k8s.io/kubernetes in /plugins/scheduler-k3s
Bumps [k8s.io/kubernetes](https://github.com/kubernetes/kubernetes) from 1.35.4 to 1.36.0.
- [Release notes](https://github.com/kubernetes/kubernetes/releases)
- [Commits](https://github.com/kubernetes/kubernetes/compare/v1.35.4...v1.36.0)

---
updated-dependencies:
- dependency-name: k8s.io/kubernetes
  dependency-version: 1.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-26 12:15:40 -04:00