fix: resolve EADDRINUSE and Traefik routing issues

Remove host port binding from docker-compose to avoid port conflicts
and add dokploy-network for proper Traefik discovery. Add graceful
error handling for EADDRINUSE in HTTP server.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Danijel
2026-03-18 01:11:02 +01:00
parent 89e1b30a93
commit 098ae2d2bd
2 changed files with 16 additions and 2 deletions

View File

@@ -1,17 +1,21 @@
services:
solidtime-mcp:
build: .
ports:
- "${PORT:-3045}:3045"
environment:
- PORT=3045
# Optional: default SolidTime API URL for all sessions.
# Clients can override this via the x-solidtime-api-url header.
- SOLIDTIME_API_URL=${SOLIDTIME_API_URL:-https://app.solidtime.io}
restart: unless-stopped
networks:
- dokploy-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3045/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
networks:
dokploy-network:
external: true

View File

@@ -172,6 +172,16 @@ const httpServer = http.createServer(async (req, res) => {
}
});
httpServer.on("error", (err: NodeJS.ErrnoException) => {
if (err.code === "EADDRINUSE") {
console.error(`Error: Port ${PORT} is already in use.`);
console.error(`Either stop the existing process or set a different PORT environment variable.`);
} else {
console.error("Server error:", err);
}
process.exit(1);
});
httpServer.listen(PORT, "0.0.0.0", () => {
console.log(`SolidTime MCP HTTP server listening on port ${PORT}`);
console.log(` MCP endpoint: http://0.0.0.0:${PORT}/mcp`);