dcaputo-harmoni / open-balena-admin

Open Balena Admin
MIT License
94 stars 20 forks source link

Single container / port? #28

Closed shaunco closed 2 months ago

shaunco commented 11 months ago

Really great work here!

Is there a specific reason to have postgrest and remote as separate containers rather than just having the ui container handle them at /postgrest/... and /remote/...?

Then, along those same lines, why does the remote container need to split each ttyd onto a different port? Seems like it could either use a WebSocket per open ssh tunnel or do something like /ttyd/1, /ttyd/2, etc. Am I missing something here?

dcaputo-harmoni commented 11 months ago

Really just to separate out functionality, ui is a web app, postgrest is a standalone service and remote is a custom proxy handler along with supporting tools like ttyd. Similar reasons to why balena separated out registry, s3, api, vpn, etc.

The ttyd's are split on different ports to allow it to handle concurrent sessions, it uses the port number in the cookie to know which session is being handled. To use only one port we would need to devise a different way to do that. I think it's a great idea, but would require some work. Any interest in helping / submitting a PR?

shaunco commented 11 months ago

I should have some time over the holidays to make a pass at rewriting remote to use websockets on a single port. I'll submit a PR if I get it all working.