Skip to content

Remove random port assignment tip from ollama.md#1279

Open
CallumWalley wants to merge 1 commit into
mainfrom
fix-batch-script
Open

Remove random port assignment tip from ollama.md#1279
CallumWalley wants to merge 1 commit into
mainfrom
fix-batch-script

Conversation

@CallumWalley
Copy link
Copy Markdown
Member

Removed the random port assignment tip from the documentation.

Removed the random port assignment tip from the documentation.

Signed-off-by: Cal <[email protected]>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Test deployment successful!! (2026-05-19T22:42:34Z)
Preview available at https://callumwalley.github.io/mkdocs-demo-deploy/nesi/support-docs/fix-batch-script

Seems the following pages differ;



See all deployed demo sites

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

Ye've seen fit to drag that Python port-findin' sorcery into the main script and hoist the OLLAMA_HOST flag. 'Tis a fine way to avoid port clashes, I suppose, if ye don't mind every bilge rat on the node havin' a look-see at your work. The reviewer rightly pointed out that bindin' to every interface is a security blunder fit for a cabin boy. They've handed ye a map to 127.0.0.1 so ye can keep your GPU treasures to yourself. Try to follow the code suggestion before ye sink the whole ship.

Comment on lines +72 to +74
PORT=$(python3 -c "import socket; s=socket.socket(); s.bind(('', 0)); print(s.getsockname()[1]); s.close()")

export OLLAMA_HOST=${HOSTNAME}:${PORT}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-medium medium

Oh, look at ye, showin' off your 'clever' Python tricks. I suppose a simple port was too 'common' for your tastes? And ye've left the gate unlatched by bindin' to every interface. If ye want to keep your GPU from bein' plundered by every other pirate on the node, maybe try bindin' to 127.0.0.1 instead? (See Style Guide line 408, if ye can be bothered).

Suggested change
PORT=$(python3 -c "import socket; s=socket.socket(); s.bind(('', 0)); print(s.getsockname()[1]); s.close()")
export OLLAMA_HOST=${HOSTNAME}:${PORT}
PORT=$(python3 -c "import socket; s=socket.socket(); s.bind(('127.0.0.1', 0)); print(s.getsockname()[1]); s.close()")
export OLLAMA_HOST=127.0.0.1:${PORT}
References
  1. Don't be too fancy. We all know you are very clever, but your script examples should do the bare minimum needed to provide a safe example. (link)

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