#yes. call `dag.Host().Service()`. See

1 messages · Page 1 of 1 (latest)

white garnet
#

8: port not ready: dial tcp 10.87.0.28:8774: connect: connection refused; elapsed: 920.02µs
8: port is up at 10.87.0.28:8774
....
....
9: 2024/05/17 08:22:51 listening on 8774/tcp
9: 2024/05/17 08:22:51 10.87.0.17:39118 > handling
9: 2024/05/17 08:22:51 10.87.0.17:39118 > dialed /tmp/.buildkit-ssh-sock304071525/ssh_auth_sock
9: 2024/05/17 08:22:51 10.87.0.17:39118 > copy upstream->downstream error readfrom tcp 10.87.0.28:8774->10.87.0.17:39118: use of closed network connection

#

I'm guessing there is an ssh tunnel from the container to the host and than it's just tcp from host to the remote endpoint?

#

My code is something like this:
openstack_ip := os.Getenv("ip_address")
print(openstack_ip)
openstack_tunnel := client.Host().Service([]dagger.PortForward{
{Frontend: 8774, Backend: 8774}, // nova
{Frontend: 8776, Backend: 8776}, // cinder
{Frontend: 9292, Backend: 9292}, // glance
{Frontend: 9696, Backend: 9696}, // neutron
{Frontend: 5000, Backend: 5000}, // keystone
{Frontend: 80, Backend: 80}, // horizon
}, dagger.HostServiceOpts{Host: openstack_ip})

openstack_tunnel, err = openstack_tunnel.Start(ctx)
if err != nil {
    panic(err)
}
defer openstack_tunnel.Stop(ctx)
#

(should probably check that the Getenv doesn't give me an empty string)

white garnet
#

Thanks for the help @blissful belfry this approach seems to work fine. Got some last issues to iron out but good so far. For a v0.11 tool dagger is already incredibly powerful. I'm suprised how we functioned without it all this time..