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

add support for custom p2p node listen maddrs and dht announce maddrs #799

Merged

Conversation

mintyleaf
Copy link
Contributor

Long story short - i'm trying to join multiple LocalAI nodes which is hosted as docker container images on the vast.ai hosting.
The problem is - you can't provide the network_mode: host in that environment.
The maximum you can do is expose some port locally for the container, and then the vast.ai service will remap it to some random port on public accessed machine address, like:

[ip4]:13371 -> 8090/tcp

To work around that i need to provide to the libp2p the address that is exposed locally to listen to using introduced flag --listen-maddrs "/ip4/0.0.0.0/tcp/8090"
After that, with some patience, using defaults, the node can be actually accessed through the power of auto relay (based on pure luck)

But we can push that further by announcing on DHT the real public rerouted address using another introduced flag --dht-announce-maddrs /ip4/[ip4]/tcp/13371

Combined both approaches we can successfully reach the node by it's public address right after discovery on the DHT.

The petals project is using the same approach: https://github.com/bigscience-workshop/petals/blob/22afba627a7eb4fcfe9418c49472c6a51334b8ac/src/petals/cli/run_server.py#L54

@JackBekket
Copy link

I do support this PR, we definetly need this thing to be able to connect nodes from standard enviroment and vast.ai

Copy link
Owner

@mudler mudler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, thank you!

@mudler mudler enabled auto-merge (squash) November 18, 2024 13:51
@mudler mudler merged commit adcf68b into mudler:master Nov 18, 2024
6 of 10 checks passed
@JackBekket
Copy link

@mudler
Can you add it to local-ai and release new version?

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

Successfully merging this pull request may close these issues.

3 participants