Skip to content

Commit dc56951

Browse files
committed
Fix WordNet service 502 error in production deployment
ISSUE IDENTIFIED: - Production deployment sets PORT=3005 for WordNet service - Nginx proxy routes /wordnet to wordnet-service:3005 - But WordNet service was hardcoded to port 3003 - This caused 502 Bad Gateway errors in production SOLUTION: - Make WordNet service respect PORT environment variable - Default to port 3003 for development, use PORT env for production - Update log messages to show dynamic port The service now works correctly in both: - Development: runs on port 3003 (default) - Production: runs on port 3005 (from PORT env var) This fixes the 502 error when nginx proxy forwards /wordnet requests.
1 parent a9220d2 commit dc56951

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

docker-compose-p2p-dev.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ services:
161161
- VITE_KEYCLOAK_REALM=nodebook
162162
- VITE_KEYCLOAK_CLIENT_ID=nodebook-frontend
163163
- VITE_KEYCLOAK_CLIENT_SECRET=nodebook-frontend-secret
164-
- VITE_MEDIA_BACKEND_URL=http://nodebook-media-backend-p2p-dev:3001
165-
- VITE_NLP_SERVICE_URL=http://nodebook-nlp-service-p2p-dev:3002
166-
- VITE_WORDNET_SERVICE_URL=http://nodebook-wordnet-service-p2p-dev:3003
164+
- VITE_MEDIA_BACKEND_URL=http://localhost:3001
165+
- VITE_NLP_SERVICE_URL=http://localhost:3002
166+
- VITE_WORDNET_SERVICE_URL=http://localhost:3003
167167
- VITE_P2P_ENABLED=true
168168
- VITE_DEV_MODE=true
169169
- VITE_SIGNALING_URL=ws://127.0.0.1:4444

wordnet-service/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,9 @@ async def get_related_terms(term: str):
511511
if __name__ == "__main__":
512512
logger.info("🚀 Starting WordNet Service (Python/NLTK)")
513513
logger.info("📚 Capabilities: WordNet definitions and relations")
514-
logger.info("🔗 Health check: http://localhost:3003/health")
515-
logger.info("📖 Definitions: http://localhost:3003/api/wordnet/definitions/:term")
516-
logger.info("🔄 Batch lookup: http://localhost:3003/api/wordnet/definitions/batch")
517-
logger.info("🔗 Related terms: http://localhost:3003/api/wordnet/related/:term")
518-
519-
uvicorn.run(app, host="0.0.0.0", port=3003)
514+
port = int(os.getenv("PORT", 3003))
515+
logger.info(f"🔗 Health check: http://localhost:{port}/health")
516+
logger.info(f"📖 Definitions: http://localhost:{port}/api/wordnet/definitions/:term")
517+
logger.info(f"🔄 Batch lookup: http://localhost:{port}/api/wordnet/definitions/batch")
518+
logger.info(f"🔗 Related terms: http://localhost:{port}/api/wordnet/related/:term")
519+
uvicorn.run(app, host="0.0.0.0", port=port)

0 commit comments

Comments
 (0)