Skip to content

feat: implement ps scale task#121

Merged
josegonzalez merged 5 commits intomasterfrom
11-implement-ps-scale-task
Apr 25, 2026
Merged

feat: implement ps scale task#121
josegonzalez merged 5 commits intomasterfrom
11-implement-ps-scale-task

Conversation

@josegonzalez
Copy link
Copy Markdown
Member

Summary

  • Adds PsScaleTask implementing dokku_ps_scale, compatible with the upstream ansible-dokku module
  • Supports app, scale (map of process type to count), skip_deploy, and state (present only) parameters
  • Idempotent: compares desired vs current scale and only changes what differs
  • Integration tests deploy dokku/smoke-test-app:dockerfile and verify container counts via docker inspect
  • Enhanced service link test to deploy smoke test app and verify REDIS_URL inside running container via docker exec
  • Updated existing git:from-image test to use dokku/smoke-test-app:dockerfile

Closes #11

Adds PsScaleTask that manages process scaling for dokku applications,
compatible with the upstream ansible-dokku dokku_ps_scale module.

Supports idempotent scaling with skip_deploy option. Integration tests
deploy dokku/smoke-test-app:dockerfile and verify container counts via
docker inspect. Service link test enhanced with docker exec verification
of REDIS_URL inside running containers.
… in tests

getPsScale() now strips whitespace and splits on colons, matching the
upstream ansible module's parsing of dokku ps:scale output format.

Integration tests run dokku cleanup before verifying container counts
to remove old containers from previous deploy generations.
Dokku renames old containers with a timestamp suffix (app.web.1.TIMESTAMP)
and interim containers use an .upcoming- suffix during deploys. These
renamed containers may still be running during the wait-to-retire period.

Replace dokkuCleanup/getRunningContainers with getActiveContainers that
filters docker ps results by container name, only including containers
with exactly 3 dot-separated segments (app.process.N) which are the
active deployment containers.
Old containers from previous deploys may still be running during the
wait-to-retire period (default 60s). Force-retire and cleanup before
each container count check to ensure accurate results.
Read container IDs from dokku's internal CONTAINER.process.N files
instead of filtering docker ps output. These files are the authoritative
source for current deployment containers and are properly updated when
scaling down (stale files are removed during deploy).

This avoids issues with orphaned containers from previous deployments
that may still be running but are no longer part of the current formation.
@josegonzalez josegonzalez merged commit 13d806d into master Apr 25, 2026
10 checks passed
@josegonzalez josegonzalez deleted the 11-implement-ps-scale-task branch April 25, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement ps_scale_task

1 participant