25 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
1a376c3622 fix: prevent command injection via docker options eval
Values supplied through docker options, `--ttl-seconds`, and `-e` flowed into a Bash `eval` during build, deploy, and run, letting a low-privileged user execute arbitrary commands on the host as the dokku user. These arguments are now tokenized and passed through to the container verbatim, without shell expansion. A one-time migration repairs stored labels whose backticks were saved with a stray backslash so Traefik-style rules stay valid on the next deploy.
2026-07-19 01:42:12 -04:00
Jose Diaz-Gonzalez
5d802e3cf4 fix: separate docker-args outputs to avoid arg collisions
Emitting the restart policy as a `--restart` argument from a `docker-args-process-deploy` trigger exposed a latent gluing bug: proxy and builder triggers concatenated `$STDIN$output` with no separator, and the scheduler and builders appended `docker-args-process-*` output directly onto the older `docker-args-*` output, so adjacent arguments could merge into values like `--restart=on-failure:10--label`. A space is now inserted at both the trigger echo and the concatenation so arguments always stay separated.
2026-05-28 04:16:55 -04:00
Jose Diaz-Gonzalez
7d73cf78c4 feat: split scheduler-docker-local report into raw, computed, and global
The bare `init-process` and `parallel-schedule-count` keys previously returned the computed value, so external tooling could not tell whether a property had been set on the app or was merely defaulting. Both properties are now also configurable with `--global`, the report exposes `computed-*` and `global-*` keys alongside the bare raw keys, and the deploy path honors the global value before falling back to the linuxserver.io vendor heuristic.
2026-05-11 22:29:28 -04:00
Jose Diaz-Gonzalez
4927ca092d fix: retire orphaned containers when scaling down
When scaling a process type to a smaller count, the indices above the
new count had their `CONTAINER.<proctype>.<idx>` state files deleted but
the underlying Docker containers were never registered for retirement,
so they remained running indefinitely. The cleanup block now reads each
orphaned state file and registers its container id with the existing
`scheduler-register-retired` trigger before the file is removed.
2026-04-27 03:23:15 -04:00
Jose Diaz-Gonzalez
915172c0c5 fix: move proxy-port properties to proxy plugin and fix CI failures
- Move proxy-port and proxy-ssl-port properties from ports plugin to
  proxy plugin where they conceptually belong
- Generalize proxy:set to handle any property (matching ps:set pattern)
  instead of only handling the type property
- Fix apps:set --global flag parsing (pflag treats --global as a flag,
  not an argument — must be defined explicitly like ps:set does)
- Add missing property-functions source to scheduler-docker-local
  shell scripts (scheduler-enter, scheduler-run, scheduler-deploy,
  check-deploy, bin/scheduler-deploy-process-container)
- Update nginx-vhosts property references from ports to proxy plugin
- Update tests to use proxy:set for proxy-port properties
2026-04-25 17:19:42 -04:00
Jose Diaz-Gonzalez
1308e21947 feat: migrate environment variables to plugin properties
Standardize how environment variables are migrated to properties during
install triggers and migrate all remaining DOKKU_* config vars to their
appropriate plugin properties.

Adds a reusable MigrateConfigToProperties() function in the common
package with Transform callback and ListProperty support, plus a
migrate-config-to-property subcommand for the prop binary so shell
plugins can use the same code path.

Migrated variables and their new property owners:
- DOKKU_APP_PROXY_TYPE/DOKKU_PROXY_TYPE → proxy type
- DOKKU_DISABLE_PROXY → proxy disabled
- DOKKU_PROXY_PORT → ports proxy-port
- DOKKU_PROXY_SSL_PORT → ports proxy-ssl-port
- DOKKU_APP_RESTORE → ps restore
- DOKKU_SKIP_DEPLOY → ps skip-deploy
- DOKKU_START_CMD → ps start-cmd
- DOKKU_DOCKERFILE_START_CMD → ps dockerfile-start-cmd
- DOKKU_DISABLE_APP_AUTOCREATION → apps disable-autocreation
- DOKKU_APP_SHELL → scheduler shell
- DOKKU_SKIP_CLEANUP → builder skip-cleanup
- DOKKU_CHECKS_DISABLED → checks disabled
- DOKKU_CHECKS_SKIPPED → checks skipped
- DOKKU_CHECKS_WAIT → checks wait
- DOKKU_CHECKS_TIMEOUT → checks timeout
- DOKKU_CHECKS_ATTEMPTS → checks attempts
- DOKKU_DEFAULT_CHECKS_WAIT → checks default-wait
- DOKKU_SKIP_ALL_CHECKS → checks disabled (legacy)
- DOKKU_SKIP_DEFAULT_CHECKS → checks skipped (legacy)

Also refactors existing bespoke migration loops in scheduler, ports, ps,
builder, and nginx-vhosts plugins to use the standardized utility.

Removes DOKKU_PARALLEL_ARGUMENTS from documentation (unused in core).
Deprecates fn-migrate-config-to-property bash function.

closes #1558
2026-04-25 05:11:07 -04:00
Jose Diaz-Gonzalez
0ac5dbc79b fix: do not attempt to expose the same mapped port more than once
A newer release of Docker (27.3.1) appears to have issues with the -p flag appearing the same time more than once for a given port. This was previously not an issue, but we should remove the problem on our end regardless.

Closes #7251
2024-10-08 23:56:30 -04:00
Jose Diaz-Gonzalez
d2cf2e7b91 fix: popd out of tmp directory after a git push-based deployment
Without this, we end up with PWD issues as the tmp directory is removed automatically after a build.

Closes #6771
2024-03-28 20:53:31 -04:00
Jose Diaz-Gonzalez
c9b9c2ab25 chore: run shfmt 2024-03-14 15:02:57 -04:00
Jose Diaz-Gonzalez
6e3631afeb fix: correct warning placement and update tests to account for parallel's behavior 2024-03-14 14:59:49 -04:00
Jose Diaz-Gonzalez
43c255436d feat: warn when publish ports if scaling up or zero downtime is enabled
Closes #4662
2024-03-14 11:53:57 -04:00
Jose Diaz-Gonzalez
874f2dfaf4 feat: set the platform flag in order to run amd64 images on arm64 deploy targets
This allows folks to use herokuish, pack, and lambda built-images on arm64 servers.

Closes #6312
2024-01-19 06:37:48 -05:00
Jose Diaz-Gonzalez
200e46b08e fix: ensure tmp files are cleaned up when commands exit 2023-08-19 23:00:49 -04:00
Jose Diaz-Gonzalez
f8ccf52079 refactor: only use detected port mapping if override is not specified
Previously, we would always set the port mapping during a dockerfile build, making it difficult for users to override mappings. We also only _sometimes_ updated the detected port mapping, further confusing issues when users were migrating from Dockerfile to Buildpacks for builds.

Now, we always detect the port mapping during the build process, and only use that detected port mapping if an override is not specified. This greatly simplifies the experience around port mapping, as now a user can create an app, set a port mapping, and that first deploy will respect the port mapping without an additional deploy.

The builder always has the best context for what the app should be listening on, and thus we can always specify a "default" port mapping at this stage. Users can override this map as desired later.

This change also results in the removal of a ton of internal code that is now centralized in the ports plugin.

Closes #4067
2023-08-05 10:58:57 -04:00
Jose Diaz-Gonzalez
dac566e75e refactor: move all shellcheck disable definitions to .shellcheckrc file
This makes standard use of shellcheck work without needing to provide extra configuration anywhere.

Also remove use of inline 'shellcheck disable' calls that are already defined in the .shellcheckrc and don't need to be set inline.
2023-08-05 10:58:57 -04:00
Jose Diaz-Gonzalez
25a49624c7 fix: trigger nginx proxy rebuild early to avoid downtime if deploying large numbers of processes
Due to how the nginx proxy implementation works, if an app has either many process types or many containers for a process type other than web, it is possible to see downtime on the web process due to the old web containers rotating out _before_ we reload the nginx config.

The correct fix would be to use some sort of dns-based resolution for the nginx config, but pending that change, we reload nginx twice now - ugh - to avoid this.
2023-01-21 14:55:41 -05:00
Jose Diaz-Gonzalez
f09b960997 tests: add a unit test for the init-process option 2022-08-14 13:45:41 -04:00
Jose Diaz-Gonzalez
bc4eaa002f fix: correct shfmt issue 2022-08-11 13:07:00 -04:00
Jose Diaz-Gonzalez
045825857a fix: add missing source and respect any user settings for init-process property 2022-08-11 11:51:31 -04:00
Jose Diaz-Gonzalez
293ead4f35 feat: force-disable the --init flag for linuxserver images
All linuxserver images uses S6, and there are enough of them that this makes sense to autodetect on behalf of users.
2022-08-10 21:33:08 -04:00
Jose Diaz-Gonzalez
c4c6ac5617 feat: add the ability to disable the init process
This allows projects using s6 overlay - in particular linxserver images - the ability to disable --init flag injection.

Closes #5287
2022-08-10 21:32:55 -04:00
Jose Diaz-Gonzalez
f0095fec2f fix: ensure we use the correct variable for WAIT
A previous refactor ended up disabling waits completely, potentially causing app downtime during deploys.
2022-03-02 01:18:41 -05:00
Jose Diaz-Gonzalez
55554ce9bd feat: add ability to increase the max parallelism when deploying a given process type 2021-10-09 22:44:03 -04:00
Jose Diaz-Gonzalez
76201aed64 feat: add ability to deploy process types in parallel 2021-10-06 02:04:21 -04:00
Jose Diaz-Gonzalez
52d9cb6188 fix: filter link and volume flags for dockerfile builds
The link flag was previously not filtered _after_ fetching build args for dockerfile builds, which meant if a plugin exposed that in it's own docker-args-build trigger, it would break deploys.

Additionally, allow for whitespaces between link and volume flags.
2021-10-05 12:20:34 -04:00