GIN_MODE environment variable is ineffective
Description:
The GIN_MODE environment variable is ineffective in ollama because ollama overrides it here: https://github.com/jmorganca/ollama/blob/de5beb06b314eb4950c5a0de8183dfadb325fc8b/server/routes.go#L39-L56
The fix is to build as per, e.g.: https://github.com/jmorganca/ollama/blob/de5beb06b314eb4950c5a0de8183dfadb325fc8b/scripts/push_docker.sh#L5-L6. That is, add -X 'github.com/ollama/ollama/server.mode=release' to the linker flags. Once that's done the GIN_MODE environment variable can be removed from the service file.
Additional info:
- Setting GIN_MODE was broken in https://github.com/ollama/ollama/pull/397.
- I've filed a PR to fix this as described: !2 (closed)
- A previous PR was filed by @sammyf, but that one relied on patching instead of build flags: !1 (closed)
Steps to reproduce:
- Install ollama.
- Start the ollama systemd service.
- Look at the journal logs for
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.