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

Olric in docker container - memberlist "no private IP address found, and explicit IP not provided" #35

Closed
justinfx opened this issue Jun 4, 2020 · 7 comments
Assignees

Comments

@justinfx
Copy link
Contributor

justinfx commented Jun 4, 2020

I'm looking to see if you have encountered the following issue while trying to run Olric in a container:

docker run -p 3320:3320 olricio/olricd:latest
Olric quits prematurely:
no private IP address found, and explicit IP not provided

Search a bit, this issue implies its a factor of the memberlist library and its gossip protocol, in trying to choose a private ip:
thanos-io/thanos#615

And I believe it may have to do with how my docker configuration is set up. If I run it with --net=host then it starts:

docker run --net=host -p 3320:3320 olricio/olricd:latest

So my questions are:

  1. Is this something you have encountered?
  2. Is this something where you have tips that can be added to the documentation?
@buraksezer buraksezer self-assigned this Jun 4, 2020
@justinfx
Copy link
Contributor Author

justinfx commented Jun 4, 2020

It seems its specifically related to how we configure our docker network at my studio vs a default installation, to deal with the potential for conflicts with the external network. So maybe this is just a matter of documenting the situation.

@buraksezer
Copy link
Owner

Thank you for informing me. I'm going to take a look at thanos#615. Could you please give more information about your setup? Thus, I can provide the problem on my side.

@justinfx
Copy link
Contributor Author

I have a reproduction for you.

docker network create --subnet=169.254.0.0/16 testnet

docker run -it --network testnet --ip 169.254.0.128 --rm -p 3320:3320 olricio/olricd:latest
# Olric quits prematurely:
# no private IP address found, and explicit IP not provided

docker network rm testnet

This replicates how my studio has custom network settings for their docker deployment to deal with known issues like address collisions, etc. But in this case the hashicorp memberlist isn't happy with the private ip range.

@d1ngd0
Copy link
Contributor

d1ngd0 commented Nov 8, 2021

Hey, Sorry for pulling this one up again, but I am currently experiencing an issue myself. It looks like this line

	privateIfs, _, err = IfByRFC("6890", privateIfs)

inside vendor/github.com/hashicorp/go-sockaddr/ifaddrs.go is forcing all ip addresses to be within RFC 6890 which is likely too narrow. Would it make sense to simply first look into the private addresses, and if nothing is found look into the public ones?

	if bindIP == "0.0.0.0" {
		// if we're not bound to a specific IP, let's use a suitable private IP address.
		ipStr, err := sockaddr.GetPrivateIP()
		if err != nil {
			return "", fmt.Errorf("failed to get interface addresses: %w", err)
		}
		if ipStr == "" {
		        // Add logic here to search public ip addresses for bind address.
			return "", fmt.Errorf("no private IP address found, and explicit IP not provided")
		}

		parsed := net.ParseIP(ipStr)
		if parsed == nil {
			return "", fmt.Errorf("failed to parse private IP address: %q", ipStr)
		}
		bindIP = parsed.String()
	}

For instance my IP is within this range but you can see the Source is set to false, which is defined here. I'd be happy to write something up for you if you feel this is the correct direction. Otherwise if you have other ideas I would be willing to implement them too :)

@d1ngd0
Copy link
Contributor

d1ngd0 commented Nov 8, 2021

BTW: The workaround for this is to specify the interface in both the olric section of the config as well as the memberlist. When specifying the interface it looks like olric doesn't care what the ip address is.

@buraksezer
Copy link
Owner

Hi @d1ngd0

Firstly, I'm so sorry for my late response.

When specifying the interface it looks like olric doesn't care what the ip address is.

Yes it is. Olric tries to discover the IP address from the network interface, if it is defined in the config.

I'd be happy to write something up for you if you feel this is the correct direction. Otherwise if you have other ideas I would be willing to implement them too :)

Great! I would like to see your solution and discuss about it.

@justinfx
Copy link
Contributor Author

This does work for me now, with the 0.4.4 release

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

3 participants