hectcastro / docker-riak-cs

A Docker project to bring up a local Riak CS cluster.
https://registry.hub.docker.com/u/hectcastro/riak-cs/
Apache License 2.0
42 stars 21 forks source link

For the development environment its nice to be sure that at least one node is available at the same port. #6

Closed pmarques closed 10 years ago

pmarques commented 10 years ago

For the development environment its nice to be sure that at least one node is available at the same port.

I've something implemented but not working in all casaes. Because escaping arguments is required I'm not figuring out how to properly turn an argument option in the docker run.

https://github.com/pmarques/docker-riak-cs/commit/b23ea61edee67b7d92fbc6ad25d0918a3d993b1a

pmarques commented 10 years ago

@hectcastro what do you think about give a default port for it? Instead of check and set API_PORT use something like API_PORT="-p=${API_PORT:-8080}:8080"

hectcastro commented 10 years ago

I like the idea of providing a consistent port, but I'm hesitant to only assign it to one of the nodes in the cluster.

The ideal solution (at least in my head) would be to have another container running HAProxy that is linked to all of the nodes in the cluster. On startup, that container can look through its environment for linked Riak CS nodes and populate the HAProxy configuration dynamically. In this scenario, HAProxy would then be bound to port 8080.

Thoughts?

pmarques commented 10 years ago

Ok, I've already thought about it and initially I gave a look into this https://registry.hub.docker.com/u/jwilder/nginx-proxy/, but because it requires some changes in the in the way that e can the containers and I didn't want to change that I have implemented something different that uses the bash guides for load balance for nginx https://github.com/pmarques/nginx-cluster-proxy

hectcastro commented 10 years ago

@pmarques Can you take a look at this pull request with HAProxy support?

I chose HAProxy because that is the most common recommendation from Basho for load balancing against Riak and Riak CS.

pmarques commented 10 years ago

cool, I've tested it and is everything working here

There is just one thing. In my mind I hope that when I run something the default behavior is that everything just works :) So if the HAProxy is used we should force the automatic clustering or at least make it the default behavior.

hectcastro commented 10 years ago

A very valid point. I'll add conditionals to the environmental variable settings and commit them to this branch.