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

Allow changing the port with --port flag #210

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chand1012
Copy link

@chand1012 chand1012 commented Oct 7, 2024

I wanted to run openui on my home lab but I'm using the default port for another service, so I added the ability to configure the port with the --port flag. It defaults to 7878. Here an example of using it. Also allows you to set the port using the environment variable PORT.

$ docker run --rm --name openui -p 8989:8989 -e OPENAI_API_KEY -e ANTHROPIC_API_KEY -e OLLAMA_HOST=http://host.docker.internal:11434 openui --port 8989
                                                         
         __g@@@@@@gg__            _~@@    @@@@@@@@@@@@@@@
      _@@@@@@@@@@@@@@@@g_      _@@@@@@@,  @@@@@@@@@@@@@@@
    o@@@@@@@@@@@@@@@@@@@@@ _g@@@@@@@@@@@L @@@@@@@@@@@@@@@
  ,@@@@@@@@@@@@@@@@@@@B"~@@@@@@@@@@@@@@@@a%@@@@@@@@@@@@@@
 ,""""""""""""""""""_g@@@@@@@@@@@@@@@@@@@@g\@@@@@@@@@@@@@
 @@@@@@@@@@@@@@P"~?????????????????????????? gggggggggggg
!@@@@@@@@@@@@@@,=============================|@@@@@@@@@@@
[@@@@@@@@@@@@@@@L"""""""""""""""""""""""""""" @@@@@@@@@@@
 BBBBBBBBBBBBBBBBh<========================== @@@@@@@@@@@
 vggggggggggggggggg ggggggggggggggggggggggggg,@@@@@@@@@@@
  %@@@@@@@@@@@@@@@@@'@@@@@@@@@@@@@@@@@@@@@@@'@@@@@@@@@@@@
   "@@@@@@@@@@@@@@@@@LQ@@@@@@@@@@@@@@@@@@@@,@@@@@@@@@@@@@
     "@@@@@@@@@@@@@@@@@'@@@@@@@@@@@@@@@@@Po@@@@@@@@@@@@@@
        "4@@@@@@@@@@@P"   """""""""""""   @@@@@@@@@@@@@@@
                                                         
                                                         

INFO (openui):  Starting OpenUI AI Server created by W&B...
INFO (openui):  Starting LiteLLM in the background with config: /tmp/tmp7a2jx8b0.yaml
INFO (openui):  Running API Server
INFO (uvicorn.error):  Started server process [1]
INFO (uvicorn.error):  Waiting for application startup.
DEBUG (openui):  Starting up server in 1...
INFO (uvicorn.error):  Application startup complete.
INFO (uvicorn.error):  Uvicorn running on http://0.0.0.0:8989 (Press CTRL+C to quit)

Enhancements to port configuration:

  • backend/openui/__main__.py: Added logic to parse the port number from the command-line argument --port if provided, or fallback to the PORT environment variable, defaulting to 7878 if neither is specified.
  • backend/openui/__main__.py: Updated the uvicorn.run calls to use the dynamically determined port instead of the hardcoded value 7878. [1] [2]

@chand1012
Copy link
Author

This did not fix the issue I was having, see #212. However, I still think this could be a useful feature for some so I'm leaving the PR open.

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.

1 participant