Docker Community Forums

Share and learn in the Docker community.

Auto scaling node cluster from 0-n; service redeployment

(Geoff Bowers) #1

Need to run a STAGE/QA node cluster only during business hours; looking to set up a schedule that scales a node cluster from 0-n nodes (and back to n-0) on a specific timetable.

I think i have a handle on how i might automate the scaling of the node cluster, but i can’t seem to sort out the re-deployment of services that stop when the cluster is reduced to 0.

Is it possible to have services automatically deploy when a node cluster scales from 0-n? Or will I have to schedule the re-depoyment of specific services after the node cluster is active?

The every_node deployment strategy deploys services automatically on node creation, but there doesn’t appear to be an equivalent event for stopped services whose container count target_num_containers is below the nominated value.

It would be a great feature to have a check on node activation for any services that are not at their target_num_containers and to subsequently attempt to deploy those containers into the newly available resource.

(Geoff Bowers) #2

Given the enormous interest in this topic, thought i might share a little app that I use to bring the staging cluster up and down:


  image: 'daemonite/dockercloud-schedule:latest'
  autoredeploy: true
    - prod

The container is hardcoded to bring the servers up/down every day from 8am-8pm (Australian Eastern Standard). Building your own container is easy enough. I’ve published the source code on github: