feat(docker): make API port configurable via PORT environment variable#711
feat(docker): make API port configurable via PORT environment variable#711soyr-redhat wants to merge 2 commits into
Conversation
Allow users to customize the API server port via the PORT environment variable in .env, making it easier to avoid conflicts with services like Ollama, LM Studio, vLLM, or other local LLM engines that commonly use port 8000. Defaults to 8000 if not set.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThe PR makes the API port configurable via a ChangesConfigurable Docker API Server Port
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 287-288: The README's SDK base URL example still hardcodes
"localhost:8000" after instructing users to change PORT in their .env; update
the example to use the configurable port (e.g., show "http://localhost:${PORT}"
or use a placeholder like "http://localhost:<PORT>" or explicitly reference
process.env.PORT) so the sample call respects the PORT value set in .env and
avoids failed requests when users choose a different port (replace the hardcoded
"localhost:8000" example with the dynamic/placeholder form).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2a881eff-c887-4d61-872a-4796b36d2ff1
📒 Files selected for processing (5)
.env.templateDockerfileREADME.mddocker-compose.yml.exampledocker/entrypoint.sh
This PR makes the Honcho API server port configurable via a PORT environment variable in the .env file, allowing users to easily avoid port conflicts with services that commonly use port 8000.
MOTIVATION
Port 8000 is commonly used by local LLM engines (Ollama, LM Studio, vLLM, etc.), making it difficult to run Honcho alongside these tools. Previously, users had to manually edit multiple files (docker-compose.yml, docker/entrypoint.sh, Dockerfile, and healthcheck configuration) to change the port. This PR simplifies the process to a single environment variable change.
CHANGES
Added PORT setting to .env.template with clear documentation (defaults to 8000)
Updated docker-compose.yml.example to use ${PORT:-8000} for port mapping
Updated docker/entrypoint.sh to accept PORT environment variable
Updated Dockerfile CMD to use PORT environment variable
Updated healthcheck to dynamically read the configured port
Updated README with instructions for customizing the port
TESTING
Verified both scenarios work correctly with Docker Compose:
Default behavior (PORT=8000):
API responds on http://localhost:8000/health
Custom port (PORT=3001):
API responds on http://localhost:3001/health
USAGE EXAMPLE
Users can now simply set the port in their .env file:
cp docker-compose.yml.example docker-compose.yml
cp .env.template .env
Edit .env and set PORT=3001 (or any desired port)
docker compose up
All services automatically use the configured port with no additional file edits required.
Closes #706
Summary by CodeRabbit
New Features
Documentation