From 76b033234f16738c94cb503e73be08656dca387f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 13 May 2026 16:39:38 -0400 Subject: [PATCH] fix: split report global keys into raw and computed across plugins The `-global-` keys in `:report` output returned the resolved value with the built-in default substituted in, so external tooling could not distinguish a property that had been set globally to the default from one that had never been set. The bare keys for caddy, haproxy, and traefik global-only properties had the same shape. The `global-` keys now hold the raw stored value and are empty when nothing has been set, and a new `computed-` key holds the effective value used at runtime, falling back through the per-app value (where one exists), the global value, and the built-in default. The bare global-only keys for the three proxy plugins are removed in favor of the raw/computed pair. Closes #8631. --- docs/advanced-usage/deployment-tasks.md | 10 +- docs/appendices/0.38.0-migration-guide.md | 1 + .../builders/cloud-native-buildpacks.md | 10 +- docs/deployment/builders/dockerfiles.md | 10 +- .../builders/herokuish-buildpacks.md | 10 +- docs/deployment/builders/lambda.md | 10 +- docs/deployment/builders/nixpacks.md | 10 +- docs/deployment/builders/railpack.md | 10 +- docs/deployment/methods/git.md | 11 +- .../schedulers/scheduler-management.md | 10 +- docs/deployment/zero-downtime-deploys.md | 14 +- docs/networking/network.md | 18 +- docs/networking/proxies/caddy.md | 60 +++--- docs/networking/proxies/haproxy.md | 30 ++- docs/networking/proxies/traefik.md | 90 +++++---- docs/networking/proxy-management.md | 20 +- plugins/app-json/report.go | 8 +- plugins/builder-dockerfile/internal-functions | 6 +- plugins/builder-herokuish/internal-functions | 11 +- plugins/builder-lambda/internal-functions | 6 +- plugins/builder-nixpacks/internal-functions | 6 +- plugins/builder-pack/internal-functions | 6 +- plugins/builder-railpack/internal-functions | 6 +- plugins/caddy-vhosts/certs-force | 2 +- plugins/caddy-vhosts/command-functions | 31 ++- .../caddy-vhosts/docker-args-process-deploy | 2 +- plugins/caddy-vhosts/internal-functions | 75 ++++++-- plugins/checks/internal-functions | 6 +- plugins/git/internal-functions | 21 +- plugins/haproxy-vhosts/certs-force | 2 +- plugins/haproxy-vhosts/command-functions | 15 +- .../haproxy-vhosts/docker-args-process-deploy | 2 +- plugins/haproxy-vhosts/internal-functions | 70 +++++-- plugins/logs/functions.go | 2 +- plugins/logs/report.go | 22 ++- plugins/network/report.go | 16 +- plugins/proxy/functions.go | 5 +- plugins/proxy/report.go | 10 +- .../scheduler-docker-local/internal-functions | 12 +- plugins/scheduler/report.go | 8 +- plugins/traefik-vhosts/certs-force | 2 +- plugins/traefik-vhosts/command-functions | 45 +++-- .../traefik-vhosts/docker-args-process-deploy | 6 +- plugins/traefik-vhosts/internal-functions | 181 ++++++++++++++---- tests/unit/app-json.bats | 4 +- tests/unit/archive-security.bats | 18 ++ tests/unit/builder-dockerfile.bats | 20 +- tests/unit/caddy.bats | 62 +++++- tests/unit/checks.bats | 51 +++-- tests/unit/git_1.bats | 54 ++++++ tests/unit/git_3.bats | 20 +- tests/unit/haproxy.bats | 45 ++++- tests/unit/network.bats | 41 ++++ tests/unit/proxy.bats | 48 +++++ tests/unit/scheduler-docker-local.bats | 22 ++- tests/unit/traefik.bats | 72 ++++++- 56 files changed, 1031 insertions(+), 334 deletions(-) diff --git a/docs/advanced-usage/deployment-tasks.md b/docs/advanced-usage/deployment-tasks.md index cf4907350..1c278a803 100644 --- a/docs/advanced-usage/deployment-tasks.md +++ b/docs/advanced-usage/deployment-tasks.md @@ -101,18 +101,20 @@ dokku app-json:report ``` =====> node-js-app app-json information App-json computed appjson path: app2.json - App-json global appjson path: app.json + App-json global appjson path: App-json appjson path: app2.json =====> python-sample app-json information App-json computed appjson path: app.json - App-json global appjson path: app.json + App-json global appjson path: App-json appjson path: =====> ruby-sample app-json information App-json computed appjson path: app.json - App-json global appjson path: app.json + App-json global appjson path: App-json appjson path: ``` +The `appjson-path` and `global-appjson-path` keys hold the raw per-app and global value respectively, and are empty when nothing has been set. The `computed-appjson-path` key holds the effective value used at deploy time, falling back to the global value (where one has been set) and then to the built-in default of `app.json`. + You can run the command for a specific app also. ```shell @@ -122,7 +124,7 @@ dokku app-json:report node-js-app ``` =====> node-js-app app-json information App-json computed appjson path: app2.json - App-json global appjson path: app.json + App-json global appjson path: App-json appjson path: app2.json ``` diff --git a/docs/appendices/0.38.0-migration-guide.md b/docs/appendices/0.38.0-migration-guide.md index 6b01d0620..bd1f3f426 100644 --- a/docs/appendices/0.38.0-migration-guide.md +++ b/docs/appendices/0.38.0-migration-guide.md @@ -21,6 +21,7 @@ - The `docker-local` scheduler now sends `SIGTERM` to old containers immediately after a successful deploy, 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 `wait-to-retire` grace period and `stop-timeout-seconds` hard-stop continue to apply as before. See the [zero downtime deploys documentation](/docs/deployment/zero-downtime-deploys.md#wait-to-retire) for more details. - The `docker-local` scheduler no longer queues an image for retirement when another running container of the same app still uses it. This fixes the case where a `ps:rebuild` against an image-based deploy (`git:from-image`) produced an identical-SHA image and the `dokku-retire` cron timer would log `Image ... has running containers, skipping rm` on every run. Stuck entries from prior versions are pruned automatically on the next `ps:retire` run. - All `:report` subcommands now accept the `--global` flag, which scopes the report to globally-configured properties. The flag composes with `--format json`, so a JSON report of global properties can be obtained via, for example, `dokku scheduler:report --global --format json`. Previously, combining `--global` with `--format json` was rejected with an "info flag" error, and `--global` on its own was treated as an unknown flag. +- Every `:report` key of the form `-global-` now returns the raw stored global value (empty when the property has never been set) instead of the resolved value with the built-in default substituted in. A new `-computed-` key has been added wherever a default existed and returns the effective value (per-app value, falling back to the global value, then to the built-in default). This affects `caddy`, `haproxy`, `traefik`, `app-json`, `builder-dockerfile`, `builder-herokuish`, `builder-lambda`, `builder-nixpacks`, `builder-pack`, `builder-railpack`, `checks`, `git`, `logs`, `network`, `proxy`, and `scheduler`. External tooling that read `-global-` and depended on the default value should switch to `-computed-`. The bare `-` keys for caddy/haproxy/traefik global-only properties (`caddy-image`, `haproxy-log-level`, `traefik-api-enabled`, etc.) have also been replaced by the `global-` and `computed-` pair. - The `scheduler-k3s` plugin now manages env config and the dokku-generated image pull Secret as their own helm releases with stable names (`config-{app}` and `pull-secret-{app}`) rather than bundling them into the app helm chart with a per-deploy timestamp suffix (`env-{app}.{ts}` / `ims-{app}.{ts}`). This fixes two bugs: a helm rollback of the app chart no longer deletes Secrets that older ReplicaSets still reference, and the Deployment's `imagePullSecrets` list no longer accumulates references to nonexistent Secrets across deploys. The next deploy of an app switches the Deployment's `envFrom` and `imagePullSecrets` references to the stable names and prunes any leaked entries; existing live Deployments do not need to be patched manually. App rename now also uninstalls the old `tls-{app}`, `config-{app}`, and `pull-secret-{app}` releases under the previous app name; the new name's releases are recreated on the next deploy or certs sync. - The storage plugin now treats persistent volumes as named, scheduler-aware first-class resources via `storage:create`, `storage:mount`, `storage:set`, and `storage:destroy`. The legacy `storage:mount :` colon form continues to work on docker-local apps but is deprecated; on k3s apps it is rejected. Existing colon-form mounts are migrated automatically the first time the new storage plugin runs (during the install trigger) - they appear as `legacy-` entries in `storage:list-entries`. The migration is idempotent and tied to a per-app flag file at `$DOKKU_LIB_ROOT/config/storage/.migrated/`; deleting that file forces a re-scan on the next install. The `storage:ensure-directory` command keeps working but now emits a deprecation warning - prefer `storage:create []` (the path defaults to the same `$DOKKU_LIB_ROOT/data/storage/` location). Storage entry names must now be DNS-1123 labels of 45 characters or less so they can be used verbatim as Helm release and Kubernetes resource names; underscores and uppercase characters that the older `ensure-directory` validator accepted are rejected for new names. The migration synthesizer always uses lowercase hex hashes so existing data is never locked out. diff --git a/docs/deployment/builders/cloud-native-buildpacks.md b/docs/deployment/builders/cloud-native-buildpacks.md index f6a3ebb83..bc4e0f988 100644 --- a/docs/deployment/builders/cloud-native-buildpacks.md +++ b/docs/deployment/builders/cloud-native-buildpacks.md @@ -98,18 +98,20 @@ dokku builder-pack:report ``` =====> node-js-app builder-pack information Builder pack computed projecttoml path: project2.toml - Builder pack global projecttoml path: project.toml + Builder pack global projecttoml path: Builder pack projecttoml path: project2.toml =====> python-sample builder-pack information Builder pack computed projecttoml path: project.toml - Builder pack global projecttoml path: project.toml + Builder pack global projecttoml path: Builder pack projecttoml path: =====> ruby-sample builder-pack information Builder pack computed projecttoml path: project.toml - Builder pack global projecttoml path: project.json + Builder pack global projecttoml path: Builder pack projecttoml path: ``` +The `projecttoml-path` and `global-projecttoml-path` keys hold the raw per-app and global value respectively, and are empty when nothing has been set. The `computed-projecttoml-path` key holds the effective value used at build time, falling back to the global value (where one has been set) and then to the built-in default of `project.toml`. + You can run the command for a specific app also. ```shell @@ -119,7 +121,7 @@ dokku builder-pack:report node-js-app ``` =====> node-js-app builder-pack information Builder pack computed projecttoml path: project2.toml - Builder pack global projecttoml path: project.toml + Builder pack global projecttoml path: Builder pack projecttoml path: project2.toml ``` diff --git a/docs/deployment/builders/dockerfiles.md b/docs/deployment/builders/dockerfiles.md index eb8ac066e..b45513e21 100644 --- a/docs/deployment/builders/dockerfiles.md +++ b/docs/deployment/builders/dockerfiles.md @@ -82,18 +82,20 @@ dokku builder-dockerfile:report ``` =====> node-js-app builder-dockerfile information Builder dockerfile computed dockerfile path: Dockerfile2 - Builder dockerfile global dockerfile path: Dockerfile + Builder dockerfile global dockerfile path: Builder dockerfile dockerfile path: Dockerfile2 =====> python-sample builder-dockerfile information Builder dockerfile computed dockerfile path: Dockerfile - Builder dockerfile global dockerfile path: Dockerfile + Builder dockerfile global dockerfile path: Builder dockerfile dockerfile path: =====> ruby-sample builder-dockerfile information Builder dockerfile computed dockerfile path: Dockerfile - Builder dockerfile global dockerfile path: Dockerfile + Builder dockerfile global dockerfile path: Builder dockerfile dockerfile path: ``` +The `dockerfile-path` and `global-dockerfile-path` keys hold the raw per-app and global value respectively, and are empty when nothing has been set. The `computed-dockerfile-path` key holds the effective value used at deploy time, falling back to the global value (where one has been set) and then to the built-in default of `Dockerfile`. + You can run the command for a specific app also. ```shell @@ -103,7 +105,7 @@ dokku builder-dockerfile:report node-js-app ``` =====> node-js-app builder-dockerfile information Builder dockerfile computed dockerfile path: Dockerfile2 - Builder dockerfile global dockerfile path: Dockerfile + Builder dockerfile global dockerfile path: Builder dockerfile dockerfile path: Dockerfile2 ``` diff --git a/docs/deployment/builders/herokuish-buildpacks.md b/docs/deployment/builders/herokuish-buildpacks.md index dfaedfbd2..10708b19c 100644 --- a/docs/deployment/builders/herokuish-buildpacks.md +++ b/docs/deployment/builders/herokuish-buildpacks.md @@ -117,18 +117,20 @@ dokku builder-herokuish:report ``` =====> node-js-app builder-herokuish information Builder herokuish computed allowed: false - Builder herokuish global allowed: true + Builder herokuish global allowed: Builder herokuish allowed: false =====> python-sample builder-herokuish information Builder herokuish computed allowed: true - Builder herokuish global allowed: true + Builder herokuish global allowed: Builder herokuish allowed: =====> ruby-sample builder-herokuish information Builder herokuish computed allowed: true - Builder herokuish global allowed: true + Builder herokuish global allowed: Builder herokuish allowed: ``` +The `allowed` and `global-allowed` keys hold the raw per-app and global value respectively, and are empty when nothing has been set. The `computed-allowed` key holds the effective value used at build time, falling back to the global value (where one has been set) and then to the built-in default (`true` on amd64, `false` otherwise). + You can run the command for a specific app also. ```shell @@ -138,7 +140,7 @@ dokku builder-herokuish:report node-js-app ``` =====> node-js-app builder-herokuish information Builder herokuish computed allowed: false - Builder herokuish global allowed: true + Builder herokuish global allowed: Builder herokuish allowed: false ``` diff --git a/docs/deployment/builders/lambda.md b/docs/deployment/builders/lambda.md index 48e8a27bd..a03629f9f 100644 --- a/docs/deployment/builders/lambda.md +++ b/docs/deployment/builders/lambda.md @@ -84,18 +84,20 @@ dokku builder-lambda:report ``` =====> node-js-app builder-lambda information Builder lambda computed lambdayml path: lambda2.yml - Builder lambda global lambdayml path: lambda.yml + Builder lambda global lambdayml path: Builder lambda lambdayml path: lambda2.yml =====> python-sample builder-lambda information Builder lambda computed lambdayml path: lambda.yml - Builder lambda global lambdayml path: lambda.yml + Builder lambda global lambdayml path: Builder lambda lambdayml path: =====> ruby-sample builder-lambda information Builder lambda computed lambdayml path: lambda.yml - Builder lambda global lambdayml path: lambda.yml + Builder lambda global lambdayml path: Builder lambda lambdayml path: ``` +The `lambdayml-path` and `global-lambdayml-path` keys hold the raw per-app and global value respectively, and are empty when nothing has been set. The `computed-lambdayml-path` key holds the effective value used at build time, falling back to the global value (where one has been set) and then to the built-in default of `lambda.yml`. + You can run the command for a specific app also. ```shell @@ -105,7 +107,7 @@ dokku builder-lambda:report node-js-app ``` =====> node-js-app builder-lambda information Builder lambda computed lambdayml path: lambda2.yml - Builder lambda global lambdayml path: lambda.yml + Builder lambda global lambdayml path: Builder lambda lambdayml path: lambda2.yml ``` diff --git a/docs/deployment/builders/nixpacks.md b/docs/deployment/builders/nixpacks.md index 945b424c3..ff6cbd7c4 100644 --- a/docs/deployment/builders/nixpacks.md +++ b/docs/deployment/builders/nixpacks.md @@ -97,18 +97,20 @@ dokku builder-nixpacks:report ``` =====> node-js-app builder-nixpacks information Builder-nixpacks computed nixpackstoml path: nixpacks2.toml - Builder-nixpacks global nixpackstoml path: nixpacks.toml + Builder-nixpacks global nixpackstoml path: Builder-nixpacks nixpackstoml path: nixpacks2.toml =====> python-sample builder-nixpacks information Builder-nixpacks computed nixpackstoml path: nixpacks.toml - Builder-nixpacks global nixpackstoml path: nixpacks.toml + Builder-nixpacks global nixpackstoml path: Builder-nixpacks nixpackstoml path: =====> ruby-sample builder-nixpacks information Builder-nixpacks computed nixpackstoml path: nixpacks.toml - Builder-nixpacks global nixpackstoml path: nixpacks.toml + Builder-nixpacks global nixpackstoml path: Builder-nixpacks nixpackstoml path: ``` +The `nixpackstoml-path` and `global-nixpackstoml-path` keys hold the raw per-app and global value respectively, and are empty when nothing has been set. The `computed-nixpackstoml-path` key holds the effective value used at build time, falling back to the global value (where one has been set) and then to the built-in default of `nixpacks.toml`. + You can run the command for a specific app also. ```shell @@ -118,7 +120,7 @@ dokku builder-nixpacks:report node-js-app ``` =====> node-js-app builder-nixpacks information Builder-nixpacks computed nixpackstoml path: nixpacks2.toml - Builder-nixpacks global nixpackstoml path: nixpacks.toml + Builder-nixpacks global nixpackstoml path: Builder-nixpacks nixpackstoml path: nixpacks2.toml ``` diff --git a/docs/deployment/builders/railpack.md b/docs/deployment/builders/railpack.md index 6ee0b2cc6..184ade8c2 100644 --- a/docs/deployment/builders/railpack.md +++ b/docs/deployment/builders/railpack.md @@ -106,18 +106,20 @@ dokku builder-railpack:report ``` =====> node-js-app builder-railpack information Builder-railpack computed railpackjson path: railpack2.json - Builder-railpack global railpackjson path: railpack.json + Builder-railpack global railpackjson path: Builder-railpack railpackjson path: railpack2.json =====> python-sample builder-railpack information Builder-railpack computed railpackjson path: railpack.json - Builder-railpack global railpackjson path: railpack.json + Builder-railpack global railpackjson path: Builder-railpack railpackjson path: =====> ruby-sample builder-railpack information Builder-railpack computed railpackjson path: railpack.json - Builder-railpack global railpackjson path: railpack.json + Builder-railpack global railpackjson path: Builder-railpack railpackjson path: ``` +The `railpackjson-path` and `global-railpackjson-path` keys hold the raw per-app and global value respectively, and are empty when nothing has been set. The `computed-railpackjson-path` key holds the effective value used at build time, falling back to the global value (where one has been set) and then to the built-in default of `railpack.json`. + You can run the command for a specific app also. ```shell @@ -127,7 +129,7 @@ dokku builder-railpack:report node-js-app ``` =====> node-js-app builder-railpack information Builder-railpack computed railpackjson path: railpack2.json - Builder-railpack global railpackjson path: railpack.json + Builder-railpack global railpackjson path: Builder-railpack railpackjson path: railpack2.json ``` diff --git a/docs/deployment/methods/git.md b/docs/deployment/methods/git.md index bc7ce87f3..97361a23e 100644 --- a/docs/deployment/methods/git.md +++ b/docs/deployment/methods/git.md @@ -281,12 +281,15 @@ dokku git:report ``` =====> node-js-app git information + Git computed archive max files: 10000 + Git computed archive max size: 1073741824 Git computed deploy branch: master Git computed keep git dir: false Git deploy branch: - Git global archive max files: 10000 - Git global archive max size: 1073741824 - Git global deploy branch: master + Git global archive max files: + Git global archive max size: + Git global deploy branch: + Git global keep git dir: Git keep git dir: Git rev env var: GIT_REV Git sha: a1b2c3d @@ -294,7 +297,7 @@ dokku git:report Git last updated at: 1700000000 ``` -The `deploy-branch` and `keep-git-dir` keys hold the raw per-app value and are empty when nothing has been set on the app. The `computed-deploy-branch` and `computed-keep-git-dir` keys hold the effective value used at deploy time, falling back to the corresponding global value (where one exists) and then to the built-in default. +The bare per-app keys (`deploy-branch`, `keep-git-dir`) and the `global-` keys hold the raw per-app or global value respectively, and are empty when nothing has been set. The `computed-` keys hold the effective value used at deploy time, falling back to the global value (where one has been set) and then to the built-in default. You can run the command for a specific app also. diff --git a/docs/deployment/schedulers/scheduler-management.md b/docs/deployment/schedulers/scheduler-management.md index 27ed1fedc..5726e1cc5 100644 --- a/docs/deployment/schedulers/scheduler-management.md +++ b/docs/deployment/schedulers/scheduler-management.md @@ -80,14 +80,16 @@ dokku scheduler:report Scheduler selected: herokuish =====> python-sample scheduler information Scheduler computed selected: dockerfile - Scheduler global selected: herokuish + Scheduler global selected: Scheduler selected: dockerfile =====> ruby-sample scheduler information - Scheduler computed selected: herokuish - Scheduler global selected: herokuish + Scheduler computed selected: docker-local + Scheduler global selected: Scheduler selected: ``` +The `selected` and `global-selected` keys hold the raw per-app and global value respectively, and are empty when nothing has been set. The `computed-selected` key holds the effective value used at deploy time, falling back to the global value (where one has been set) and then to the built-in default of `docker-local`. + You can run the command for a specific app also. ```shell @@ -96,6 +98,8 @@ dokku scheduler:report node-js-app ``` =====> node-js-app scheduler information + Scheduler computed selected: herokuish + Scheduler global selected: Scheduler selected: herokuish ``` diff --git a/docs/deployment/zero-downtime-deploys.md b/docs/deployment/zero-downtime-deploys.md index d321f1ed3..1dd678307 100644 --- a/docs/deployment/zero-downtime-deploys.md +++ b/docs/deployment/zero-downtime-deploys.md @@ -95,22 +95,24 @@ dokku checks:report Checks disabled list: none Checks skipped list: none Checks computed wait to retire: 60 - Checks global wait to retire: 60 + Checks global wait to retire: Checks wait to retire: =====> python-app checks information Checks disabled list: none Checks skipped list: none Checks computed wait to retire: 60 - Checks global wait to retire: 60 + Checks global wait to retire: Checks wait to retire: =====> ruby-app checks information Checks disabled list: _all_ Checks skipped list: none Checks computed wait to retire: 60 - Checks global wait to retire: 60 + Checks global wait to retire: Checks wait to retire: ``` +The `wait-to-retire` and `global-wait-to-retire` keys hold the raw per-app and global value respectively, and are empty when nothing has been set. The `computed-wait-to-retire` key holds the effective value used at deploy time, falling back to the global value (where one has been set) and then to the built-in default of `60`. + You can run the command for a specific app also. ```shell @@ -120,10 +122,10 @@ dokku checks:report node-js-app ``` =====> node-js-app checks information Checks disabled list: none - Checks skipped list: none + Checks skipped list: none Checks computed wait to retire: 60 - Checks global wait to retire: 60 - Checks wait to retire: + Checks global wait to retire: + Checks wait to retire: ``` You can pass flags which will output only the value of the specific information you want. For example: diff --git a/docs/networking/network.md b/docs/networking/network.md index 5a67265bc..f13cfef75 100644 --- a/docs/networking/network.md +++ b/docs/networking/network.md @@ -428,7 +428,7 @@ dokku network:report =====> node-js-app network information Network attach post create: Network attach post deploy: - Network bind all interfaces: false + Network bind all interfaces: Network computed attach post create: Network computed attach post deploy: Network computed bind all interfaces:false @@ -436,7 +436,7 @@ dokku network:report Network computed tld: Network global attach post create: Network global attach post deploy: - Network global bind all interfaces:false + Network global bind all interfaces: Network global initial network: Network global tld: Network initial network: @@ -445,7 +445,7 @@ dokku network:report =====> python-sample network information Network attach post create: Network attach post deploy: - Network bind all interfaces: false + Network bind all interfaces: Network computed attach post create: Network computed attach post deploy: Network computed bind all interfaces:false @@ -453,7 +453,7 @@ dokku network:report Network computed tld: Network global attach post create: Network global attach post deploy: - Network global bind all interfaces:false + Network global bind all interfaces: Network global initial network: Network global tld: Network initial network: @@ -462,7 +462,7 @@ dokku network:report =====> ruby-sample network information Network attach post create: Network attach post deploy: - Network bind all interfaces: false + Network bind all interfaces: Network computed attach post create: Network computed attach post deploy: Network computed bind all interfaces:false @@ -470,7 +470,7 @@ dokku network:report Network computed tld: Network global attach post create: Network global attach post deploy: - Network global bind all interfaces:false + Network global bind all interfaces: Network global initial network: Network global tld: Network initial network: @@ -478,6 +478,8 @@ dokku network:report Network web listeners: ``` +The per-app and `global-` keys for each property hold the raw values and are empty when nothing has been set. The `computed-` keys hold the effective value, falling back to the global value (where one has been set) and then to the built-in default (`false` for `bind-all-interfaces`, empty otherwise). + You can run the command for a specific app also. ```shell @@ -488,7 +490,7 @@ dokku network:report node-js-app =====> node-js-app network information Network attach post create: Network attach post deploy: - Network bind all interfaces: false + Network bind all interfaces: Network computed attach post create: Network computed attach post deploy: Network computed bind all interfaces:false @@ -496,7 +498,7 @@ dokku network:report node-js-app Network computed tld: Network global attach post create: Network global attach post deploy: - Network global bind all interfaces:false + Network global bind all interfaces: Network global initial network: Network global tld: Network initial network: diff --git a/docs/networking/proxies/caddy.md b/docs/networking/proxies/caddy.md index 579691811..e3fade92e 100644 --- a/docs/networking/proxies/caddy.md +++ b/docs/networking/proxies/caddy.md @@ -220,35 +220,22 @@ dokku caddy:report ``` =====> node-js-app caddy information - Caddy computed tls internal: false - Caddy global tls internal: false - Caddy image: lucaslorentz/caddy-docker-proxy:2.7 - Caddy letsencrypt email: - Caddy letsencrypt server: - Caddy log level: ERROR - Caddy polling interval: 5s - Caddy tls internal: -=====> python-app caddy information - Caddy computed tls internal: false - Caddy global tls internal: false - Caddy image: lucaslorentz/caddy-docker-proxy:2.7 - Caddy letsencrypt email: - Caddy letsencrypt server: - Caddy log level: ERROR - Caddy polling interval: 5s - Caddy tls internal: -=====> ruby-app caddy information - Caddy computed tls internal: false - Caddy global tls internal: false - Caddy image: lucaslorentz/caddy-docker-proxy:2.7 - Caddy letsencrypt email: - Caddy letsencrypt server: - Caddy log level: ERROR - Caddy polling interval: 5s + Caddy computed image: lucaslorentz/caddy-docker-proxy:2.7 + Caddy computed letsencrypt email: + Caddy computed letsencrypt server: https://acme-v02.api.letsencrypt.org/directory + Caddy computed log level: ERROR + Caddy computed polling interval: 5s + Caddy computed tls internal: false + Caddy global image: + Caddy global letsencrypt email: + Caddy global letsencrypt server: + Caddy global log level: + Caddy global polling interval: + Caddy global tls internal: Caddy tls internal: ``` -The `tls-internal` key holds the raw per-app value and is empty when nothing has been set on the app. The `computed-tls-internal` key holds the effective value used at deploy time, falling back to the global value and then to the built-in default of `false`. The `global-tls-internal` key holds the global value. +The `global-` keys hold the raw global value and are empty when nothing has been set globally. The `computed-` keys hold the effective value used at deploy time, falling back to the global value (where one has been set) and then to the built-in default. The bare `tls-internal` key holds the raw per-app value. You can run the command for a specific app also. @@ -258,18 +245,23 @@ dokku caddy:report node-js-app ``` =====> node-js-app caddy information - Caddy computed tls internal: false - Caddy global tls internal: false - Caddy image: lucaslorentz/caddy-docker-proxy:2.7 - Caddy letsencrypt email: - Caddy letsencrypt server: - Caddy log level: ERROR - Caddy polling interval: 5s + Caddy computed image: lucaslorentz/caddy-docker-proxy:2.7 + Caddy computed letsencrypt email: + Caddy computed letsencrypt server: https://acme-v02.api.letsencrypt.org/directory + Caddy computed log level: ERROR + Caddy computed polling interval: 5s + Caddy computed tls internal: false + Caddy global image: + Caddy global letsencrypt email: + Caddy global letsencrypt server: + Caddy global log level: + Caddy global polling interval: + Caddy global tls internal: Caddy tls internal: ``` You can pass flags which will output only the value of the specific information you want. For example: ```shell -dokku caddy:report node-js-app --caddy-image +dokku caddy:report node-js-app --caddy-computed-image ``` diff --git a/docs/networking/proxies/haproxy.md b/docs/networking/proxies/haproxy.md index 248306938..f0acf1572 100644 --- a/docs/networking/proxies/haproxy.md +++ b/docs/networking/proxies/haproxy.md @@ -205,13 +205,20 @@ dokku haproxy:report ``` =====> node-js-app haproxy information - Haproxy image: byjg/easy-haproxy:4.0.0 -=====> python-app haproxy information - Haproxy image: byjg/easy-haproxy:4.0.0 -=====> ruby-app haproxy information - Haproxy image: byjg/easy-haproxy:4.0.0 + Haproxy computed image: byjg/easy-haproxy:4.0.0 + Haproxy computed letsencrypt email: + Haproxy computed letsencrypt server: https://acme-v02.api.letsencrypt.org/directory + Haproxy computed log level: ERROR + Haproxy computed refresh conf: 10 + Haproxy global image: + Haproxy global letsencrypt email: + Haproxy global letsencrypt server: + Haproxy global log level: + Haproxy global refresh conf: ``` +The `global-` keys hold the raw global value and are empty when nothing has been set globally. The `computed-` keys hold the effective value used at deploy time, falling back to the built-in default when the global value is empty. + You can run the command for a specific app also. ```shell @@ -220,11 +227,20 @@ dokku haproxy:report node-js-app ``` =====> node-js-app haproxy information - Haproxy image: byjg/easy-haproxy:4.0.0 + Haproxy computed image: byjg/easy-haproxy:4.0.0 + Haproxy computed letsencrypt email: + Haproxy computed letsencrypt server: https://acme-v02.api.letsencrypt.org/directory + Haproxy computed log level: ERROR + Haproxy computed refresh conf: 10 + Haproxy global image: + Haproxy global letsencrypt email: + Haproxy global letsencrypt server: + Haproxy global log level: + Haproxy global refresh conf: ``` You can pass flags which will output only the value of the specific information you want. For example: ```shell -dokku haproxy:report node-js-app --haproxy-image +dokku haproxy:report node-js-app --haproxy-computed-image ``` diff --git a/docs/networking/proxies/traefik.md b/docs/networking/proxies/traefik.md index 0d2fbf70b..c6d8db13e 100644 --- a/docs/networking/proxies/traefik.md +++ b/docs/networking/proxies/traefik.md @@ -331,43 +331,30 @@ dokku traefik:report ``` =====> node-js-app traefik information - Traefik api enabled: false - Traefik api vhost: traefik.dokku.me - Traefik basic auth password: password - Traefik basic auth username: user - Traefik challenge mode: tls - Traefik dashboard enabled: false - Traefik dns provider: - Traefik image: traefik:v2.8 - Traefik letsencrypt email: - Traefik letsencrypt server: - Traefik log level: ERROR -=====> python-app traefik information - Traefik api enabled: false - Traefik api vhost: traefik.dokku.me - Traefik basic auth password: password - Traefik basic auth username: user - Traefik challenge mode: tls - Traefik dashboard enabled: false - Traefik dns provider: - Traefik image: traefik:v2.8 - Traefik letsencrypt email: - Traefik letsencrypt server: - Traefik log level: ERROR -=====> ruby-app traefik information - Traefik api enabled: false - Traefik api vhost: traefik.dokku.me - Traefik basic auth password: password - Traefik basic auth username: user - Traefik challenge mode: tls - Traefik dashboard enabled: false - Traefik dns provider: - Traefik image: traefik:v2.8 - Traefik letsencrypt email: - Traefik letsencrypt server: - Traefik log level: ERROR + Traefik computed api enabled: false + Traefik computed api vhost: traefik.dokku.me + Traefik computed challenge mode: tls + Traefik computed dashboard enabled: false + Traefik computed http entry point: http + Traefik computed https entry point: https + Traefik computed image: traefik:v2.8 + Traefik computed letsencrypt email: + Traefik computed letsencrypt server: https://acme-v02.api.letsencrypt.org/directory + Traefik computed log level: ERROR + Traefik global api enabled: + Traefik global api vhost: + Traefik global challenge mode: + Traefik global dashboard enabled: + Traefik global http entry point: + Traefik global https entry point: + Traefik global image: + Traefik global letsencrypt email: + Traefik global letsencrypt server: + Traefik global log level: ``` +The `global-` keys hold the raw global value and are empty when nothing has been set globally. The `computed-` keys hold the effective value used at deploy time, falling back to the built-in default when the global value is empty. + You can run the command for a specific app also. ```shell @@ -376,21 +363,30 @@ dokku traefik:report node-js-app ``` =====> node-js-app traefik information - Traefik api enabled: false - Traefik api vhost: traefik.dokku.me - Traefik basic auth password: password - Traefik basic auth username: user - Traefik challenge mode: tls - Traefik dashboard enabled: false - Traefik dns provider: - Traefik image: traefik:v2.8 - Traefik letsencrypt email: - Traefik letsencrypt server: - Traefik log level: ERROR + Traefik computed api enabled: false + Traefik computed api vhost: traefik.dokku.me + Traefik computed challenge mode: tls + Traefik computed dashboard enabled: false + Traefik computed http entry point: http + Traefik computed https entry point: https + Traefik computed image: traefik:v2.8 + Traefik computed letsencrypt email: + Traefik computed letsencrypt server: https://acme-v02.api.letsencrypt.org/directory + Traefik computed log level: ERROR + Traefik global api enabled: + Traefik global api vhost: + Traefik global challenge mode: + Traefik global dashboard enabled: + Traefik global http entry point: + Traefik global https entry point: + Traefik global image: + Traefik global letsencrypt email: + Traefik global letsencrypt server: + Traefik global log level: ``` You can pass flags which will output only the value of the specific information you want. For example: ```shell -dokku traefik:report node-js-app --traefik-api-enabled +dokku traefik:report node-js-app --traefik-computed-api-enabled ``` diff --git a/docs/networking/proxy-management.md b/docs/networking/proxy-management.md index 29c1e5249..c190fd048 100644 --- a/docs/networking/proxy-management.md +++ b/docs/networking/proxy-management.md @@ -142,16 +142,24 @@ dokku proxy:report ``` =====> node-js-app proxy information + Proxy computed type: nginx Proxy enabled: true - Proxy type: nginx + Proxy global type: + Proxy type: =====> python-sample proxy information + Proxy computed type: nginx Proxy enabled: true - Proxy type: nginx + Proxy global type: + Proxy type: =====> ruby-sample proxy information + Proxy computed type: nginx Proxy enabled: true - Proxy type: nginx + Proxy global type: + Proxy type: ``` +The `type` and `global-type` keys hold the raw per-app and global value respectively, and are empty when nothing has been set. The `computed-type` key holds the effective value used at deploy time, falling back to the global value (where one has been set) and then to the built-in default of `nginx`. + You can run the command for a specific app also. ```shell @@ -160,14 +168,16 @@ dokku proxy:report node-js-app ``` =====> node-js-app proxy information + Proxy computed type: nginx Proxy enabled: true - Proxy type: nginx + Proxy global type: + Proxy type: ``` You can pass flags which will output only the value of the specific information you want. For example: ```shell -dokku proxy:report node-js-app --proxy-type +dokku proxy:report node-js-app --proxy-computed-type ``` #### Proxy Port Scheme diff --git a/plugins/app-json/report.go b/plugins/app-json/report.go index 3daee5739..af5f68d07 100644 --- a/plugins/app-json/report.go +++ b/plugins/app-json/report.go @@ -15,7 +15,8 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { var flags map[string]common.ReportFunc if appName == "--global" { flags = map[string]common.ReportFunc{ - "--app-json-global-appjson-path": reportGlobalAppjsonpath, + "--app-json-computed-appjson-path": reportComputedAppjsonpath, + "--app-json-global-appjson-path": reportGlobalAppjsonpath, } } else { flags = map[string]common.ReportFunc{ @@ -41,12 +42,15 @@ func reportComputedAppjsonpath(appName string) string { if value == "" { value = reportGlobalAppjsonpath(appName) } + if value == "" { + value = "app.json" + } return value } func reportGlobalAppjsonpath(appName string) string { - return common.PropertyGetDefault("app-json", "--global", "appjson-path", "app.json") + return common.PropertyGet("app-json", "--global", "appjson-path") } func reportAppjsonpath(appName string) string { diff --git a/plugins/builder-dockerfile/internal-functions b/plugins/builder-dockerfile/internal-functions index 85fdb9f24..a7c6a236a 100755 --- a/plugins/builder-dockerfile/internal-functions +++ b/plugins/builder-dockerfile/internal-functions @@ -44,6 +44,7 @@ cmd-builder-dockerfile-report-single() { local flag_map=() if [[ "$APP" == "--global" ]]; then flag_map=( + "--builder-dockerfile-computed-dockerfile-path: $(fn-builder-dockerfile-computed-dockerfile-path "$APP")" "--builder-dockerfile-global-dockerfile-path: $(fn-builder-dockerfile-global-dockerfile-path "$APP")" ) else @@ -97,6 +98,9 @@ fn-builder-dockerfile-computed-dockerfile-path() { if [[ "$file" == "" ]]; then file="$(fn-builder-dockerfile-global-dockerfile-path "$APP")" fi + if [[ "$file" == "" ]]; then + file="Dockerfile" + fi echo "$file" } @@ -104,7 +108,7 @@ fn-builder-dockerfile-computed-dockerfile-path() { fn-builder-dockerfile-global-dockerfile-path() { declare APP="$1" - fn-plugin-property-get-default "builder-dockerfile" "--global" "dockerfile-path" "Dockerfile" + fn-plugin-property-get-default "builder-dockerfile" "--global" "dockerfile-path" "" } fn-builder-dockerfile-dockerfile-path() { diff --git a/plugins/builder-herokuish/internal-functions b/plugins/builder-herokuish/internal-functions index 78c93f514..a5cf4182e 100755 --- a/plugins/builder-herokuish/internal-functions +++ b/plugins/builder-herokuish/internal-functions @@ -44,6 +44,7 @@ cmd-builder-herokuish-report-single() { local flag_map=() if [[ "$APP" == "--global" ]]; then flag_map=( + "--builder-herokuish-computed-allowed: $(fn-builder-herokuish-computed-allowed "$APP")" "--builder-herokuish-global-allowed: $(fn-builder-herokuish-global-allowed)" ) else @@ -97,16 +98,16 @@ fn-builder-herokuish-computed-allowed() { if [[ -z "$allowed" ]]; then allowed="$(fn-builder-herokuish-global-allowed)" fi + if [[ -z "$allowed" ]]; then + allowed="true" + [[ "$(dpkg --print-architecture 2>/dev/null || true)" != "amd64" ]] && allowed="false" + fi echo "$allowed" } fn-builder-herokuish-global-allowed() { - local default_value="true" - - [[ "$(dpkg --print-architecture 2>/dev/null || true)" != "amd64" ]] && default_value="false" - - fn-plugin-property-get-default "builder-herokuish" "--global" "allowed" "$default_value" + fn-plugin-property-get-default "builder-herokuish" "--global" "allowed" "" } fn-builder-herokuish-allowed() { diff --git a/plugins/builder-lambda/internal-functions b/plugins/builder-lambda/internal-functions index 1459dc0f3..98af8d6b7 100755 --- a/plugins/builder-lambda/internal-functions +++ b/plugins/builder-lambda/internal-functions @@ -44,6 +44,7 @@ cmd-builder-lambda-report-single() { local flag_map=() if [[ "$APP" == "--global" ]]; then flag_map=( + "--builder-lambda-computed-lambdayml-path: $(fn-builder-lambda-computed-lambdayml-path "$APP")" "--builder-lambda-global-lambdayml-path: $(fn-builder-lambda-global-lambdayml-path "$APP")" ) else @@ -97,6 +98,9 @@ fn-builder-lambda-computed-lambdayml-path() { if [[ "$file" == "" ]]; then file="$(fn-builder-lambda-global-lambdayml-path "$APP")" fi + if [[ "$file" == "" ]]; then + file="lambda.yml" + fi echo "$file" } @@ -104,7 +108,7 @@ fn-builder-lambda-computed-lambdayml-path() { fn-builder-lambda-global-lambdayml-path() { declare APP="$1" - fn-plugin-property-get-default "builder-lambda" "--global" "lambdayml-path" "lambda.yml" + fn-plugin-property-get-default "builder-lambda" "--global" "lambdayml-path" "" } fn-builder-lambda-lambdayml-path() { diff --git a/plugins/builder-nixpacks/internal-functions b/plugins/builder-nixpacks/internal-functions index 1f41c319e..2350bd4ea 100755 --- a/plugins/builder-nixpacks/internal-functions +++ b/plugins/builder-nixpacks/internal-functions @@ -44,6 +44,7 @@ cmd-builder-nixpacks-report-single() { local flag_map=() if [[ "$APP" == "--global" ]]; then flag_map=( + "--builder-nixpacks-computed-nixpackstoml-path: $(fn-builder-nixpacks-computed-nixpackstoml-path "$APP")" "--builder-nixpacks-global-nixpackstoml-path: $(fn-builder-nixpacks-global-nixpackstoml-path "$APP")" ) else @@ -97,6 +98,9 @@ fn-builder-nixpacks-computed-nixpackstoml-path() { if [[ "$file" == "" ]]; then file="$(fn-builder-nixpacks-global-nixpackstoml-path "$APP")" fi + if [[ "$file" == "" ]]; then + file="nixpacks.toml" + fi echo "$file" } @@ -104,7 +108,7 @@ fn-builder-nixpacks-computed-nixpackstoml-path() { fn-builder-nixpacks-global-nixpackstoml-path() { declare APP="$1" - fn-plugin-property-get "builder-nixpacks" "--global" "nixpackstoml-path" "nixpacks.toml" + fn-plugin-property-get "builder-nixpacks" "--global" "nixpackstoml-path" "" } fn-builder-nixpacks-nixpackstoml-path() { diff --git a/plugins/builder-pack/internal-functions b/plugins/builder-pack/internal-functions index 548fbe2b2..f127f77a0 100755 --- a/plugins/builder-pack/internal-functions +++ b/plugins/builder-pack/internal-functions @@ -44,6 +44,7 @@ cmd-builder-pack-report-single() { local flag_map=() if [[ "$APP" == "--global" ]]; then flag_map=( + "--builder-pack-computed-projecttoml-path: $(fn-builder-pack-computed-projecttoml-path "$APP")" "--builder-pack-global-projecttoml-path: $(fn-builder-pack-global-projecttoml-path "$APP")" ) else @@ -97,6 +98,9 @@ fn-builder-pack-computed-projecttoml-path() { if [[ "$file" == "" ]]; then file="$(fn-builder-pack-global-projecttoml-path "$APP")" fi + if [[ "$file" == "" ]]; then + file="project.toml" + fi echo "$file" } @@ -104,7 +108,7 @@ fn-builder-pack-computed-projecttoml-path() { fn-builder-pack-global-projecttoml-path() { declare APP="$1" - fn-plugin-property-get-default "builder-pack" "--global" "projecttoml-path" "project.toml" + fn-plugin-property-get-default "builder-pack" "--global" "projecttoml-path" "" } fn-builder-pack-projecttoml-path() { diff --git a/plugins/builder-railpack/internal-functions b/plugins/builder-railpack/internal-functions index 3d3e31297..0dc979e46 100755 --- a/plugins/builder-railpack/internal-functions +++ b/plugins/builder-railpack/internal-functions @@ -44,6 +44,7 @@ cmd-builder-railpack-report-single() { local flag_map=() if [[ "$APP" == "--global" ]]; then flag_map=( + "--builder-railpack-computed-railpackjson-path: $(fn-builder-railpack-computed-railpackjson-path "$APP")" "--builder-railpack-global-railpackjson-path: $(fn-builder-railpack-global-railpackjson-path "$APP")" ) else @@ -97,6 +98,9 @@ fn-builder-railpack-computed-railpackjson-path() { if [[ "$file" == "" ]]; then file="$(fn-builder-railpack-global-railpackjson-path "$APP")" fi + if [[ "$file" == "" ]]; then + file="railpack.json" + fi echo "$file" } @@ -104,7 +108,7 @@ fn-builder-railpack-computed-railpackjson-path() { fn-builder-railpack-global-railpackjson-path() { declare APP="$1" - fn-plugin-property-get "builder-railpack" "--global" "railpackjson-path" "railpack.json" + fn-plugin-property-get "builder-railpack" "--global" "railpackjson-path" "" } fn-builder-railpack-railpackjson-path() { diff --git a/plugins/caddy-vhosts/certs-force b/plugins/caddy-vhosts/certs-force index a01fd5d5a..60b79c18d 100755 --- a/plugins/caddy-vhosts/certs-force +++ b/plugins/caddy-vhosts/certs-force @@ -13,7 +13,7 @@ trigger-caddy-vhosts-certs-force() { return fi - if [[ -n "$(fn-caddy-letsencrypt-email)" ]]; then + if [[ -n "$(fn-caddy-computed-letsencrypt-email)" ]]; then echo true fi } diff --git a/plugins/caddy-vhosts/command-functions b/plugins/caddy-vhosts/command-functions index 5508f1e47..c13c65be1 100755 --- a/plugins/caddy-vhosts/command-functions +++ b/plugins/caddy-vhosts/command-functions @@ -70,23 +70,34 @@ cmd-caddy-report-single() { local flag_map=() if [[ "$APP" == "--global" ]]; then flag_map=( + "--caddy-computed-image: $(fn-caddy-computed-image)" + "--caddy-computed-letsencrypt-email: $(fn-caddy-computed-letsencrypt-email)" + "--caddy-computed-letsencrypt-server: $(fn-caddy-computed-letsencrypt-server)" + "--caddy-computed-log-level: $(fn-caddy-computed-log-level)" + "--caddy-computed-polling-interval: $(fn-caddy-computed-polling-interval)" + "--caddy-computed-tls-internal: $(fn-caddy-computed-tls-internal "$APP")" + "--caddy-global-image: $(fn-caddy-global-image)" + "--caddy-global-letsencrypt-email: $(fn-caddy-global-letsencrypt-email)" + "--caddy-global-letsencrypt-server: $(fn-caddy-global-letsencrypt-server)" + "--caddy-global-log-level: $(fn-caddy-global-log-level)" + "--caddy-global-polling-interval: $(fn-caddy-global-polling-interval)" "--caddy-global-tls-internal: $(fn-caddy-global-tls-internal)" - "--caddy-image: $(fn-caddy-image)" - "--caddy-letsencrypt-email: $(fn-caddy-letsencrypt-email)" - "--caddy-letsencrypt-server: $(fn-caddy-letsencrypt-server)" - "--caddy-log-level: $(fn-caddy-log-level)" - "--caddy-polling-interval: $(fn-caddy-polling-interval)" ) else verify_app_name "$APP" flag_map=( + "--caddy-computed-image: $(fn-caddy-computed-image)" + "--caddy-computed-letsencrypt-email: $(fn-caddy-computed-letsencrypt-email)" + "--caddy-computed-letsencrypt-server: $(fn-caddy-computed-letsencrypt-server)" + "--caddy-computed-log-level: $(fn-caddy-computed-log-level)" + "--caddy-computed-polling-interval: $(fn-caddy-computed-polling-interval)" "--caddy-computed-tls-internal: $(fn-caddy-computed-tls-internal "$APP")" + "--caddy-global-image: $(fn-caddy-global-image)" + "--caddy-global-letsencrypt-email: $(fn-caddy-global-letsencrypt-email)" + "--caddy-global-letsencrypt-server: $(fn-caddy-global-letsencrypt-server)" + "--caddy-global-log-level: $(fn-caddy-global-log-level)" + "--caddy-global-polling-interval: $(fn-caddy-global-polling-interval)" "--caddy-global-tls-internal: $(fn-caddy-global-tls-internal)" - "--caddy-image: $(fn-caddy-image)" - "--caddy-letsencrypt-email: $(fn-caddy-letsencrypt-email)" - "--caddy-letsencrypt-server: $(fn-caddy-letsencrypt-server)" - "--caddy-log-level: $(fn-caddy-log-level)" - "--caddy-polling-interval: $(fn-caddy-polling-interval)" "--caddy-tls-internal: $(fn-caddy-tls-internal "$APP")" ) fi diff --git a/plugins/caddy-vhosts/docker-args-process-deploy b/plugins/caddy-vhosts/docker-args-process-deploy index b44256827..828c8c5e5 100755 --- a/plugins/caddy-vhosts/docker-args-process-deploy +++ b/plugins/caddy-vhosts/docker-args-process-deploy @@ -68,7 +68,7 @@ trigger-caddy-vhosts-docker-args-process-deploy() { fi done < <(plugn trigger ports-get "$APP") - letsencrypt_email="$(fn-caddy-letsencrypt-email)" + letsencrypt_email="$(fn-caddy-computed-letsencrypt-email)" if [[ -n "$letsencrypt_email" ]] && [[ -z "$proxy_container_https_port" ]]; then proxy_container_https_port_candidate="$proxy_container_http_port_candidate" proxy_host_https_port_candidate="$proxy_host_http_port_candidate" diff --git a/plugins/caddy-vhosts/internal-functions b/plugins/caddy-vhosts/internal-functions index 9df6483c9..8a4ee43c3 100755 --- a/plugins/caddy-vhosts/internal-functions +++ b/plugins/caddy-vhosts/internal-functions @@ -36,35 +36,73 @@ fn-caddy-template-compose-file() { fi local SIGIL_PARAMS=(CADDY_DATA_DIR="${DOKKU_LIB_ROOT}/data/caddy" - CADDY_IMAGE="$(fn-caddy-image)" - CADDY_LETSENCRYPT_EMAIL="$(fn-caddy-letsencrypt-email)" - CADDY_LETSENCRYPT_SERVER="$(fn-caddy-letsencrypt-server)" - CADDY_LOG_LEVEL="$(fn-caddy-log-level)" - CADDY_POLLING_INTERVAL="$(fn-caddy-polling-interval)") + CADDY_IMAGE="$(fn-caddy-computed-image)" + CADDY_LETSENCRYPT_EMAIL="$(fn-caddy-computed-letsencrypt-email)" + CADDY_LETSENCRYPT_SERVER="$(fn-caddy-computed-letsencrypt-server)" + CADDY_LOG_LEVEL="$(fn-caddy-computed-log-level)" + CADDY_POLLING_INTERVAL="$(fn-caddy-computed-polling-interval)") sigil -f "$COMPOSE_TEMPLATE" "${SIGIL_PARAMS[@]}" | cat -s >"$OUTPUT_PATH" } -fn-caddy-image() { - fn-plugin-property-get-default "caddy" "--global" "image" "$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/caddy-vhosts/Dockerfile" | awk '{print $2}')" +fn-caddy-global-image() { + fn-plugin-property-get-default "caddy" "--global" "image" "" } -fn-caddy-letsencrypt-email() { +fn-caddy-computed-image() { + local value + value="$(fn-caddy-global-image)" + if [[ -z "$value" ]]; then + value="$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/caddy-vhosts/Dockerfile" | awk '{print $2}')" + fi + echo "$value" +} + +fn-caddy-global-letsencrypt-email() { fn-plugin-property-get-default "caddy" "--global" "letsencrypt-email" "" } -fn-caddy-letsencrypt-server() { - fn-plugin-property-get-default "caddy" "--global" "letsencrypt-server" "https://acme-v02.api.letsencrypt.org/directory" +fn-caddy-computed-letsencrypt-email() { + fn-caddy-global-letsencrypt-email } -fn-caddy-log-level() { - local log_level - log_level="$(fn-plugin-property-get-default "caddy" "--global" "log-level" "ERROR")" - echo "${log_level^^}" +fn-caddy-global-letsencrypt-server() { + fn-plugin-property-get-default "caddy" "--global" "letsencrypt-server" "" } -fn-caddy-polling-interval() { - fn-plugin-property-get-default "caddy" "--global" "polling-interval" "5s" +fn-caddy-computed-letsencrypt-server() { + local value + value="$(fn-caddy-global-letsencrypt-server)" + if [[ -z "$value" ]]; then + value="https://acme-v02.api.letsencrypt.org/directory" + fi + echo "$value" +} + +fn-caddy-global-log-level() { + fn-plugin-property-get-default "caddy" "--global" "log-level" "" +} + +fn-caddy-computed-log-level() { + local value + value="$(fn-caddy-global-log-level)" + if [[ -z "$value" ]]; then + value="ERROR" + fi + echo "${value^^}" +} + +fn-caddy-global-polling-interval() { + fn-plugin-property-get-default "caddy" "--global" "polling-interval" "" +} + +fn-caddy-computed-polling-interval() { + local value + value="$(fn-caddy-global-polling-interval)" + if [[ -z "$value" ]]; then + value="5s" + fi + echo "$value" } fn-caddy-tls-internal() { @@ -79,9 +117,12 @@ fn-caddy-computed-tls-internal() { if [[ -z "$value" ]]; then value="$(fn-caddy-global-tls-internal)" fi + if [[ -z "$value" ]]; then + value="false" + fi echo "$value" } fn-caddy-global-tls-internal() { - fn-plugin-property-get-default "caddy" "--global" "tls-internal" "false" + fn-plugin-property-get-default "caddy" "--global" "tls-internal" "" } diff --git a/plugins/checks/internal-functions b/plugins/checks/internal-functions index 47c1b4953..9e4dacd84 100755 --- a/plugins/checks/internal-functions +++ b/plugins/checks/internal-functions @@ -45,6 +45,7 @@ cmd-checks-report-single() { local flag_map=() if [[ "$APP" == "--global" ]]; then flag_map=( + "--checks-computed-wait-to-retire: $(fn-checks-computed-wait-to-retire "$APP")" "--checks-global-wait-to-retire: $(fn-checks-global-wait-to-retire "$APP")" ) else @@ -116,6 +117,9 @@ fn-checks-computed-wait-to-retire() { if [[ "$file" == "" ]]; then file="$(fn-checks-global-wait-to-retire "$APP")" fi + if [[ "$file" == "" ]]; then + file="60" + fi echo "$file" } @@ -123,7 +127,7 @@ fn-checks-computed-wait-to-retire() { fn-checks-global-wait-to-retire() { declare APP="$1" - fn-plugin-property-get-default "checks" "--global" "wait-to-retire" "60" + fn-plugin-property-get-default "checks" "--global" "wait-to-retire" "" } fn-checks-wait-to-retire() { diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index 63c898840..b5da18e8e 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -1,6 +1,7 @@ #!/usr/bin/env bash source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/archive-functions" set -eo pipefail [[ $DOKKU_TRACE ]] && set -x @@ -369,19 +370,27 @@ cmd-git-report-single() { local flag_map=() if [[ "$APP" == "--global" ]]; then flag_map=( - "--git-global-archive-max-files: $(fn-plugin-property-get "git" "--global" "archive-max-files" "10000")" - "--git-global-archive-max-size: $(fn-plugin-property-get "git" "--global" "archive-max-size" "1073741824")" - "--git-global-deploy-branch: $(fn-plugin-property-get "git" "--global" "deploy-branch" "master")" + "--git-computed-archive-max-files: $(fn-archive-max-files)" + "--git-computed-archive-max-size: $(fn-archive-max-size)" + "--git-computed-deploy-branch: $(fn-git-deploy-branch "$APP")" + "--git-computed-keep-git-dir: $(fn-git-keep-git-dir "$APP")" + "--git-global-archive-max-files: $(fn-plugin-property-get "git" "--global" "archive-max-files" "")" + "--git-global-archive-max-size: $(fn-plugin-property-get "git" "--global" "archive-max-size" "")" + "--git-global-deploy-branch: $(fn-plugin-property-get "git" "--global" "deploy-branch" "")" + "--git-global-keep-git-dir: $(fn-plugin-property-get "git" "--global" "keep-git-dir" "")" ) else verify_app_name "$APP" flag_map=( + "--git-computed-archive-max-files: $(fn-archive-max-files)" + "--git-computed-archive-max-size: $(fn-archive-max-size)" "--git-computed-deploy-branch: $(fn-git-deploy-branch "$APP")" "--git-computed-keep-git-dir: $(fn-git-keep-git-dir "$APP")" "--git-deploy-branch: $(fn-plugin-property-get "git" "$APP" "deploy-branch" "")" - "--git-global-archive-max-files: $(fn-plugin-property-get "git" "--global" "archive-max-files" "10000")" - "--git-global-archive-max-size: $(fn-plugin-property-get "git" "--global" "archive-max-size" "1073741824")" - "--git-global-deploy-branch: $(fn-plugin-property-get "git" "--global" "deploy-branch" "master")" + "--git-global-archive-max-files: $(fn-plugin-property-get "git" "--global" "archive-max-files" "")" + "--git-global-archive-max-size: $(fn-plugin-property-get "git" "--global" "archive-max-size" "")" + "--git-global-deploy-branch: $(fn-plugin-property-get "git" "--global" "deploy-branch" "")" + "--git-global-keep-git-dir: $(fn-plugin-property-get "git" "--global" "keep-git-dir" "")" "--git-keep-git-dir: $(fn-plugin-property-get "git" "$APP" "keep-git-dir" "")" "--git-rev-env-var: $(fn-plugin-property-get "git" "$APP" "rev-env-var" "GIT_REV")" "--git-sha: $(fn-git-cmd "$APP_ROOT" rev-parse HEAD 2>/dev/null || false)" diff --git a/plugins/haproxy-vhosts/certs-force b/plugins/haproxy-vhosts/certs-force index 69bab2c83..91d6266cc 100755 --- a/plugins/haproxy-vhosts/certs-force +++ b/plugins/haproxy-vhosts/certs-force @@ -13,7 +13,7 @@ trigger-haproxy-vhosts-certs-force() { return fi - if [[ -n "$(fn-haproxy-letsencrypt-email)" ]]; then + if [[ -n "$(fn-haproxy-computed-letsencrypt-email)" ]]; then echo true fi } diff --git a/plugins/haproxy-vhosts/command-functions b/plugins/haproxy-vhosts/command-functions index fb0e92e3a..23e654591 100755 --- a/plugins/haproxy-vhosts/command-functions +++ b/plugins/haproxy-vhosts/command-functions @@ -71,11 +71,16 @@ cmd-haproxy-report-single() { verify_app_name "$APP" fi local flag_map=( - "--haproxy-image: $(fn-haproxy-image)" - "--haproxy-letsencrypt-email: $(fn-haproxy-letsencrypt-email)" - "--haproxy-letsencrypt-server: $(fn-haproxy-letsencrypt-server)" - "--haproxy-log-level: $(fn-haproxy-log-level)" - "--haproxy-refresh-conf: $(fn-haproxy-refresh-conf)" + "--haproxy-computed-image: $(fn-haproxy-computed-image)" + "--haproxy-computed-letsencrypt-email: $(fn-haproxy-computed-letsencrypt-email)" + "--haproxy-computed-letsencrypt-server: $(fn-haproxy-computed-letsencrypt-server)" + "--haproxy-computed-log-level: $(fn-haproxy-computed-log-level)" + "--haproxy-computed-refresh-conf: $(fn-haproxy-computed-refresh-conf)" + "--haproxy-global-image: $(fn-haproxy-global-image)" + "--haproxy-global-letsencrypt-email: $(fn-haproxy-global-letsencrypt-email)" + "--haproxy-global-letsencrypt-server: $(fn-haproxy-global-letsencrypt-server)" + "--haproxy-global-log-level: $(fn-haproxy-global-log-level)" + "--haproxy-global-refresh-conf: $(fn-haproxy-global-refresh-conf)" ) fn-report-validate-format "$FORMAT" "$INFO_FLAG" diff --git a/plugins/haproxy-vhosts/docker-args-process-deploy b/plugins/haproxy-vhosts/docker-args-process-deploy index 94eed72dd..36724804a 100755 --- a/plugins/haproxy-vhosts/docker-args-process-deploy +++ b/plugins/haproxy-vhosts/docker-args-process-deploy @@ -68,7 +68,7 @@ trigger-haproxy-vhosts-docker-args-process-deploy() { fi done < <(plugn trigger ports-get "$APP") - letsencrypt_email="$(fn-haproxy-letsencrypt-email)" + letsencrypt_email="$(fn-haproxy-computed-letsencrypt-email)" if [[ -n "$letsencrypt_email" ]] && [[ -z "$proxy_container_https_port" ]]; then proxy_container_https_port_candidate="$proxy_container_http_port_candidate" proxy_host_https_port_candidate="$proxy_host_http_port_candidate" diff --git a/plugins/haproxy-vhosts/internal-functions b/plugins/haproxy-vhosts/internal-functions index c4b8d80ac..3ee7d43a5 100755 --- a/plugins/haproxy-vhosts/internal-functions +++ b/plugins/haproxy-vhosts/internal-functions @@ -35,33 +35,71 @@ fn-haproxy-template-compose-file() { COMPOSE_TEMPLATE="$CUSTOM_COMPOSE_TEMPLATE" fi - local SIGIL_PARAMS=(HAPROXY_IMAGE="$(fn-haproxy-image)" - HAPROXY_LOG_LEVEL="$(fn-haproxy-log-level)" - HAPROXY_LETSENCRYPT_EMAIL="$(fn-haproxy-letsencrypt-email)" - HAPROXY_LETSENCRYPT_SERVER="$(fn-haproxy-letsencrypt-server)" - HAPROXY_REFRESH_CONF="$(fn-haproxy-refresh-conf)") + local SIGIL_PARAMS=(HAPROXY_IMAGE="$(fn-haproxy-computed-image)" + HAPROXY_LOG_LEVEL="$(fn-haproxy-computed-log-level)" + HAPROXY_LETSENCRYPT_EMAIL="$(fn-haproxy-computed-letsencrypt-email)" + HAPROXY_LETSENCRYPT_SERVER="$(fn-haproxy-computed-letsencrypt-server)" + HAPROXY_REFRESH_CONF="$(fn-haproxy-computed-refresh-conf)") sigil -f "$COMPOSE_TEMPLATE" "${SIGIL_PARAMS[@]}" | cat -s >"$OUTPUT_PATH" } -fn-haproxy-image() { - fn-plugin-property-get-default "haproxy" "--global" "image" "$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/haproxy-vhosts/Dockerfile" | awk '{print $2}')" +fn-haproxy-global-image() { + fn-plugin-property-get-default "haproxy" "--global" "image" "" } -fn-haproxy-log-level() { - local log_level - log_level="$(fn-plugin-property-get-default "haproxy" "--global" "log-level" "ERROR")" - echo "${log_level^^}" +fn-haproxy-computed-image() { + local value + value="$(fn-haproxy-global-image)" + if [[ -z "$value" ]]; then + value="$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/haproxy-vhosts/Dockerfile" | awk '{print $2}')" + fi + echo "$value" } -fn-haproxy-letsencrypt-email() { +fn-haproxy-global-log-level() { + fn-plugin-property-get-default "haproxy" "--global" "log-level" "" +} + +fn-haproxy-computed-log-level() { + local value + value="$(fn-haproxy-global-log-level)" + if [[ -z "$value" ]]; then + value="ERROR" + fi + echo "${value^^}" +} + +fn-haproxy-global-letsencrypt-email() { fn-plugin-property-get-default "haproxy" "--global" "letsencrypt-email" "" } -fn-haproxy-letsencrypt-server() { - fn-plugin-property-get-default "haproxy" "--global" "letsencrypt-server" "https://acme-v02.api.letsencrypt.org/directory" +fn-haproxy-computed-letsencrypt-email() { + fn-haproxy-global-letsencrypt-email } -fn-haproxy-refresh-conf() { - fn-plugin-property-get-default "haproxy" "--global" "refresh-conf" "10" +fn-haproxy-global-letsencrypt-server() { + fn-plugin-property-get-default "haproxy" "--global" "letsencrypt-server" "" +} + +fn-haproxy-computed-letsencrypt-server() { + local value + value="$(fn-haproxy-global-letsencrypt-server)" + if [[ -z "$value" ]]; then + value="https://acme-v02.api.letsencrypt.org/directory" + fi + echo "$value" +} + +fn-haproxy-global-refresh-conf() { + fn-plugin-property-get-default "haproxy" "--global" "refresh-conf" "" +} + +fn-haproxy-computed-refresh-conf() { + local value + value="$(fn-haproxy-global-refresh-conf)" + if [[ -z "$value" ]]; then + value="10" + fi + echo "$value" } diff --git a/plugins/logs/functions.go b/plugins/logs/functions.go index 95b522329..2669202ba 100644 --- a/plugins/logs/functions.go +++ b/plugins/logs/functions.go @@ -222,7 +222,7 @@ func writeVectorConfig() error { data.Sources["docker-global-source"] = vectorSource{ Type: "docker_logs", - IncludeLabels: []string{reportGlobalAppLabelAlias("global")}, + IncludeLabels: []string{reportComputedAppLabelAlias("global")}, } data.Sinks["docker-global-sink"] = sink diff --git a/plugins/logs/report.go b/plugins/logs/report.go index af7953b26..4de190711 100644 --- a/plugins/logs/report.go +++ b/plugins/logs/report.go @@ -20,11 +20,13 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { var flags map[string]common.ReportFunc if appName == "--global" { flags = map[string]common.ReportFunc{ - "--logs-global-app-label-alias": reportGlobalAppLabelAlias, - "--logs-global-max-size": reportGlobalMaxSize, - "--logs-global-vector-sink": reportGlobalVectorSink, - "--logs-vector-global-image": reportVectorGlobalImage, - "--logs-vector-global-networks": reportVectorGlobalNetworks, + "--logs-computed-app-label-alias": reportComputedAppLabelAlias, + "--logs-computed-max-size": reportComputedMaxSize, + "--logs-global-app-label-alias": reportGlobalAppLabelAlias, + "--logs-global-max-size": reportGlobalMaxSize, + "--logs-global-vector-sink": reportGlobalVectorSink, + "--logs-vector-global-image": reportVectorGlobalImage, + "--logs-vector-global-networks": reportVectorGlobalNetworks, } } else { flags = map[string]common.ReportFunc{ @@ -57,12 +59,15 @@ func reportComputedAppLabelAlias(appName string) string { if value == "" { value = reportGlobalAppLabelAlias(appName) } + if value == "" { + value = AppLabelAlias + } return value } func reportGlobalAppLabelAlias(appName string) string { - return common.PropertyGetDefault("logs", "--global", "app-label-alias", AppLabelAlias) + return common.PropertyGet("logs", "--global", "app-label-alias") } func reportAppLabelAlias(appName string) string { @@ -74,12 +79,15 @@ func reportComputedMaxSize(appName string) string { if value == "" { value = reportGlobalMaxSize(appName) } + if value == "" { + value = MaxSize + } return value } func reportGlobalMaxSize(appName string) string { - return common.PropertyGetDefault("logs", "--global", "max-size", MaxSize) + return common.PropertyGet("logs", "--global", "max-size") } func reportVectorGlobalImage(appName string) string { diff --git a/plugins/network/report.go b/plugins/network/report.go index 9ddfcd67b..00a05196b 100644 --- a/plugins/network/report.go +++ b/plugins/network/report.go @@ -17,11 +17,12 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { var flags map[string]common.ReportFunc if appName == "--global" { flags = map[string]common.ReportFunc{ - "--network-global-attach-post-create": reportGlobalAttachPostCreate, - "--network-global-attach-post-deploy": reportGlobalAttachPostDeploy, - "--network-global-bind-all-interfaces": reportGlobalBindAllInterfaces, - "--network-global-initial-network": reportGlobalInitialNetwork, - "--network-global-tld": reportGlobalTld, + "--network-computed-bind-all-interfaces": reportComputedBindAllInterfaces, + "--network-global-attach-post-create": reportGlobalAttachPostCreate, + "--network-global-attach-post-deploy": reportGlobalAttachPostDeploy, + "--network-global-bind-all-interfaces": reportGlobalBindAllInterfaces, + "--network-global-initial-network": reportGlobalInitialNetwork, + "--network-global-tld": reportGlobalTld, } } else { flags = map[string]common.ReportFunc{ @@ -91,6 +92,9 @@ func reportComputedBindAllInterfaces(appName string) string { if value == "" { value = reportGlobalBindAllInterfaces(appName) } + if value == "" { + value = "false" + } return value } @@ -122,7 +126,7 @@ func reportGlobalAttachPostDeploy(appName string) string { } func reportGlobalBindAllInterfaces(appName string) string { - return common.PropertyGetDefault("network", "--global", "bind-all-interfaces", "false") + return common.PropertyGet("network", "--global", "bind-all-interfaces") } func reportGlobalInitialNetwork(appName string) string { diff --git a/plugins/proxy/functions.go b/plugins/proxy/functions.go index 11b4823b5..ec3f4ed75 100644 --- a/plugins/proxy/functions.go +++ b/plugins/proxy/functions.go @@ -13,10 +13,13 @@ func getComputedProxyType(appName string) string { if proxyType == "" { proxyType = getGlobalProxyType() } + if proxyType == "" { + proxyType = "nginx" + } return proxyType } func getGlobalProxyType() string { - return common.PropertyGetDefault("proxy", "--global", "type", "nginx") + return common.PropertyGet("proxy", "--global", "type") } diff --git a/plugins/proxy/report.go b/plugins/proxy/report.go index 305e808e0..1f55a7c78 100644 --- a/plugins/proxy/report.go +++ b/plugins/proxy/report.go @@ -15,7 +15,8 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { var flags map[string]common.ReportFunc if appName == "--global" { flags = map[string]common.ReportFunc{ - "--proxy-global-type": reportGlobalType, + "--proxy-computed-type": reportComputedType, + "--proxy-global-type": reportGlobalType, } } else { flags = map[string]common.ReportFunc{ @@ -47,12 +48,7 @@ func reportEnabled(appName string) string { } func reportComputedType(appName string) string { - proxyType := getGlobalProxyType() - if proxyType == "" { - proxyType = getAppProxyType(appName) - } - - return proxyType + return getComputedProxyType(appName) } func reportGlobalType(appName string) string { diff --git a/plugins/scheduler-docker-local/internal-functions b/plugins/scheduler-docker-local/internal-functions index 921678500..3bf7115f7 100755 --- a/plugins/scheduler-docker-local/internal-functions +++ b/plugins/scheduler-docker-local/internal-functions @@ -45,6 +45,8 @@ cmd-scheduler-docker-local-report-single() { local flag_map=() if [[ "$APP" == "--global" ]]; then flag_map=( + "--scheduler-docker-local-computed-init-process: $(fn-scheduler-docker-local-computed-init-process "$APP")" + "--scheduler-docker-local-computed-parallel-schedule-count: $(fn-scheduler-docker-local-computed-parallel-schedule-count "$APP")" "--scheduler-docker-local-global-init-process: $(fn-scheduler-docker-local-global-init-process "$APP")" "--scheduler-docker-local-global-parallel-schedule-count: $(fn-scheduler-docker-local-global-parallel-schedule-count "$APP")" ) @@ -107,12 +109,15 @@ fn-scheduler-docker-local-computed-init-process() { if [[ -z "$value" ]]; then value="$(fn-scheduler-docker-local-global-init-process "$APP")" fi + if [[ -z "$value" ]]; then + value="true" + fi echo "$value" } fn-scheduler-docker-local-global-init-process() { declare APP="$1" - fn-plugin-property-get-default "scheduler-docker-local" "--global" "init-process" "true" + fn-plugin-property-get-default "scheduler-docker-local" "--global" "init-process" "" } fn-scheduler-docker-local-parallel-schedule-count() { @@ -127,12 +132,15 @@ fn-scheduler-docker-local-computed-parallel-schedule-count() { if [[ -z "$value" ]]; then value="$(fn-scheduler-docker-local-global-parallel-schedule-count "$APP")" fi + if [[ -z "$value" ]]; then + value="1" + fi echo "$value" } fn-scheduler-docker-local-global-parallel-schedule-count() { declare APP="$1" - fn-plugin-property-get-default "scheduler-docker-local" "--global" "parallel-schedule-count" "1" + fn-plugin-property-get-default "scheduler-docker-local" "--global" "parallel-schedule-count" "" } fn-scheduler-docker-local-get-checks-file-path() { diff --git a/plugins/scheduler/report.go b/plugins/scheduler/report.go index 095fe851b..801b3fb4b 100644 --- a/plugins/scheduler/report.go +++ b/plugins/scheduler/report.go @@ -15,7 +15,8 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { var flags map[string]common.ReportFunc if appName == "--global" { flags = map[string]common.ReportFunc{ - "--scheduler-global-selected": reportGlobalSelected, + "--scheduler-computed-selected": reportComputedSelected, + "--scheduler-global-selected": reportGlobalSelected, } } else { flags = map[string]common.ReportFunc{ @@ -41,12 +42,15 @@ func reportComputedSelected(appName string) string { if value == "" { value = reportGlobalSelected(appName) } + if value == "" { + value = "docker-local" + } return value } func reportGlobalSelected(appName string) string { - return common.PropertyGetDefault("scheduler", "--global", "selected", "docker-local") + return common.PropertyGet("scheduler", "--global", "selected") } func reportSelected(appName string) string { diff --git a/plugins/traefik-vhosts/certs-force b/plugins/traefik-vhosts/certs-force index 665717bad..922850f71 100755 --- a/plugins/traefik-vhosts/certs-force +++ b/plugins/traefik-vhosts/certs-force @@ -13,7 +13,7 @@ trigger-traefik-vhosts-certs-force() { return fi - if [[ -n "$(fn-traefik-letsencrypt-email)" ]]; then + if [[ -n "$(fn-traefik-computed-letsencrypt-email)" ]]; then echo true fi } diff --git a/plugins/traefik-vhosts/command-functions b/plugins/traefik-vhosts/command-functions index 9f350edf1..6ccf88128 100755 --- a/plugins/traefik-vhosts/command-functions +++ b/plugins/traefik-vhosts/command-functions @@ -71,21 +71,36 @@ cmd-traefik-report-single() { verify_app_name "$APP" fi local flag_map=( - "--traefik-api-enabled: $(fn-traefik-api-enabled)" - "--traefik-api-entry-point: $(fn-traefik-api-entry-point)" - "--traefik-api-entry-point-address: $(fn-traefik-api-entry-point-address)" - "--traefik-api-vhost: $(fn-traefik-api-vhost)" - "--traefik-basic-auth-password: $(fn-traefik-basic-auth-password)" - "--traefik-basic-auth-username: $(fn-traefik-basic-auth-username)" - "--traefik-challenge-mode: $(fn-traefik-challenge-mode)" - "--traefik-dashboard-enabled: $(fn-traefik-dashboard-enabled)" - "--traefik-dns-provider: $(fn-traefik-dns-provider)" - "--traefik-image: $(fn-traefik-image)" - "--traefik-letsencrypt-email: $(fn-traefik-letsencrypt-email)" - "--traefik-letsencrypt-server: $(fn-traefik-letsencrypt-server)" - "--traefik-log-level: $(fn-traefik-log-level)" - "--traefik-http-entry-point: $(fn-traefik-http-entry-point)" - "--traefik-https-entry-point: $(fn-traefik-https-entry-point)" + "--traefik-computed-api-enabled: $(fn-traefik-computed-api-enabled)" + "--traefik-computed-api-entry-point: $(fn-traefik-computed-api-entry-point)" + "--traefik-computed-api-entry-point-address: $(fn-traefik-computed-api-entry-point-address)" + "--traefik-computed-api-vhost: $(fn-traefik-computed-api-vhost)" + "--traefik-computed-basic-auth-password: $(fn-traefik-computed-basic-auth-password)" + "--traefik-computed-basic-auth-username: $(fn-traefik-computed-basic-auth-username)" + "--traefik-computed-challenge-mode: $(fn-traefik-computed-challenge-mode)" + "--traefik-computed-dashboard-enabled: $(fn-traefik-computed-dashboard-enabled)" + "--traefik-computed-dns-provider: $(fn-traefik-computed-dns-provider)" + "--traefik-computed-http-entry-point: $(fn-traefik-computed-http-entry-point)" + "--traefik-computed-https-entry-point: $(fn-traefik-computed-https-entry-point)" + "--traefik-computed-image: $(fn-traefik-computed-image)" + "--traefik-computed-letsencrypt-email: $(fn-traefik-computed-letsencrypt-email)" + "--traefik-computed-letsencrypt-server: $(fn-traefik-computed-letsencrypt-server)" + "--traefik-computed-log-level: $(fn-traefik-computed-log-level)" + "--traefik-global-api-enabled: $(fn-traefik-global-api-enabled)" + "--traefik-global-api-entry-point: $(fn-traefik-global-api-entry-point)" + "--traefik-global-api-entry-point-address: $(fn-traefik-global-api-entry-point-address)" + "--traefik-global-api-vhost: $(fn-traefik-global-api-vhost)" + "--traefik-global-basic-auth-password: $(fn-traefik-global-basic-auth-password)" + "--traefik-global-basic-auth-username: $(fn-traefik-global-basic-auth-username)" + "--traefik-global-challenge-mode: $(fn-traefik-global-challenge-mode)" + "--traefik-global-dashboard-enabled: $(fn-traefik-global-dashboard-enabled)" + "--traefik-global-dns-provider: $(fn-traefik-global-dns-provider)" + "--traefik-global-http-entry-point: $(fn-traefik-global-http-entry-point)" + "--traefik-global-https-entry-point: $(fn-traefik-global-https-entry-point)" + "--traefik-global-image: $(fn-traefik-global-image)" + "--traefik-global-letsencrypt-email: $(fn-traefik-global-letsencrypt-email)" + "--traefik-global-letsencrypt-server: $(fn-traefik-global-letsencrypt-server)" + "--traefik-global-log-level: $(fn-traefik-global-log-level)" ) local dns_provider_env_vars diff --git a/plugins/traefik-vhosts/docker-args-process-deploy b/plugins/traefik-vhosts/docker-args-process-deploy index be8196862..ea4782555 100755 --- a/plugins/traefik-vhosts/docker-args-process-deploy +++ b/plugins/traefik-vhosts/docker-args-process-deploy @@ -68,7 +68,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() { fi done < <(plugn trigger ports-get "$APP") - letsencrypt_email="$(fn-traefik-letsencrypt-email)" + letsencrypt_email="$(fn-traefik-computed-letsencrypt-email)" if [[ -n "$letsencrypt_email" ]] && [[ -z "$proxy_container_https_port" ]]; then proxy_container_https_port_candidate="$proxy_container_http_port_candidate" proxy_host_https_port_candidate="$proxy_host_http_port_candidate" @@ -107,7 +107,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() { fi output="$output --label traefik.http.services.$APP-$PROC_TYPE-http.loadbalancer.server.port=$proxy_container_http_port" - output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.entrypoints=$(fn-traefik-http-entry-point)" + output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.entrypoints=$(fn-traefik-computed-http-entry-point)" output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.service=$APP-$PROC_TYPE-http" if [[ -n "$traefik_domains" ]]; then output="$output --label \"traefik.http.routers.$APP-$PROC_TYPE-http.rule=$traefik_domains\"" @@ -122,7 +122,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() { fi output="$output --label traefik.http.services.$APP-$PROC_TYPE-https.loadbalancer.server.port=$proxy_container_https_port" - output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.entrypoints=$(fn-traefik-https-entry-point)" + output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.entrypoints=$(fn-traefik-computed-https-entry-point)" output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.service=$APP-$PROC_TYPE-https" output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.tls.certresolver=leresolver" if [[ -n "$traefik_domains" ]]; then diff --git a/plugins/traefik-vhosts/internal-functions b/plugins/traefik-vhosts/internal-functions index fcb570fc5..49b9afc5c 100755 --- a/plugins/traefik-vhosts/internal-functions +++ b/plugins/traefik-vhosts/internal-functions @@ -36,106 +36,209 @@ fn-traefik-template-compose-file() { COMPOSE_TEMPLATE="$CUSTOM_COMPOSE_TEMPLATE" fi - basic_auth_password="$(fn-traefik-basic-auth-password)" - basic_auth_username="$(fn-traefik-basic-auth-username)" + basic_auth_password="$(fn-traefik-computed-basic-auth-password)" + basic_auth_username="$(fn-traefik-computed-basic-auth-username)" if [[ -n "$basic_auth_password" ]] && [[ -n "$basic_auth_username" ]]; then basic_auth="$(htpasswd -nb "$basic_auth_username" "$basic_auth_password" | sed -e s/\\$/\\$\\$/g)" fi local dns_provider_env_vars="" local dns_provider - dns_provider="$(fn-traefik-dns-provider)" + dns_provider="$(fn-traefik-computed-dns-provider)" if [[ -n "$dns_provider" ]]; then dns_provider_env_vars="$(fn-traefik-dns-provider-env-vars)" fi local api_entry_point_address api_entry_point_port="" - api_entry_point_address="$(fn-traefik-api-entry-point-address)" + api_entry_point_address="$(fn-traefik-computed-api-entry-point-address)" if [[ -n "$api_entry_point_address" ]]; then api_entry_point_port="${api_entry_point_address##*:}" fi - local SIGIL_PARAMS=(TRAEFIK_API_ENABLED="$(fn-traefik-api-enabled)" - TRAEFIK_API_ENTRY_POINT="$(fn-traefik-api-entry-point)" + local SIGIL_PARAMS=(TRAEFIK_API_ENABLED="$(fn-traefik-computed-api-enabled)" + TRAEFIK_API_ENTRY_POINT="$(fn-traefik-computed-api-entry-point)" TRAEFIK_API_ENTRY_POINT_ADDRESS="$api_entry_point_address" TRAEFIK_API_ENTRY_POINT_PORT="$api_entry_point_port" - TRAEFIK_API_VHOST="$(fn-traefik-api-vhost)" + TRAEFIK_API_VHOST="$(fn-traefik-computed-api-vhost)" TRAEFIK_BASIC_AUTH="$basic_auth" - TRAEFIK_CHALLENGE_MODE="$(fn-traefik-challenge-mode)" - TRAEFIK_DASHBOARD_ENABLED="$(fn-traefik-dashboard-enabled)" + TRAEFIK_CHALLENGE_MODE="$(fn-traefik-computed-challenge-mode)" + TRAEFIK_DASHBOARD_ENABLED="$(fn-traefik-computed-dashboard-enabled)" TRAEFIK_DATA_DIR="${DOKKU_LIB_ROOT}/data/traefik" TRAEFIK_DNS_PROVIDER="$dns_provider" TRAEFIK_DNS_PROVIDER_ENV_VARS="$dns_provider_env_vars" - TRAEFIK_IMAGE="$(fn-traefik-image)" - TRAEFIK_LETSENCRYPT_EMAIL="$(fn-traefik-letsencrypt-email)" - TRAEFIK_LETSENCRYPT_SERVER="$(fn-traefik-letsencrypt-server)" - TRAEFIK_LOG_LEVEL="$(fn-traefik-log-level)") + TRAEFIK_IMAGE="$(fn-traefik-computed-image)" + TRAEFIK_LETSENCRYPT_EMAIL="$(fn-traefik-computed-letsencrypt-email)" + TRAEFIK_LETSENCRYPT_SERVER="$(fn-traefik-computed-letsencrypt-server)" + TRAEFIK_LOG_LEVEL="$(fn-traefik-computed-log-level)") sigil -f "$COMPOSE_TEMPLATE" "${SIGIL_PARAMS[@]}" | cat -s >"$OUTPUT_PATH" } -fn-traefik-api-enabled() { - fn-plugin-property-get-default "traefik" "--global" "api-enabled" "false" +fn-traefik-global-api-enabled() { + fn-plugin-property-get-default "traefik" "--global" "api-enabled" "" } -fn-traefik-api-vhost() { - fn-plugin-property-get-default "traefik" "--global" "api-vhost" "traefik.dokku.me" +fn-traefik-computed-api-enabled() { + local value + value="$(fn-traefik-global-api-enabled)" + if [[ -z "$value" ]]; then + value="false" + fi + echo "$value" } -fn-traefik-basic-auth-password() { +fn-traefik-global-api-vhost() { + fn-plugin-property-get-default "traefik" "--global" "api-vhost" "" +} + +fn-traefik-computed-api-vhost() { + local value + value="$(fn-traefik-global-api-vhost)" + if [[ -z "$value" ]]; then + value="traefik.dokku.me" + fi + echo "$value" +} + +fn-traefik-global-basic-auth-password() { fn-plugin-property-get-default "traefik" "--global" "basic-auth-password" "" } -fn-traefik-basic-auth-username() { +fn-traefik-computed-basic-auth-password() { + fn-traefik-global-basic-auth-password +} + +fn-traefik-global-basic-auth-username() { fn-plugin-property-get-default "traefik" "--global" "basic-auth-username" "" } -fn-traefik-dashboard-enabled() { - fn-plugin-property-get-default "traefik" "--global" "dashboard-enabled" "false" +fn-traefik-computed-basic-auth-username() { + fn-traefik-global-basic-auth-username } -fn-traefik-image() { - fn-plugin-property-get-default "traefik" "--global" "image" "$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/traefik-vhosts/Dockerfile" | awk '{print $2}')" +fn-traefik-global-dashboard-enabled() { + fn-plugin-property-get-default "traefik" "--global" "dashboard-enabled" "" } -fn-traefik-letsencrypt-email() { +fn-traefik-computed-dashboard-enabled() { + local value + value="$(fn-traefik-global-dashboard-enabled)" + if [[ -z "$value" ]]; then + value="false" + fi + echo "$value" +} + +fn-traefik-global-image() { + fn-plugin-property-get-default "traefik" "--global" "image" "" +} + +fn-traefik-computed-image() { + local value + value="$(fn-traefik-global-image)" + if [[ -z "$value" ]]; then + value="$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/traefik-vhosts/Dockerfile" | awk '{print $2}')" + fi + echo "$value" +} + +fn-traefik-global-letsencrypt-email() { fn-plugin-property-get-default "traefik" "--global" "letsencrypt-email" "" } -fn-traefik-letsencrypt-server() { - fn-plugin-property-get-default "traefik" "--global" "letsencrypt-server" "https://acme-v02.api.letsencrypt.org/directory" +fn-traefik-computed-letsencrypt-email() { + fn-traefik-global-letsencrypt-email } -fn-traefik-log-level() { - local log_level - log_level="$(fn-plugin-property-get-default "traefik" "--global" "log-level" "ERROR")" - echo "${log_level^^}" +fn-traefik-global-letsencrypt-server() { + fn-plugin-property-get-default "traefik" "--global" "letsencrypt-server" "" } -fn-traefik-http-entry-point() { - fn-plugin-property-get-default "traefik" "--global" "http-entry-point" "http" +fn-traefik-computed-letsencrypt-server() { + local value + value="$(fn-traefik-global-letsencrypt-server)" + if [[ -z "$value" ]]; then + value="https://acme-v02.api.letsencrypt.org/directory" + fi + echo "$value" } -fn-traefik-https-entry-point() { - fn-plugin-property-get-default "traefik" "--global" "https-entry-point" "https" +fn-traefik-global-log-level() { + fn-plugin-property-get-default "traefik" "--global" "log-level" "" } -fn-traefik-api-entry-point() { +fn-traefik-computed-log-level() { + local value + value="$(fn-traefik-global-log-level)" + if [[ -z "$value" ]]; then + value="ERROR" + fi + echo "${value^^}" +} + +fn-traefik-global-http-entry-point() { + fn-plugin-property-get-default "traefik" "--global" "http-entry-point" "" +} + +fn-traefik-computed-http-entry-point() { + local value + value="$(fn-traefik-global-http-entry-point)" + if [[ -z "$value" ]]; then + value="http" + fi + echo "$value" +} + +fn-traefik-global-https-entry-point() { + fn-plugin-property-get-default "traefik" "--global" "https-entry-point" "" +} + +fn-traefik-computed-https-entry-point() { + local value + value="$(fn-traefik-global-https-entry-point)" + if [[ -z "$value" ]]; then + value="https" + fi + echo "$value" +} + +fn-traefik-global-api-entry-point() { fn-plugin-property-get-default "traefik" "--global" "api-entry-point" "" } -fn-traefik-api-entry-point-address() { +fn-traefik-computed-api-entry-point() { + fn-traefik-global-api-entry-point +} + +fn-traefik-global-api-entry-point-address() { fn-plugin-property-get-default "traefik" "--global" "api-entry-point-address" "" } -fn-traefik-challenge-mode() { - fn-plugin-property-get-default "traefik" "--global" "challenge-mode" "tls" +fn-traefik-computed-api-entry-point-address() { + fn-traefik-global-api-entry-point-address } -fn-traefik-dns-provider() { +fn-traefik-global-challenge-mode() { + fn-plugin-property-get-default "traefik" "--global" "challenge-mode" "" +} + +fn-traefik-computed-challenge-mode() { + local value + value="$(fn-traefik-global-challenge-mode)" + if [[ -z "$value" ]]; then + value="tls" + fi + echo "$value" +} + +fn-traefik-global-dns-provider() { fn-plugin-property-get-default "traefik" "--global" "dns-provider" "" } +fn-traefik-computed-dns-provider() { + fn-traefik-global-dns-provider +} + fn-traefik-dns-provider-env-vars() { declare desc="returns all dns-provider-* environment variables" fn-plugin-property-get-all-by-prefix "traefik" "--global" "dns-provider-" diff --git a/tests/unit/app-json.bats b/tests/unit/app-json.bats index 6a05be9d3..5afe62f53 100644 --- a/tests/unit/app-json.bats +++ b/tests/unit/app-json.bats @@ -278,7 +278,7 @@ teardown() { echo "output: $output" echo "status: $status" assert_success - assert_output "app.json" + assert_output "" run /bin/bash -c "dokku app-json:report $TEST_APP --format json" echo "output: $output" @@ -286,7 +286,7 @@ teardown() { assert_success assert_output_contains '"app-json-appjson-path":"app2.json"' assert_output_contains '"app-json-computed-appjson-path":"app2.json"' - assert_output_contains '"app-json-global-appjson-path":"app.json"' + assert_output_contains '"app-json-global-appjson-path":""' assert_output_contains "app-json-selected" 0 run /bin/bash -c "dokku app-json:report $TEST_APP --app-json-selected" diff --git a/tests/unit/archive-security.bats b/tests/unit/archive-security.bats index be4607922..03b4be01f 100644 --- a/tests/unit/archive-security.bats +++ b/tests/unit/archive-security.bats @@ -228,12 +228,24 @@ PY echo "output: $output" echo "status: $status" assert_success + assert_output "" + + run /bin/bash -c "dokku git:report --global --git-computed-archive-max-size" + echo "output: $output" + echo "status: $status" + assert_success assert_output "1073741824" run /bin/bash -c "dokku git:report --global --git-global-archive-max-files" echo "output: $output" echo "status: $status" assert_success + assert_output "" + + run /bin/bash -c "dokku git:report --global --git-computed-archive-max-files" + echo "output: $output" + echo "status: $status" + assert_success assert_output "10000" run /bin/bash -c "dokku git:set --global archive-max-size 2147483648" @@ -244,6 +256,12 @@ PY assert_success assert_output "2147483648" + run /bin/bash -c "dokku git:report --global --git-computed-archive-max-size" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "2147483648" + run /bin/bash -c "dokku git:set --global archive-max-size" assert_success } diff --git a/tests/unit/builder-dockerfile.bats b/tests/unit/builder-dockerfile.bats index e8f4cd6a9..badd66ff0 100644 --- a/tests/unit/builder-dockerfile.bats +++ b/tests/unit/builder-dockerfile.bats @@ -46,7 +46,7 @@ teardown() { echo "output: $output" echo "status: $status" assert_success - assert_output "Dockerfile" + assert_output "" run /bin/bash -c "dokku builder-dockerfile:report --global --format json | jq -r 'has(\"dockerfile-path\")'" echo "output: $output" @@ -64,7 +64,23 @@ teardown() { echo "output: $output" echo "status: $status" assert_success - assert_output "Dockerfile" + assert_output "" + + run /bin/bash -c "dokku builder-dockerfile:set --global dockerfile-path Dockerfile.custom" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku builder-dockerfile:report --global --builder-dockerfile-global-dockerfile-path" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "Dockerfile.custom" + + run /bin/bash -c "dokku builder-dockerfile:set --global dockerfile-path" + echo "output: $output" + echo "status: $status" + assert_success } @test "(builder-dockerfile:set)" { diff --git a/tests/unit/caddy.bats b/tests/unit/caddy.bats index e338c6fa7..68a760b53 100644 --- a/tests/unit/caddy.bats +++ b/tests/unit/caddy.bats @@ -18,13 +18,31 @@ teardown() { dokku nginx:start } -@test "(caddy:report) --global --caddy-log-level" { +@test "(caddy:report) --global global vs computed log-level" { + run /bin/bash -c "dokku caddy:report --global --caddy-global-log-level" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku caddy:report --global --caddy-computed-log-level" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "ERROR" + run /bin/bash -c "dokku caddy:set --global log-level DEBUG" echo "output: $output" echo "status: $status" assert_success - run /bin/bash -c "dokku caddy:report --global --caddy-log-level" + run /bin/bash -c "dokku caddy:report --global --caddy-global-log-level" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "DEBUG" + + run /bin/bash -c "dokku caddy:report --global --caddy-computed-log-level" echo "output: $output" echo "status: $status" assert_success @@ -34,6 +52,44 @@ teardown() { echo "output: $output" echo "status: $status" assert_success + + run /bin/bash -c "dokku caddy:report --global --caddy-global-log-level" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku caddy:report --global --caddy-computed-log-level" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "ERROR" +} + +@test "(caddy:report) --global raw and computed keys in --format json" { + run /bin/bash -c "dokku --quiet caddy:report --global --format json | jq -r '.\"global-image\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet caddy:report --global --format json | jq -r '.\"computed-image\"'" + echo "output: $output" + echo "status: $status" + assert_success + refute_output "" + + run /bin/bash -c "dokku --quiet caddy:report --global --format json | jq -r '.\"global-polling-interval\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet caddy:report --global --format json | jq -r '.\"computed-polling-interval\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "5s" } @test "(caddy) global-only keys" { @@ -80,7 +136,7 @@ teardown() { echo "output: $output" echo "status: $status" assert_success - assert_output "false" + assert_output "" run /bin/bash -c "dokku caddy:set $TEST_APP tls-internal true" echo "output: $output" diff --git a/tests/unit/checks.bats b/tests/unit/checks.bats index 5c60f5b86..bf17cebe6 100644 --- a/tests/unit/checks.bats +++ b/tests/unit/checks.bats @@ -41,27 +41,44 @@ teardown() { } @test "(checks:report) --global --format json" { + run /bin/bash -c "dokku checks:set --global wait-to-retire" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku --quiet checks:report --global --format json | jq -e ." + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku --quiet checks:report --global --format json | jq -r '.\"global-wait-to-retire\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet checks:report --global --format json | jq -r '.\"computed-wait-to-retire\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "60" + run /bin/bash -c "dokku checks:set --global wait-to-retire 90" echo "output: $output" echo "status: $status" assert_success - run /bin/bash -c "dokku checks:report --global --format json | jq -e ." - echo "output: $output" - echo "status: $status" - assert_success - - run /bin/bash -c "dokku checks:report --global --format json | jq -r '.\"global-wait-to-retire\"'" + run /bin/bash -c "dokku --quiet checks:report --global --format json | jq -r '.\"global-wait-to-retire\"'" echo "output: $output" echo "status: $status" assert_success assert_output "90" - run /bin/bash -c "dokku checks:report --global --format json | jq -r 'has(\"wait-to-retire\")'" + run /bin/bash -c "dokku --quiet checks:report --global --format json | jq -r '.\"computed-wait-to-retire\"'" echo "output: $output" echo "status: $status" assert_success - assert_output "false" + assert_output "90" run /bin/bash -c "dokku checks:report --global" echo "output: $output" @@ -69,16 +86,22 @@ teardown() { assert_success assert_output_contains "global checks information" - run /bin/bash -c "dokku checks:report --global --checks-global-wait-to-retire" - echo "output: $output" - echo "status: $status" - assert_success - assert_output "90" - run /bin/bash -c "dokku checks:set --global wait-to-retire" echo "output: $output" echo "status: $status" assert_success + + run /bin/bash -c "dokku checks:report --global --checks-global-wait-to-retire" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku checks:report --global --checks-computed-wait-to-retire" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "60" } @test "(checks) checks:help" { diff --git a/tests/unit/git_1.bats b/tests/unit/git_1.bats index bd0eaeae7..459a5e571 100644 --- a/tests/unit/git_1.bats +++ b/tests/unit/git_1.bats @@ -145,6 +145,60 @@ teardown() { assert_output "false" } +@test "(git:report) --global raw and computed keys" { + run /bin/bash -c "dokku --quiet git:report --global --format json | jq -r '.\"global-deploy-branch\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet git:report --global --format json | jq -r '.\"computed-deploy-branch\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "master" + + run /bin/bash -c "dokku --quiet git:report --global --format json | jq -r '.\"global-archive-max-files\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet git:report --global --format json | jq -r '.\"computed-archive-max-files\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "10000" + + run /bin/bash -c "dokku git:set --global deploy-branch main" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku --quiet git:report --global --format json | jq -r '.\"global-deploy-branch\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "main" + + run /bin/bash -c "dokku --quiet git:report --global --format json | jq -r '.\"computed-deploy-branch\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "main" + + run /bin/bash -c "dokku git:set --global deploy-branch" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku --quiet git:report --global --format json | jq -r '.\"global-deploy-branch\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" +} + @test "(git) git:help" { run /bin/bash -c "dokku git" echo "output: $output" diff --git a/tests/unit/git_3.bats b/tests/unit/git_3.bats index 01d04aeca..069816cd4 100644 --- a/tests/unit/git_3.bats +++ b/tests/unit/git_3.bats @@ -887,7 +887,13 @@ teardown() { echo "output: $output" echo "status: $status" assert_success - assert_output "master" + assert_output "" + + run /bin/bash -c "dokku git:report $TEST_APP --format json | jq -r '.\"computed-deploy-branch\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "main" run /bin/bash -c "dokku git:report $TEST_APP --format json | jq -e ." echo "output: $output" @@ -925,6 +931,12 @@ teardown() { echo "output: $output" echo "status: $status" assert_success + assert_output "" + + run /bin/bash -c "dokku git:report --global --format json | jq -r '.\"computed-deploy-branch\"'" + echo "output: $output" + echo "status: $status" + assert_success assert_output "master" run /bin/bash -c "dokku git:report --global --format json | jq -r 'has(\"deploy-branch\")'" @@ -937,5 +949,11 @@ teardown() { echo "output: $output" echo "status: $status" assert_success + assert_output "" + + run /bin/bash -c "dokku git:report --global --git-computed-deploy-branch" + echo "output: $output" + echo "status: $status" + assert_success assert_output "master" } diff --git a/tests/unit/haproxy.bats b/tests/unit/haproxy.bats index 5004ac516..1a7bee8c0 100644 --- a/tests/unit/haproxy.bats +++ b/tests/unit/haproxy.bats @@ -57,7 +57,13 @@ teardown() { echo "status: $status" assert_success - run /bin/bash -c "dokku haproxy:report --global --haproxy-refresh-conf" + run /bin/bash -c "dokku haproxy:report --global --haproxy-global-refresh-conf" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "5" + + run /bin/bash -c "dokku haproxy:report --global --haproxy-computed-refresh-conf" echo "output: $output" echo "status: $status" assert_success @@ -74,7 +80,42 @@ teardown() { echo "status: $status" assert_success - run /bin/bash -c "dokku haproxy:report --global --haproxy-refresh-conf" + run /bin/bash -c "dokku haproxy:report --global --haproxy-global-refresh-conf" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku haproxy:report --global --haproxy-computed-refresh-conf" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "10" +} + +@test "(haproxy:report) --global raw and computed keys in --format json" { + run /bin/bash -c "dokku haproxy:set --global refresh-conf" + assert_success + + run /bin/bash -c "dokku --quiet haproxy:report --global --format json | jq -r '.\"global-image\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet haproxy:report --global --format json | jq -r '.\"computed-image\"'" + echo "output: $output" + echo "status: $status" + assert_success + refute_output "" + + run /bin/bash -c "dokku --quiet haproxy:report --global --format json | jq -r '.\"global-refresh-conf\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet haproxy:report --global --format json | jq -r '.\"computed-refresh-conf\"'" echo "output: $output" echo "status: $status" assert_success diff --git a/tests/unit/network.bats b/tests/unit/network.bats index 311fa3154..3cfa75686 100644 --- a/tests/unit/network.bats +++ b/tests/unit/network.bats @@ -66,6 +66,47 @@ teardown() { assert_success } +@test "(network:report) tld raw vs computed" { + run /bin/bash -c "dokku network:set --global tld" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku --quiet network:report --global --format json | jq -r '.\"network-global-tld\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku network:set --global tld example.test" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku --quiet network:report --global --format json | jq -r '.\"network-global-tld\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "example.test" + + run /bin/bash -c "dokku --quiet network:report $TEST_APP --format json | jq -r '.\"network-global-tld\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "example.test" + + run /bin/bash -c "dokku --quiet network:report $TEST_APP --format json | jq -r '.\"network-computed-tld\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "example.test" + + run /bin/bash -c "dokku network:set --global tld" + echo "output: $output" + echo "status: $status" + assert_success +} + @test "(network) network:set bind-all-interfaces" { run deploy_app echo "output: $output" diff --git a/tests/unit/proxy.bats b/tests/unit/proxy.bats index 259c3435d..d87853c19 100644 --- a/tests/unit/proxy.bats +++ b/tests/unit/proxy.bats @@ -28,6 +28,54 @@ teardown() { assert_output "$help_output" } +@test "(proxy:report) --global raw vs computed type" { + run /bin/bash -c "dokku --quiet proxy:report --global --format json | jq -r '.\"proxy-global-type\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet proxy:report --global --format json | jq -r '.\"proxy-computed-type\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "nginx" + + run /bin/bash -c "dokku proxy:set --global type caddy" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku --quiet proxy:report --global --format json | jq -r '.\"proxy-global-type\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "caddy" + + run /bin/bash -c "dokku --quiet proxy:report --global --format json | jq -r '.\"proxy-computed-type\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "caddy" + + run /bin/bash -c "dokku proxy:set --global type" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku --quiet proxy:report --global --format json | jq -r '.\"proxy-global-type\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet proxy:report --global --format json | jq -r '.\"proxy-computed-type\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "nginx" +} + @test "(proxy:set) invalid port mapping set" { run /bin/bash -c "dokku proxy:set $TEST_APP http:80:80" echo "output: $output" diff --git a/tests/unit/scheduler-docker-local.bats b/tests/unit/scheduler-docker-local.bats index f5ef9ec5d..29c76196c 100644 --- a/tests/unit/scheduler-docker-local.bats +++ b/tests/unit/scheduler-docker-local.bats @@ -10,17 +10,29 @@ teardown() { global_teardown } -@test "(scheduler-docker-local:report) --global --scheduler-docker-local-global-init-process" { +@test "(scheduler-docker-local:report) --global raw and computed keys" { run /bin/bash -c "dokku scheduler-docker-local:report --global --scheduler-docker-local-global-init-process" echo "output: $output" echo "status: $status" assert_success + assert_output "" + + run /bin/bash -c "dokku scheduler-docker-local:report --global --scheduler-docker-local-computed-init-process" + echo "output: $output" + echo "status: $status" + assert_success assert_output "true" run /bin/bash -c "dokku scheduler-docker-local:report --global --scheduler-docker-local-global-parallel-schedule-count" echo "output: $output" echo "status: $status" assert_success + assert_output "" + + run /bin/bash -c "dokku scheduler-docker-local:report --global --scheduler-docker-local-computed-parallel-schedule-count" + echo "output: $output" + echo "status: $status" + assert_success assert_output "1" } @@ -46,7 +58,7 @@ teardown() { echo "output: $output" echo "status: $status" assert_success - assert_output "1" + assert_output "" run /bin/bash -c "dokku scheduler-docker-local:report $TEST_APP --scheduler-docker-local-init-process" echo "output: $output" @@ -64,7 +76,7 @@ teardown() { echo "output: $output" echo "status: $status" assert_success - assert_output "true" + assert_output "" run /bin/bash -c "dokku scheduler-docker-local:report $TEST_APP --scheduler-docker-local-invalid-flag" echo "output: $output" @@ -99,7 +111,7 @@ teardown() { run /bin/bash -c "dokku scheduler-docker-local:report $TEST_APP --format json | jq -r '.\"global-init-process\"'" echo "output: $output" echo "status: $status" - assert_output "true" + assert_output "" run /bin/bash -c "dokku scheduler-docker-local:report $TEST_APP --format json | jq -r '.\"parallel-schedule-count\"'" echo "output: $output" @@ -114,7 +126,7 @@ teardown() { run /bin/bash -c "dokku scheduler-docker-local:report $TEST_APP --format json | jq -r '.\"global-parallel-schedule-count\"'" echo "output: $output" echo "status: $status" - assert_output "1" + assert_output "" run /bin/bash -c "dokku scheduler-docker-local:set $TEST_APP init-process false" echo "output: $output" diff --git a/tests/unit/traefik.bats b/tests/unit/traefik.bats index 1f2937084..cd171498c 100644 --- a/tests/unit/traefik.bats +++ b/tests/unit/traefik.bats @@ -23,13 +23,31 @@ teardown() { dokku nginx:start } -@test "(traefik:report) --global --traefik-log-level" { +@test "(traefik:report) --global global vs computed log-level" { + run /bin/bash -c "dokku traefik:report --global --traefik-global-log-level" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku traefik:report --global --traefik-computed-log-level" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "ERROR" + run /bin/bash -c "dokku traefik:set --global log-level DEBUG" echo "output: $output" echo "status: $status" assert_success - run /bin/bash -c "dokku traefik:report --global --traefik-log-level" + run /bin/bash -c "dokku traefik:report --global --traefik-global-log-level" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "DEBUG" + + run /bin/bash -c "dokku traefik:report --global --traefik-computed-log-level" echo "output: $output" echo "status: $status" assert_success @@ -39,6 +57,44 @@ teardown() { echo "output: $output" echo "status: $status" assert_success + + run /bin/bash -c "dokku traefik:report --global --traefik-global-log-level" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku traefik:report --global --traefik-computed-log-level" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "ERROR" +} + +@test "(traefik:report) --global raw and computed keys in --format json" { + run /bin/bash -c "dokku --quiet traefik:report --global --format json | jq -r '.\"global-api-vhost\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet traefik:report --global --format json | jq -r '.\"computed-api-vhost\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "traefik.dokku.me" + + run /bin/bash -c "dokku --quiet traefik:report --global --format json | jq -r '.\"global-dashboard-enabled\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "" + + run /bin/bash -c "dokku --quiet traefik:report --global --format json | jq -r '.\"computed-dashboard-enabled\"'" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "false" } @test "(traefik) global-only keys" { @@ -409,7 +465,7 @@ teardown() { } @test "(traefik) [dns-01] challenge-mode property" { - run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-challenge-mode" + run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-computed-challenge-mode" echo "output: $output" echo "status: $status" assert_success @@ -420,7 +476,7 @@ teardown() { echo "status: $status" assert_success - run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-challenge-mode" + run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-computed-challenge-mode" echo "output: $output" echo "status: $status" assert_success @@ -431,7 +487,7 @@ teardown() { echo "status: $status" assert_success - run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-challenge-mode" + run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-computed-challenge-mode" echo "output: $output" echo "status: $status" assert_success @@ -439,7 +495,7 @@ teardown() { } @test "(traefik) [dns-01] dns-provider property" { - run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-dns-provider" + run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-computed-dns-provider" echo "output: $output" echo "status: $status" assert_success @@ -450,7 +506,7 @@ teardown() { echo "status: $status" assert_success - run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-dns-provider" + run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-computed-dns-provider" echo "output: $output" echo "status: $status" assert_success @@ -461,7 +517,7 @@ teardown() { echo "status: $status" assert_success - run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-dns-provider" + run /bin/bash -c "dokku traefik:report $TEST_APP --traefik-computed-dns-provider" echo "output: $output" echo "status: $status" assert_success