edit-icon download-icon

rolling_updates

Last Updated: Nov 14, 2017

During a service update, if the service includes more than one container (defined by the scale label), the (N+1)th container is updated after the Nth container is successfully updated. In this way, the service downtime is minimized.

Example:

Deploy the WordPress service. Specify to deploy 2 containers by using the scale label. Use the rolling_updates label to minimize the service downtime for WordPress.

  1. web:
  2. image: wordpress
  3. ports:
  4. - 80
  5. restart: always
  6. links:
  7. - 'db:mysql'
  8. labels:
  9. aliyun.logs: /var/log
  10. aliyun.routing.port_80: http://wordpress
  11. aliyun.rolling_updates: 'true'
  12. aliyun.scale: '2'
  13. db:
  14. image: mariadb
  15. environment:
  16. MYSQL_ROOT_PASSWORD: example
  17. restart: always
  18. labels:
  19. aliyun.logs: /var/log/mysql

parallelism

The parallelism label defines how many containers that rolling_updates can concurrently update at a time.

Note: This label must be used with the rolling_updates label.

parallelism value:

  • The default value is 1, namely, updating one container at a time.
  • When the value is greater than 1, during rolling_updates, a certain number (defined by the parallelism label) of containers are concurrently updated at a time to realize the batch update.
  • When the value is invalid, the default value 1 is used.

    Note: To ensure that at least one container is providing service, we recommend that the defined parallelism value is less than the number of containers in the service.

Example:

Deploy the Nginx service. Specify to deploy 3 containers by using the scale label. Use the rolling_updates label and parallelism label to define that 2 containers are updated in batch at a time.

  1. web:
  2. image: nginx:latest
  3. restart: always
  4. environment:
  5. - "reschedule:on-node-failure"
  6. ports:
  7. - 80
  8. labels:
  9. aliyun.scale: "3"
  10. aliyun.rolling_updates: 'true'
  11. aliyun.rolling_updates.parallelism: "2"
Thank you! We've received your feedback.