#Can anyone think of a more clever way to
1 messages · Page 1 of 1 (latest)
Briefly went down this rabbit hole during the hackathon and decided to just say "run two dagger ups" for now. 😅 Also curious what ideas people have
That was my backup plan lol
I can forward multiple ports from one service with up, right?
If we find a nice way to do it, at least a lot of the "hard parts" we get for ~free (log multiplexing, etc)
yep
it might be a socat one-liner 🤔
I was going to create a proxy module that's just an nginx container that creates reverse proxy entry for each service added
dope
we'll see how it goes! the unanticipated part of my demo was that since I have one service serving the frontend, and another service serving the backend, they both need to be accessible to the host since the frontend->backend communication happens host side
this makes sense, that was my initial thought as well. Then I was too lazy to do it
I'll do it once for all of us 😂 
you mean http requests from the browser?
same problem I had with the graphiql/playground module
@drowsy star if you check in my tailscale module there is the “introspect ports, generate multi-socat proxy” logic, if you want to steal that. nginx config sounds nice too 🙂 will it work for raw tcp though?
Should work for raw tcp just fine! Nginx can do udp too but I don't know if our services can 😅
Yes I believe they can
Flagging: UDP is in the API but not implemented for h2c/c2h yet - it's been a TODO on the original PR (5557)
Proxy module unlocked: https://daggerverse.dev/mod/github.com/kpenfound/dagger-modules/proxy@f9cc629f6d5d98e620c4fc35312d27d3d6de48f7
The API isn't exactly what I want yet, but that's due to limitations of the Python SDK and I wanted to use Python. Once we're able to put properties on the base class in Python it'll be much easier to use.
Here's how the usage looks today: https://github.com/kpenfound/greetings-api/blob/zenith/ci/main.go#L29-L37
working with: dagger -m ./ci up -p 8080,8081 serve --dir "."
with the SDK limitations:
proxy := dag.Proxy().Proxy(backendService, "backend", 8080)
proxy = dag.Proxy().AdditionalProxy(proxy, frontendService, "frontend", 8081)
return dag.Proxy().Service(proxy)
vs how I want it once python has classes and properties:
return dag.Proxy().
WithService(backendService, "backend", 8080).
WithService(frontendService, "frontend", 8081).
Serve()