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:
@@ -1,17 +1,21 @@
|
|||||||
services:
|
services:
|
||||||
solidtime-mcp:
|
solidtime-mcp:
|
||||||
build: .
|
build: .
|
||||||
ports:
|
|
||||||
- "${PORT:-3045}:3045"
|
|
||||||
environment:
|
environment:
|
||||||
- PORT=3045
|
- PORT=3045
|
||||||
# Optional: default SolidTime API URL for all sessions.
|
# Optional: default SolidTime API URL for all sessions.
|
||||||
# Clients can override this via the x-solidtime-api-url header.
|
# Clients can override this via the x-solidtime-api-url header.
|
||||||
- SOLIDTIME_API_URL=${SOLIDTIME_API_URL:-https://app.solidtime.io}
|
- SOLIDTIME_API_URL=${SOLIDTIME_API_URL:-https://app.solidtime.io}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- dokploy-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3045/health"]
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3045/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|
||||||
|
networks:
|
||||||
|
dokploy-network:
|
||||||
|
external: true
|
||||||
|
|||||||
@@ -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", () => {
|
httpServer.listen(PORT, "0.0.0.0", () => {
|
||||||
console.log(`SolidTime MCP HTTP server listening on port ${PORT}`);
|
console.log(`SolidTime MCP HTTP server listening on port ${PORT}`);
|
||||||
console.log(` MCP endpoint: http://0.0.0.0:${PORT}/mcp`);
|
console.log(` MCP endpoint: http://0.0.0.0:${PORT}/mcp`);
|
||||||
|
|||||||
Reference in New Issue
Block a user