Skip to content
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

Proxy not mapping to container port. #1314

Open
Jainam-17-18 opened this issue Dec 19, 2024 · 0 comments
Open

Proxy not mapping to container port. #1314

Jainam-17-18 opened this issue Dec 19, 2024 · 0 comments

Comments

@Jainam-17-18
Copy link

Jainam-17-18 commented Dec 19, 2024

I am trying to deploy web app on (xx.xx.xx.xx) Server which has Virtual Machine.
Have add inbound rule in server firewall on port 5678 which mapped to VM's 80 port.
The kamal-proxy is running on 80 -> 80 port & 443 -> 443 port.
The application container is running on port 8080 (I guess this is container port).

image

applicaiton:

package main

import (
	"fmt"
	"net/http"
)

func main() {
	http.HandleFunc("/", HelloServer)
	http.ListenAndServe(":8080", nil)
}

func HelloServer(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Html for hello world")
}

Dockerfile:

#The build stage
FROM golang:1.23 as builder
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo HelloWorld.go

#The run stage
FROM scratch
WORKDIR /app
COPY --from=builder /app/HelloWorld .
EXPOSE 8080
CMD ["./HelloWorld"]

Deploy.yml

service: my-app

image: jainam1718/learn_kamal

servers:
  web:
    - xx.xx.xx.xx

proxy:
  ssl: true
  host: subdomain.myserver.com
  app_port: 8080

registry:
  username: jainam1718

  password:
    - KAMAL_REGISTRY_PASSWORD

builder:
  arch: amd64

ssh:
  user: my-user
  port: xxxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant