basecamp / kamal

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

Request is not going upto app container. #808

Closed Tekchanddagar closed 4 months ago

Tekchanddagar commented 4 months ago

Hello Team, I am new to Kamal. My Kamal Version: 1.3.0

I am exploring kamal to deploy our ruby app. I am able to create my app container (As health check is passing) and traefik container is also created which is exposing port 80 on host node.

Below is my kamal config/deploy.yml file:

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

# Name of the container image.
image: sf-app 
# Deploy to these servers.
servers:
  web:
    hosts:
      - 1.2.3.4
    port: "8080:8080"
#    traefik: false 
# Credentials for your image host.
registry:
  # Specify the registry server, if you're not using Docker Hub
  server: xyz-docker.pkg.dev/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: 100
   interval: 60s

on my target host 1.2.3.4 i can see my app conatiner and treafik is running fine. But when i checked treafik container logs i can see 502 bad gateway error means request is reaching upto treafik but its unable to forward to app container.

image

But i am unable to understand how the treafik will forward the request to my app container.

Can you please point me in right direction which configuration i am missing here. So i can test my app functionality.

Can you please help me here?

Thank You

Tekchanddagar commented 4 months ago

Hi Team, Can you please guide me on above issue? Thank You

igor-alexandrov commented 4 months ago

@Tekchanddagar if you don't have anything else in your deploy.yml, then it looks like a pretty default config except for two things:

I suggest reset the to default, make sure that everything works and do any changes only after this.

Tekchanddagar commented 4 months ago

@igor-alexandrov , Thank You for your response. As i am new to kamal. Was making one mistake. Inside kamal config/deploy.yml i was using below config:

servers:
  web:
    hosts:
      - 1.2.3.4
    port: "8080:8080"

But traefik by default listen on port 80 and my app was running on port 8080.

So I have changes the host port from 8080 to port 80 inside my kamal config/deploy.yml file i.e

servers:
  web:
    hosts:
      - 1.2.3.4
    port: "80:8080"

And after making this change my site is up.

Thank You

igor-alexandrov commented 4 months ago

@Tekchanddagar I am glad it helped. Please close the issue.