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

Docker Swarm zero conf #9

Closed
gianarb opened this issue Mar 13, 2017 · 1 comment
Closed

Docker Swarm zero conf #9

gianarb opened this issue Mar 13, 2017 · 1 comment

Comments

@gianarb
Copy link
Owner

gianarb commented Mar 13, 2017

We can write a fallback zero configuration implementation of docker swarm because we can use service labels to get all the services that require to be managed by orbiter. For example with a set of labels like:

orbiter=true,orbiter_up:3, orbiter_down:2 we can create an autoscaler.

From a docker client point of view orbiter is already using:

cli, err := client.NewEnvClient()

It means that from Docker side we are already zero configuration.

Thanks @aluzzardi for the idea!

gianarb pushed a commit that referenced this issue Mar 14, 2017
Fixed #9

This PR bootstrap the autodetection feature:

1. It works when the configuration file is not setup. Right know I am
not going to manage the merge of double sources (autodetection and
configuration file).

2. At the moment only Docker Swarm will support this feature.
@gianarb
Copy link
Owner Author

gianarb commented Mar 15, 2017

The autodetection is implemented only for swarm. Because at the moment DigitalOcean doesn't support this kind of strategy.

At the moment the code is a mess but it's working. If you don't specify a configuration file when you start orbiter

orbiter daemon -config

The daemon fallback to autodetection mode. It's only implemented for Swarm and it works in this way:

  1. Check for EnvVar and it creates a new Docker client and it checks if there is a daemon up and running. If there is not the daemon is going to exit because the autodetection didn't discover anything.
  2. If there is a daemon up and running it checks if swarm mode is enabled. If it's not orbiter exit.
  3. It gets list of services and it checks for the label orbiter if it exists it register a new autoscaler called autodetect_swarm/wikidiff_worker. Where wikidiff_worker is the service name.
  4. It also looks for other 2 labels orbiter.up and orbiter.down to set the right scaling value. If they doesn't exist is using 1 and 1.

At this point you have all the services registered and you can do something like:

curl -v -d '{"direction": true}'  http://localhost:8000/handle/autodetect_swarm/wikidiff_worker

To scale as usual.

What do to

There is something to do:

  1. Move the autodetection logic into the provider. If the provider is not supporting autodetecting it can just return an error.
  2. Make smarter the fallback function in order to scale and to call all the autodetection provider to self-configure orbiter.

This two points are necessary to make the codebase flexible and maintainable. But the POC is there and it's working.

Follow up issues #13

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

No branches or pull requests

1 participant