uffizzi icon indicating copy to clipboard operation
uffizzi copied to clipboard

Add Healthchecks (docker-compose.uffizzi.yml)

Open jpthurman opened this issue 2 years ago • 4 comments

Add Uffizzi Compose support for healthcheck as define by Docker Compose here: https://docs.docker.com/compose/compose-file/compose-file-v3/#healthcheck

jpthurman avatar Apr 06 '22 01:04 jpthurman

PR in the uffizzi_app repository: https://github.com/UffizziCloud/uffizzi_app/pull/65

moklidia avatar Apr 19 '22 14:04 moklidia

uffizzi_controller PR: https://github.com/UffizziCloud/uffizzi_controller/pull/5

7R41N33 avatar Apr 20 '22 14:04 7R41N33

Compose file examples

services:
  redis:
    image: redis:latest

  hello-world:
    image: nginx
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s

x-uffizzi:
  continuous_preview:
    delete_preview_after: 10h

x-uffizzi-ingress:
  service: hello-world
  port: 80

Try with test: ["CMD-SHELL", "curl", "-f", "http://localhost"], test: "curl -f http://localhost", and `test: ["NONE"]

Check out the pods after deploy. If there is a healthcheck for a container it should appear as the 'liveness probe' property of the container. If the command is ``test: ["NONE"]`, the liveness prob shouldn't appear.

You can ping some existing websites (like http://google.com) for the check to succeed

moklidia avatar Apr 21 '22 12:04 moklidia

TESTED - OK

Failed checking for test: ["CMD", "curl", "-f", "http://localhost:9999/"]:

Events:
  Type     Reason     Age   From               Message
  ----     ------     ----  ----               -------
  Normal   Scheduled  110s  default-scheduler  Successfully assigned chepenko-env-5/app-chepenko-env-5-9cbc8b9cf-x8n6v to gke-uffizzi-client-sandbox-588e8350-itjj
  Normal   Pulling    100s  kubelet            Pulling image "library/nginx:latest"
  Normal   Pulled     100s  kubelet            Successfully pulled image "library/nginx:latest" in 105.54258ms
  Normal   Created    100s  kubelet            Created container 3a87c381ec
  Normal   Started    99s   kubelet            Started container 3a87c381ec
  Normal   Pulling    99s   kubelet            Pulling image "library/redis:latest"
  Normal   Pulled     99s   kubelet            Successfully pulled image "library/redis:latest" in 122.782804ms
  Normal   Created    99s   kubelet            Created container 999dda1264
  Normal   Started    98s   kubelet            Started container 999dda1264
  Warning  Unhealthy  19s   kubelet            Liveness probe failed:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 9999: Connection refused

NealArw avatar May 27 '22 17:05 NealArw