#--network

1 messages · Page 1 of 1 (latest)

lean walrus
#

I need dagger container can join other container on a docker network
When running with docker i use a --network

How can i start the dagger engine on this --network ?

cold notch
lean walrus
#

I try to use dagger to build (jar), pack (docker) and execute some java spring boot/cloud app. I already have some infrastructure services (like kafka for the service discovery) in existing container on an existing network. The app i pack and run should access this kafka instance and I wanted to access the app from the host like 127.0.0.1:8102 (each app with its port).

#

By launching a custom engine with '--network' it seems the other containers are reached. My last try is to start my apps in the same dagger container by binding services, i now see ' INF tunnel started port=8101 protocol=tcp http_url=http://localhost:8101 description="tunnel 0.0.0.0:8101 -> d968j8t8m115s.01607ovtsbqhe.dagger.local:8101" ' that i doesn't see when trying to launch multiple containers

#

The browser is loading for ever with no valid response but before it was completly not reachable

#

thanks for the link, i've seen it multiple time but this time it's clearer

lean walrus
#

ok i understand that i have an error when starting the service that prevent the container to start and share its port correctly

lean walrus
#

It seems that the port is shared but there's no service behind
I can't see if m'y service is started and listening in the logs

#

calling with: dagger call -i boot-all --source-root-dir=backend --shared-dir=dagger/shared up --ports=8101:8101 --ports=8102:8102

spark dew
#

If you hardly need to use the Kafka that has been started in your local docker container, the link that Jeremy posted above would be the right approach

#

What you need to do in this case is add a Service argument to your function

lean walrus
#

Even without the Kafka problem, i can't connect to my service

spark dew
#

And then you can pass your local Kafka listening port.

#

Are you using Dagger v0.15.1?

lean walrus
#

Yes

spark dew
lean walrus
#

done, always unreachable. Like i'm running a 'custom' engine i can see this log when i've refreshed the browser page: failed to dial tcp cu83r952grjv4.76d6la8n7ch1q.dagger.local:8102: dial tcp: lookup cu83r952grjv4.76d6la8n7ch1q.dagger.local on 10.87.0.1:53: no such host" client_hostname="Macbook de romain" client_id=yuvne6dywv93ar1otas4ahhcv session_id=qvxajh68mbm7zbnlqyikq9e1y spanID=e157928d9d83b049 traceID=83881a3d95cc85f11bc6b4c01f107417

#

✔ .bootAll(
│ │ sharedDir: ✔ ModuleSource.resolveDirectoryFromCaller(path: "dagger/shared"): Directory! 0.0s
│ │ sourceRootDir: ✔ ModuleSource.resolveDirectoryFromCaller(path: "backend"): Directory! 0.0s
│ ): Container! 4.5s
● .up(ports: [{frontend: null, backend: 8101, protocol: TCP}, {frontend: null, backend: 8102, protocol: TCP}]): Void 2m48s
┃ 16:24:45 INF tunnel started port=8101 protocol=tcp http_url=http://localhost:8101 description="tunnel 0.0.0.0:8101 -> cu83r952grjv4.76d6la8n7ch1q.dagger.local:8101"
┃ 16:24:45 INF tunnel started port=8102 protocol=tcp http_url=http://localhost:8102 description="tunnel 0.0.0.0:8102 -> cu83r952grjv4.76d6la8n7ch1q.dagger.local:8102"

spark dew
#

@lean walrus you're sure your app starts in 8101, right?

#

Do you see your app starting in the service logs?

lean walrus
#

i've just connected to dagger cloud and got readable traces

#

i see traces for bootAll, the container from the image but no log on the installApp or boot steps

spark dew
#

In your TUI if you press the + key you should see more info

lean walrus
spark dew
#

@lean walrus there's something I don't see

#

Your boot function returns a service

#

But the asService call returns a Promise to a servixe

#

In the gist you shared above that brings my attention

#

Also, when you call the bootAll function in the CLI, the ports that you map will only be mapped to the alpaquita container

#

So your alpaquita container needs to be listening on those ports

#

This is because your functions can currently return a single service

#

So all the ports that you set via the --ports flag will map against the returned container/service

lean walrus
#

ok, i've updated the gist to return the container after the service binding. Now i see in TUI that the service is running, it's better ! but still not reachable

spark dew
lean walrus
#

ok, i've tried .withExposedPort(8102) just before asService (exposing 8102 from the service ?) and .withExposedPort(8102) just after alpaquita (exposing 8102 from the container ?). In the browser the error has changed to ERR_CONNECTION_REFUSED. Im' looking for the proxy

spark dew
#

Seems like you need to map ports to different Dagger services

#

That's what the proxy module enables

cold notch
lean walrus
#

Nice! Thanks

lean walrus
#

I've got one service working using ...withEntryPoint(["java..."]).withEsposedPort(8102).asService({useEntrypoint:true})

#

i then see in the log: INF tunnel started port=8102 protocol=tcp http_url=http://localhost:8102 description="tunnel 0.0.0.0:8102 -> mb6fkodt1bsmq.0eblbucgf955u.dagger.local:8102"

lean walrus
lean walrus
#

dagger call -i cloud-utils-service --conf-dir=conf --backend-dir=backend up --ports=8102:8102 -> work

#

dagger call -i boot-all --conf-dir=conf --backend-dir=backend up --ports=8101:8101 --ports=8102:8102 -> does not work

spark dew
#

@lean walrus is cloud-utils a TCP o httpservice?

lean walrus
#

(spring boot actuator)

#

ok thanks, it's working through the proxy if i only use cloud-utils. (see the updated gists) When i add the api-gateway it's not working anymore

#

in the log, when it's working (cloud utils alone) i see tunnel started port=8102 protocol=tcp and tunnel started port=8101 protocol=tcp after some delay (maybe the delay of the cloud-utils service to expose its port). When adding the apigateway that never log 'tunnel' creation...

spark dew
lean walrus
#

i've put the services in debug mode and i see that the gateway can't connect to cloud-utils and i think it's the reason why it's blocking

lean walrus
#

I've tried with another service called 'demo' that expose the 8080 port. cloud-utils only in the proxy work, demo only in the proxy work, both at same time in the proxy block (no INF tunnel started)

spark dew
#

@lean walrus here's a very simple example with the proxy module using two services that works for me

// Returns a container that echoes whatever string argument is provided
func (m *Lala) Test() *dagger.Service {
    n1 := dag.Container().From("nginx").
        WithExposedPort(80).
        AsService(dagger.ContainerAsServiceOpts{UseEntrypoint: true})
    n2 := dag.Container().From("nginx").
        WithExposedPort(80).
        AsService(dagger.ContainerAsServiceOpts{UseEntrypoint: true})

    return dag.Proxy().WithService(n1, "n1", 8080, 80).
        WithService(n2, "n2", 8081, 80).Service()
}

^ if I run dagger call test up I can then curl localhost:8081 and curl localhost:8080 without issues