Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HandleRoute and HandlePort update #249

Open
Konard opened this issue Oct 10, 2023 · 7 comments
Open

HandleRoute and HandlePort update #249

Konard opened this issue Oct 10, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@Konard
Copy link
Member

Konard commented Oct 10, 2023

HandleRoute ports handling

Today it is impossible to open port on server using HandleRoute because deeplinks is launched with single opened port, for example:

That means we can only access deeplinks via 3006 port.

And in order to solve it we might use:

  1. Restart the container with update to docker-compose.yml adding new port each time (this will require to restart the orchestrator itself, which I think is a bad idea, because it will break ongoing GQL and File connections).
  2. Reserver ports range for the deep-links container. (this is also a bad idea, because if on server we have any post that is already in use in that range the deep-links container will be unable to start).
  3. In any case we should monitor if each port is free in order to use it.
  4. And the best solution as I see it right now is to use HandleContainer/HandleDocker/HandlePorts for that.

HandlePort ports handling

It is also not possible for HandlePort to use more than single port.

For example we could start a game server for Ragnarok Online that uses 3 different ports (login, char, map servers). We could also want to start an operating system with macOS, Linux, Windows and we might want to configure freely which ports are available to external network. We also might want to have universal way to monitor healthz of the docker container.

So the best solution would be to configure the port for healthz or full featured Deep-compatible controller that has rest or may be even GQL API? We need a way to transfer initial data, for example we might use init route to pass the token of the package that create that container to use it for operations. For example using the token passed via init we might create subscriptions to links that control the behaviour of docker container. Or may be we could create a mini-deep inside that would allow docker container control via the same Deep GQL API.

HandleContainer/HandleDocker/HandlePorts

Once we have something like HandleDocker/HandlePorts, with support of multiple ports, we can move the responsibility for HandleRoute module there. So it in the separate docker and once port configuration is changed it may be restarted separately. It will also be better for performance scaling.

Related to #200

@Konard Konard added the enhancement New feature or request label Oct 10, 2023
@Konard Konard self-assigned this Oct 10, 2023
@Konard
Copy link
Member Author

Konard commented Oct 10, 2023

@Menzorg @ivansglazunov do you have any objections or improvements to these changes?

@Konard Konard moved this to Todo in Deep Architecture Oct 10, 2023
@suenot
Copy link
Member

suenot commented Oct 10, 2023

One port for one docker container is the good idea. Keep it simple, stupid.

@Konard
Copy link
Member Author

Konard commented Oct 10, 2023

One port for one docker container is the good idea. Keep it simple, stupid.

@suenot Why do you think it is good idea? Why we cannot use multiple ports for docker? What would you do if the docker needs server in regular sockets and also a way to check its healthz? What would you do if use start macOS, Linux, Windows in docker container and need both SSH and VNC or RDP and HTTP? What if you want to use docker containers as a platform for self-organized hosting provider and so on? What if game in docker just uses 3 ports?

And what would you do if you need multiple ports for HandleRoute? Where to host them? We should start a docker container for each port? But what if the logic inside needs two or more ports per process?

@Konard Konard changed the title HandleRoute and HandlePort refactoring HandleRoute and HandlePort update Oct 10, 2023
@suenot
Copy link
Member

suenot commented Oct 10, 2023

I agree that it is okay to open more ports for one HandleRoute in complicated scenarios, as you described.

@suenot
Copy link
Member

suenot commented Oct 10, 2023

We can pass range of ports with envsubst command.

➜  export D_PORTS="'1111:80','2222:80'"
➜  cat docker-compose.yml
version: "3"

services:
    client:
        image: nginx
        ports: [${D_PORTS}]
        volumes:
            - ./src:/usr/share/nginx/html%
➜  envsubst '${D_PORTS}' < docker-compose.yml > docker-compose.subst.yml
➜  cat docker-compose.subst.yml
version: "3"

services:
    client:
        image: nginx
        ports: ['1111:80','2222:80']
        volumes:
            - ./src:/usr/share/nginx/html%

And then we can run new file docker-compose.subst.yml:

docker-compose -f docker-compose.subst.yml up

This solution I found on stackoverflow.

Also there is an issue in github.com/docker/compose: docker/compose#4249

@Konard
Copy link
Member Author

Konard commented Oct 10, 2023

We can also may try to combine multiple docker-compose-yml files.

https://stackoverflow.com/questions/33408118/inheritance-or-nesting-with-docker-compose

@Konard
Copy link
Member Author

Konard commented Nov 6, 2023

Another way to solve this issue would be a way to define different way to check healthz for non http protocols using single port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants