basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
9.39k stars 359 forks source link

Kamal deploy showing health check is failed but its pass when i check it manually. #807

Closed Tekchanddagar closed 1 month ago

Tekchanddagar commented 1 month ago

Hello Team, I am new to Kamal and exploring it right now. I have bought kamal handbook as well. My Kamal Version: 1.3.0 During kamal deploy somehow healthcheck is failed. Below is my complete config/deploy.yml file:

# Name of your application. Used to uniquely configure containers.
service: sf-app

# Name of the container image.
image: sf-app 
#build: false
# Deploy to these servers.
servers:
  web:
    hosts:
      - 1.2.3.4

# Credentials for your image host.
registry:
  # Specify the registry server, if you're not using Docker Hub
  server: xyz/devops/kamal
  username: _json_key_base64
  password:
    - KAMAL_REGISTRY_PASSWORD

builder:
  multiarch: false

# Configure custom arguments for Traefik (commented out)
# traefik:
#   args:
#     accesslog: true
#     accesslog.format: json

# Configure a custom healthcheck (commented out)
healthcheck:
   path: /cloud/health-status
   port: 8080
   max_attempts: 7
   interval: 60s

As per my understanding healthcheck should try 7 times and after every 60 seconds on port 8080 over given health path.

But from the logs its seems it tried 7 times but after every 1 seconds. So my app should be up in 7 seconds and if app doesn't came up in 7 seconds my health check will be failed and its expected. I have checked and my app took more time so i increased interval

But in logs we can see the --health-interval is 60s.

Is i am missing anything here or i am doing it in wrong way?

Please refer the below screenshot for same:

image

But when we create container using docker run command and login into container to check the healt status for the same path its passing. Which confirm my health path is working fine. Please refer the below screenshot for same:

image

Can you please help me to figure out whats mistake i am doing here?

Thank You.