Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack deploy vs service update, compose-like update #37658

Open
Vanuan opened this issue Aug 16, 2018 · 2 comments
Open

Stack deploy vs service update, compose-like update #37658

Vanuan opened this issue Aug 16, 2018 · 2 comments

Comments

@Vanuan
Copy link

Vanuan commented Aug 16, 2018

Description

For the blue-green deployment I need to change labels of my services whenever I switch from blue to green. So I went ahead and created two compose files: production-labels.yml and preparing-labels.yml. There's also "base" deploy file: deploy-base.yml.

The idea is that as I switch blue stack from "preparing" to "production" and green stack from "production" to "preparing", services in these two stack are not restarted. I checked it with docker service update --label-rm preparing --label-add production=true, services are fine.

The problem I'm facing is that it doesn't seem possible to do the same with docker deploy -c command. For example, if I change anything in deploy-base.yml, e.g. change image tag, when I'm doing the switch I can't preserve old image tags when applying new labels.

So here I am, asking for a feature to be able to do incremental stack deploy. That is, if I provide a compose file, only options that are present in this file are applied to current deployment.

Alternatively, I would be fine with a feature that can "dump" current stack into a generated compose file.

@Vanuan
Copy link
Author

Vanuan commented Aug 16, 2018

For the "dump current stack" there's a feature in swarmpit:
https://github.com/swarmpit/swarmpit/blob/1.5/src/clj/swarmpit/docker/engine/mapper/compose.clj

Unfortunately, it's written in Clojure, so can't be reused in docker. But I think it's a reasonable feature to do "partial" docker stack deploy. For example, there's --prune flag that removes services not included in current compose file. Maybe there's (would be) a similar --override flag which doesn't touch options not included in compose file.

The execution would be similar to:

docker stack dump --compose stack.yml
docker stack deploy -c stack.yml -c production-overrides.yml

For array and map options there's also functionality needed to specify whether override or extend options. As I understand there's only "extend" currently.

@Vanuan
Copy link
Author

Vanuan commented Aug 17, 2018

Alternatively, we can generate service update commands out of production-overrides.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants