Previously we used the heritage deploy service to set the task count desired. The issue with this was that the heritage deployer would always create a new task definition, and then deploy that. This meant that ECS would create a new set of tasks with the new count before removing the old set of tasks. This resulted in if you wanted to scale a service from 10 to 20 tasks, you would have a transient situation of 30 tasks online.
This was suboptimal, and this PR fixes that. It calls ECS directly to modify the task count, and updates the db so non-changes do not get propagated.
How to test
You can use a local ver to test it on any account you have
bcn login https://mytestbarcelona
bcn district create --region ap-northeast-1 test
bcn endpoint create -d test --public hello
cd barcelona-hello <- this is just the barcelona hello repo
bcn create -e hello -d test
bcn api post /districts/test/heritages/hello/services/web/count '{"desired_container_count": 2}'
note that no new task definition is created but the container count is immediately updated.
Previously we used the heritage deploy service to set the task count desired. The issue with this was that the heritage deployer would always create a new task definition, and then deploy that. This meant that ECS would create a new set of tasks with the new count before removing the old set of tasks. This resulted in if you wanted to scale a service from 10 to 20 tasks, you would have a transient situation of 30 tasks online.
This was suboptimal, and this PR fixes that. It calls ECS directly to modify the task count, and updates the db so non-changes do not get propagated.
How to test
You can use a local ver to test it on any account you have
bcn login https://mytestbarcelona
bcn district create --region ap-northeast-1 test
bcn endpoint create -d test --public hello
cd barcelona-hello
<- this is just the barcelona hello repobcn create -e hello -d test
bcn api post /districts/test/heritages/hello/services/web/count '{"desired_container_count": 2}'
note that no new task definition is created but the container count is immediately updated.