-
Notifications
You must be signed in to change notification settings - Fork 41
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 the ability for ollama ports to stay open while it's still running with .WithLifetime(Persistent) #406
Comments
You can specify a port as the final argument of the var ollama = builder.AddOllama("ollama", 12345); Alternatively, you can call the Would either of these do what you're after? |
Unfortunately not because when you shut down the aspire host, the port mapping is removed even though the container is not because of WithLifetime(Persistent) Basically when you set WithLifetime(Persistent), the container should be up and be able to be used even when the aspire host isn't running which means that the ports should stay available. Interestingly, the UI.WithLifetime(Persistent) does keep the ports open, but it can't access the container for the ollama server because those ports were removed. |
ah yes, because that port is the port that is used by the proxy in the app host, not the port assigned in Docker when the container is started. I feel like this problem is a by-design, my understanding is that persistent containers are persistent from the app host perspective, but they aren't meant to be then used by other systems outside of the app host/aspire app. @davidfowl is this the right assumption that I have? |
We've implemeneted a mititgation in 9.1 dotnet/aspire#7063 (comment) |
On some of the implementations there is a flag "useProxy" that if you set to false, tells it not to proxy the ports but to directly expose them. Is it possible to enable this for ollama as an optional parameter like others have done in the mean time? |
If you want a workaround right now, then you should be able to turn off the proxy like this: var ollama = builder.AddOllama("ollama", 12345).WithEndpoint("http", e => e.IsProxied = false); |
Related to an existing integration?
Yes
Existing integration
Ollama
Overview
Right now you can specify a port to use, and you can specify persistence, but there is no way to specify that the instance keeps the port assigned. It would be nice to either have an extension for .WithPort(int, bool proxy = true) or add an optional parameter on AddOllama().
This would solve the problem so that the instance stays available for external calls while the aspire host isn't running.
Usage example
See above.
Breaking change?
No
Alternatives
I can't find any.
Additional context
This means you can use the instance and API while doing other things and makes Ollama with persistent lifetime work as you'd expect.
Help us help you
No, just wanted to propose this
The text was updated successfully, but these errors were encountered: