Closed aarroisi closed 1 month ago
app_port doesn't change kamal-proxy's port. Instead, that is for your application container's port that it is going to try and connect to. For example, a default Rails app using Puma will be hosted on port 3000, so you would set the app_port to 3000 to tell kamal-proxy that it needs to connect to the application on port 3000 instead of the default port 80 of the application port.
app_port doesn't change kamal-proxy's port. Instead, that is for your application container's port that it is going to try and connect to. For example, a default Rails app using Puma will be hosted on port 3000, so you would set the app_port to 3000 to tell kamal-proxy that it needs to connect to the application on port 3000 instead of the default port 80 of the application port.
Ah, I thought it would be directly analogous to the previous "host_port" on Kamal 1. So now it is not possible to change on which port the kamal-proxy is running?
I'm not sure as I don't have any experience with trying to change the kamal-proxy that it's listening on. However, I would probably say that you're on the right path with the KAMAL_PROXY_HTTP_PORT as described in their README.
Thanks for the reply. It really breaks my flow since I still need to run nginx/Caddy as the webserver and only only use kamal-proxy (traefik before) for deployment purpose. I used to run traefik on port other than 80/443 and let nginx/Caddy handle that.
Thanks for the reply. It really breaks my flow since I still need to run nginx/Caddy as the webserver and only only use kamal-proxy (traefik before) for deployment purpose. I used to run traefik on port other than 80/443 and let nginx/Caddy handle that.
me too
It turns out, we can configure this based on this PR (https://github.com/basecamp/kamal/pull/974), put inside pre-deploy hook. I guess this solves my problem.
@aarroisi is right, but kamal documentation is pretty bad
first, the port that your app is using inside the container. Next uses 3000. so on config/deploy.yml
you just
proxy:
app_port: 3000
now you need to tell kamal which port its proxy should run, so type on your terminal and run
kamal proxy boot_config set --http-port 4444 --https-port 4445
--https-port
seems to be required
hope it helps you save your time.
In Kamal 1, I used
host_port
to specify in which port traefik will be run. It worked well. Now I'm trying to migrate to Kamal 2 and I change it to useapp_port
like so:But when I run
kamal deploy
, it shows an error like this:docker: Error response from daemon: container f0af1c4f712bdb6905f707cf2f7dc6f8981d9122372f0cbb1b2a9b1f6327f6fd: endpoint join on GW Network failed: driver failed programming external connectivity on endpoint gateway_53bcdfbd02e1 (19dacb3d01219d4f82dcfc1413fb5f8e69c9deca92ac025666daf779df40c7f0): failed to bind port 0.0.0.0:80/tcp: Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use.
It seems like kamal-proxy still tries to bind to port 80, even though I specify it to run on port 8001.
I have tried many things:
env > clear > KAMAL_PROXY_HTTP_PORT: 8001
export KAMAL_PROXY_HTTP_PORT=8001
before kamal deployStill tries to bind to port 80.