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

How groups work? #481

Open
ezzabuzaid opened this issue Dec 23, 2024 · 3 comments
Open

How groups work? #481

ezzabuzaid opened this issue Dec 23, 2024 · 3 comments

Comments

@ezzabuzaid
Copy link

Hey, thank you for this amazing tool!

I’m a bit confused about how group works. From my understanding, there are two ways to define a group: one is the default set on the middleware (Traefik), and the other is a specific group defined per container using the "sablier.group".

Is that correct? If so, should I expect containers within the same group to start together?

Currently, it seems that if a container doesn’t belong to the "default" group, Sablier ignores it. My workaround has been to create a separate Sablier middleware for each container.

@yankees5963
Copy link

same question here

@acouvreur
Copy link
Member

acouvreur commented Jan 9, 2025

Instead of starting a container name, or a deployment name etc., you can label those resources directly and use that label name on the plugins or API.

Suppose you start Sablier with the docker provider like this:

docker run -p 10000:10000 -v /var/run/docker.sock:/var/run/docker.sock sablierapp/sablier:1.8.1

And you create an nginx container like this:

docker run -p 8080:80 -d --name nginx -l sablier.enable=true -l sablier.group=mygroup nginx

Now you can call the API using the group mygroup or using the plugin group property instead of names.

E.g.:

curl "http://localhost:10000/api/strategies/blocking?group=default&session_duration=10s"

Returns

{
  "session": {
    "instances": [
      {
        "instance": {
          "name": "nginx",
          "currentReplicas": 1,
          "desiredReplicas": 1,
          "status": "ready"
        },
        "error": null
      }
    ],
    "status": "ready"
  }
}

Does that make sense ?

@back-2-95
Copy link

If I use Traefik, can I use sablier.group label? I'm thinking if I have a Docker Compose project with e.g. 6 containers and it's stopped. Then accessing the web UI would wake them all up if they have same label value?

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

4 participants