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

Better support for networks #6

Open
Cleptomania opened this issue Mar 9, 2022 · 1 comment
Open

Better support for networks #6

Cleptomania opened this issue Mar 9, 2022 · 1 comment

Comments

@Cleptomania
Copy link

Currently my understanding of how networks are handled in miniboss, is that a service group has a network associated with it, and you can optionally set the name of that network. I don't however see any way in which to modify this network, or to more generically assign individual services to different networks.

This first issue, being able to modify the network, I believe is rather straight-forward, you could just pass options for the different network options available in Docker. Specifically the option that brought this to light for me was internal, which can be seen as a parameter to network creation in the docker-py documentation.

Being able to set these options on networks would be very helpful for more intricate setups with miniboss.

The second issue here is the ability of a service to have more than one network, unless I'm missing something, I didn't see a way to do this.

Below I've added an example docker-compose file. Which blocks an application from all internet access, and uses a Traefik proxy to be able to access the application. This is achieved by the application being on an internal network, and the proxy being on a regular bridge network, in addition to the internal one. While this may be a rather contrived example, it's a good demonstration of the network creation flexibility that is possible with docker-compose that would be nice to have in miniboss.

If I'm wrong and this flexibility does exist but I'm blind, I'd love to be shown the way. If I'm correct that it doesn't currently exist, it doesn't seem like it would be too heavy of a lift to add? I would definitely be on board for submitting a PR for it

version: "3"

services:
    proxy:
        image: traefik:latest
        networks:
            - my_not_internal_network
            - my_internal_network
        ports:
            - "80:80"
            - "8080:8080"
        command:
            - --providers.docker
            - --providers.docker.exposedbydefault=false
            - --entrypoints.http.address=:80
            - --api.insecure=true

    my_app:
        image: my_app_image
        networks:
            - my_internal_network
        labels:
            - traefik.enable=true
            - traefik.http.routers.my_app.rule=Host(`localhost`)
            - traefik.http.routers.my_app.entrypoints=http
            - traefik.http.services.my_app.loadbalancer.server.port=80

networks:
    my_not_internal_network:
    my_internal_network:
        internal: true
@afroisalreadyinu
Copy link
Owner

@Cleptomania thanks a lot for this detailed proposal, it indeed makes sense. This shouldn't be difficult at all; it's a matter of adding a way to specify different networks, adding the networks field to the service, and connecting the to with the actual functionality. I'm working on podman support at the moment; would be great if you could do a PR, otherwise I would work on it after finishing podman support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants