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

Support start_period for healthcheck in Docker Compose #475

Merged
merged 2 commits into from Aug 30, 2017

Conversation

Projects
None yet
7 participants
@denverdino
Contributor

denverdino commented Aug 28, 2017

Signed-off-by: Li Yi denverdino@gmail.com

- What I did
The --health-start-period duration is supported by docker run and docker service create since 17.05, but it is missing in the Docker Compose.

The PR adds the start_period for healthcheck to Docker Compose.

- How I did it

Adds the start_period for healthcheck to Docker Compose.

- How to verify it

Using the bellow compose file: docker-compose.yaml

version: "3.4"
services:
  foo:
    image: elasticsearch
    healthcheck:
      test: "curl --silent --fail localhost:9200/_cluster/health || exit 1"
      interval: 10s
      timeout: 2s
      retries: 5
      start_period: 15s

docker stack deploy -c docker-compose.yaml elasticsearch

- Description for the changelog

Support start_period for healthcheck in Docker Compose

- A picture of a cute animal (not mandatory but encouraged)

@dnephin

You'll also need to update cli/compose/convert/service.go to accept the new field.

I believe this will require an updated to the swarmkit dependency in vendor.conf, which will probably be blocked on #465

Show outdated Hide outdated cli/compose/schema/data/config_schema_v3.4.json
Show outdated Hide outdated cli/compose/types/types.go
@codecov-io

This comment has been minimized.

Show comment
Hide comment
@codecov-io

codecov-io Aug 28, 2017

Codecov Report

Merging #475 into master will decrease coverage by 1.2%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master     #475      +/-   ##
==========================================
- Coverage   48.62%   47.41%   -1.21%     
==========================================
  Files         199      199              
  Lines       16396    16398       +2     
==========================================
- Hits         7972     7775     -197     
- Misses       8008     8228     +220     
+ Partials      416      395      -21

codecov-io commented Aug 28, 2017

Codecov Report

Merging #475 into master will decrease coverage by 1.2%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master     #475      +/-   ##
==========================================
- Coverage   48.62%   47.41%   -1.21%     
==========================================
  Files         199      199              
  Lines       16396    16398       +2     
==========================================
- Hits         7972     7775     -197     
- Misses       8008     8228     +220     
+ Partials      416      395      -21

@GordonTheTurtle GordonTheTurtle added dco/no and removed dco/no labels Aug 29, 2017

Support start_period for healthcheck in Docker Compose
Signed-off-by: Li Yi <denverdino@gmail.com>

@docker docker deleted a comment from GordonTheTurtle Aug 29, 2017

@denverdino

This comment has been minimized.

Show comment
Hide comment
@denverdino

denverdino Aug 30, 2017

Contributor

Changed the type of interval, timeout and start_period of healthcheck from string to * time.Duration

Thanks

Contributor

denverdino commented Aug 30, 2017

Changed the type of interval, timeout and start_period of healthcheck from string to * time.Duration

Thanks

@dnephin

thanks, just one comment

Change the type of interval, timeout and start_period of healthcheck …
…from string to * time.Duration

Signed-off-by: Li Yi <denverdino@gmail.com>
@denverdino

This comment has been minimized.

Show comment
Hide comment
@denverdino

denverdino Aug 30, 2017

Contributor

@dnephin Thanks for your comments, the change on the 3.0~3.3 schema is reverted

Contributor

denverdino commented Aug 30, 2017

@dnephin Thanks for your comments, the change on the 3.0~3.3 schema is reverted

@vdemeester

LGTM 🐮

@dnephin

LGTM

@dnephin dnephin merged commit e636a53 into docker:master Aug 30, 2017

8 checks passed

ci/circleci: cross Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: shellcheck Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
ci/circleci: validate Your tests passed on CircleCI!
Details
codecov/patch 66.66% of diff hit (target 50%)
Details
codecov/project Absolute coverage decreased by -1.2% but relative coverage increased by +18.04% compared to 65202d6
Details
dco-signed All commits are signed

@GordonTheTurtle GordonTheTurtle added this to the 17.08.0 milestone Aug 30, 2017

@mgansler mgansler referenced this pull request Sep 7, 2017

Open

Include Healthcheck #61

@mmariani

This comment has been minimized.

Show comment
Hide comment
@mmariani

mmariani Sep 27, 2017

Contributor

I was waiting for this feature, but I think I am missing something here.

start_period Additional property start_period is not allowed

$ docker version
Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:42:45 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:41:24 2017
 OS/Arch:      linux/amd64
 Experimental: true
     [...]
     healthcheck:
       test: "curl --fail http://localhost:5601/ || exit 1"
       start_period: 10m

I checked the schema file in the 17.09 release of docker-ce and it seems correct.

Contributor

mmariani commented Sep 27, 2017

I was waiting for this feature, but I think I am missing something here.

start_period Additional property start_period is not allowed

$ docker version
Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:42:45 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:41:24 2017
 OS/Arch:      linux/amd64
 Experimental: true
     [...]
     healthcheck:
       test: "curl --fail http://localhost:5601/ || exit 1"
       start_period: 10m

I checked the schema file in the 17.09 release of docker-ce and it seems correct.

@rdxmb

This comment has been minimized.

Show comment
Hide comment
@rdxmb

rdxmb Oct 13, 2017

Contributor

// edited: works with docker-compose file version 3.4

Contributor

rdxmb commented Oct 13, 2017

// edited: works with docker-compose file version 3.4

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