basecamp / kamal

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

Incorrect IP address when using remote builder with proxy #714

Closed JoeKaldas closed 1 month ago

JoeKaldas commented 4 months ago

I'm trying to deploy on Hetzner. My setup has 2 servers, one for app and one for postgres. They talk to each other internally. Have a network setup on Hetzner for that.

Here's a screenshot of my 2 servers. 0o3_SQJ-

If I try deploying using Using remote builder for single-arch, I get the following error. It's trying to connect to 5.75.252.76 which isn't even one of my IP addresses. I tried using 10.0.0.2 in my builder host but same issue.

LKHFHygY

Here's my deploy.yml

service: j-h

image: joekaldas/j-h

ssh:
  proxy: "5.75.253.249"

servers:
  web:
    hosts:
      - 10.0.0.2
  solid-queue:
    hosts:
      - 10.0.0.2
    cmd: bundle exec rake solid_queue:start

registry:
  username: joekaldas

  password:
    - KAMAL_REGISTRY_PASSWORD

env:
  clear:
    POSTGRES_USER: postgres
    POSTGRES_HOST: 10.0.0.3
  secret:
    - RAILS_MASTER_KEY
    - POSTGRES_PASSWORD

builder:
  remote:
    arch: amd64
    host: ssh://root@5.75.253.249

accessories:
  pg-16.2:
    image: postgres:16.2
    host: 10.0.0.3
    port: "5432:5432"
    env:
      clear:
        POSTGRES_USER: postgres
      secret:
        - POSTGRES_PASSWORD
    files:
      - db/init.sql:/docker-entrypoint-initdb.d/setup.sql
    volumes:
      - "postgres_data:/var/lib/postgresql/data"
dotnofoolin commented 4 months ago

Try deleting the context.

docker context ls

docker context rm name_of_context_with_wrong_ip_address

I had the same issue using an AWS instance as the builder when I had to delete and restart the instance and the IP address changed.

JoeKaldas commented 4 months ago

@dotnofoolin I've tried on both instances and both had one context of default

djmb commented 1 month ago

@JoeKaldas - the context will be on the machine you are deploying from.

To fix this, we need to add a check in the build step to confirm the context is up to date with the config.

djmb commented 1 month ago

Duplicate of https://github.com/basecamp/kamal/issues/90