From 4c3b63c4bf9ca73b169f6dd3a70b4902817a4239 Mon Sep 17 00:00:00 2001 From: Stephen Minakian Date: Tue, 15 Jul 2025 20:36:12 -0600 Subject: [PATCH] Added priority to traefik tag --- Dockerfile | 6 +++--- docker-compose.yml | 1 + server.js | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index cefb273..a6413b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,9 +23,9 @@ USER nodejs # Expose port EXPOSE 8080 -# Health check -HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ - CMD node -e "require('http').get('http://localhost:8080/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })" +# Health check - force IPv4 and increase timeout +HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ + CMD node -e "const http = require('http'); const port = process.env.PORT || 8080; const req = http.get({hostname: '127.0.0.1', port: port, path: '/health', family: 4}, (res) => { process.exit(res.statusCode === 200 ? 0 : 1); }); req.on('error', () => process.exit(1)); req.setTimeout(5000, () => { req.destroy(); process.exit(1); });" # Start the application CMD ["npm", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 490417e..69ee4d4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,7 @@ services: - "traefik.http.routers.apartment-api.rule=Host(`apartments.maverickapplications.com`) && PathPrefix(`/api`)" - "traefik.http.routers.apartment-api.entrypoints=websecure" - "traefik.http.routers.apartment-api.tls.certresolver=letsencrypt" + - "traefik.http.routers.apartment-api.priority=100" - "traefik.http.services.apartment-api.loadbalancer.server.port=8080" # Updated to match - "traefik.http.middlewares.apartment-api-stripprefix.stripprefix.prefixes=/api" - "traefik.http.routers.apartment-api.middlewares=apartment-api-stripprefix" diff --git a/server.js b/server.js index 0735306..f09e870 100644 --- a/server.js +++ b/server.js @@ -469,6 +469,7 @@ async function startServer() { app.listen(PORT, '0.0.0.0', () => { console.log(`🚀 Apartment API server running on port ${PORT}`); + console.log(`📊 Server listening on 0.0.0.0:${PORT} (accessible from Docker networks)`); console.log(`📊 Available endpoints:`); console.log(` GET /health - Health check`); console.log(` GET /api/daily-summary - Daily apartment summary`);