docker / app

Make your Docker Compose applications reusable, and share them on Docker Hub
Apache License 2.0
1.57k stars 177 forks source link

Subkeys render error - parallelism and max_failure_ratio #559

Closed johnbizokk closed 5 years ago

johnbizokk commented 5 years ago

Description

Currently, we adopt the Docker App project to our software development needs to power up the multiple environments (production, staging, feature branches, etc.). First, we faced was the rendering problem. We can't parameterize the values of the following keys rollback_config - parallelism and max_failure_ratio. We have to store the values for these keys in the docker-compose.yml file. I also tried to replace the values with variables from the other blocks, for example, "${deploy.update-config.parallelism}" but have not got any success. Summarizing the above, we have the only one working declaration - see the Annex №3.

Steps to reproduce the issue:

  1. Have the docker-compose file with the following content - see the Annex №1 below.
  2. Have the parameters.yml file with the following content - see the Annex №2 below.
  3. Execute the following render command - docker-app-standalone-linux render.

Describe the results you received:

Unfortunately we receive the following errors:

Describe the results you expected:

We expect from docker app binary to render values correctly.

Additional information you seem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Version:           18.09.6
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        481bc77
 Built:             Sat May  4 02:36:00 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.6
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       481bc77
  Built:            Sat May  4 02:02:43 2019
  OS/Arch:          linux/amd64
  Experimental:     true

Output of docker-app version:

Version:               v0.8.0
Git commit:            7eea32b7
Built:                 Tue Jun 11 20:53:26 2019
OS/Arch:               linux/amd64
Experimental:          off
Renderers:             none
Invocation Base Image: docker/cnab-app-base:v0.8.0

Output of docker info:

Containers: X
 Running: X
 Paused: X
 Stopped: X
Images: X
Server Version: 18.09.6
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: local
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: active
 NodeID: ID
 Is Manager: false
 Node Address: IP
 Manager Addresses:
  IP
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-957.12.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 13.02GiB
Name: IPADDR
ID: ID
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Annex №1 (docker-compose.yml)

version: "3.7"
x-update:
  &default-update
  update_config:
    parallelism: "${deploy.update-config.parallelism}"
    delay: "${deploy.update-config.delay}"
    failure_action: "${deploy.update-config.failure_action}"
    max_failure_ratio: "${deploy.update-config.max_failure_ratio}"
    order: "${deploy.update-config.order}"
x-rollback:
  &default-rollback
  rollback_config:
    parallelism: "${deploy.rollback-config.parallelism}"
    delay: "${deploy.rollback-config.delay}"
    failure_action: "${deploy.rollback-config.failure_action}"
    max_failure_ratio: "${deploy.rollback-config.max_failure_ratio}"
    order: "${deploy.rollback-config.order}"
x-restart:
  &default-restart
  restart_policy:
    condition: "${deploy.restart-policy.condition}"
    delay: "${deploy.restart-policy.delay}"
    max_attempts: "${deploy.restart-policy.max_attempts}"
    window: "${deploy.restart-policy.window}"
services:
  application:
    deploy:
      <<: *default-update
      <<: *default-rollback
      <<: *default-restart
    image: "image_name"
    x-enabled: "${enable-application}"

Annex №2 (parameters.yml)

enable-application: true
deploy:
  update-config:
    parallelism: 1
    delay: 2s
    failure_action: rollback
    max_failure_ratio: 0.1
    order: stop-first
  rollback-config:
    parallelism: 1
    delay: 2s
    failure_action: pause
    max_failure_ratio: 0.1
    order: stop-first
  restart-policy:
    condition: any
    delay: 2s
    max_attempts: 5
    window: 60s

Annex №3 (docker-compose.yml)

version: "3.7"
x-update:
  &default-update
  update_config:
    parallelism: "${deploy.update-config.parallelism}"
    delay: "${deploy.update-config.delay}"
    failure_action: "${deploy.update-config.failure_action}"
    max_failure_ratio: "${deploy.update-config.max_failure_ratio}"
    order: "${deploy.update-config.order}"
x-rollback:
  &default-rollback
  rollback_config:
    parallelism: 1
    delay: "${deploy.rollback-config.delay}"
    failure_action: "${deploy.rollback-config.failure_action}"
    max_failure_ratio: 0.1
    order: "${deploy.rollback-config.order}"
x-restart:
  &default-restart
  restart_policy:
    condition: "${deploy.restart-policy.condition}"
    delay: "${deploy.restart-policy.delay}"
    max_attempts: "${deploy.restart-policy.max_attempts}"
    window: "${deploy.restart-policy.window}"
services:
  application:
    deploy:
      <<: *default-update
      <<: *default-rollback
      <<: *default-restart
    image: "image_name"
    x-enabled: "${enable-application}"
silvin-lubecki commented 5 years ago

Hello @johnbizokk, thank you for this issue 👍 We tracked it down into the docker/cli compose interpolation library, and the bug lies there. There are some casting instructions for update_config, but nothing for rollback_config. We'll fix this directly in docker/cli. Thanks again 👍

silvin-lubecki commented 5 years ago

The fix has been submitted here https://github.com/docker/cli/pull/1973

johnbizokk commented 5 years ago

@silvin-lubecki Hello! Is there any visible date of the next release of the Docker App, which will include the latest fixes (for example - this one)? Is there any release cycle of the Docker App or some interconnection between the Docker App and some significant updates of the Docker CE? From my point of view, the release cycle of the subordinate projects strongly connected to the final release stage of the new Docker CE version.

silvin-lubecki commented 5 years ago

Hello @johnbizokk , yes right now the release of docker-app is tight to the docker release, see docker-app as a part of the docker cli.