updates again

This commit is contained in:
Jake Kasper
2025-08-21 07:43:43 -05:00
parent 041c603d76
commit cebfbd9454
6 changed files with 40 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ USER turftracker
EXPOSE 5000 EXPOSE 5000
# Health check # Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD node healthcheck.js CMD node healthcheck.js
# Start the application # Start the application

View File

@@ -28,6 +28,7 @@ services:
- "traefik.http.routers.turftracker-frontend.tls.certresolver=letsencrypt" - "traefik.http.routers.turftracker-frontend.tls.certresolver=letsencrypt"
- "traefik.http.services.turftracker-frontend.loadbalancer.server.port=3000" - "traefik.http.services.turftracker-frontend.loadbalancer.server.port=3000"
- "traefik.docker.network=proxy" - "traefik.docker.network=proxy"
restart: unless-stopped
backend: backend:
build: build:
@@ -62,6 +63,7 @@ services:
- "traefik.http.routers.turftracker-backend.tls.certresolver=letsencrypt" - "traefik.http.routers.turftracker-backend.tls.certresolver=letsencrypt"
- "traefik.http.services.turftracker-backend.loadbalancer.server.port=5000" - "traefik.http.services.turftracker-backend.loadbalancer.server.port=5000"
- "traefik.docker.network=proxy" - "traefik.docker.network=proxy"
restart: unless-stopped
db: db:
image: postgres:15-alpine image: postgres:15-alpine
@@ -74,6 +76,7 @@ services:
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql - ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
networks: networks:
- turftracker - turftracker
restart: unless-stopped
# Database should not be exposed to proxy network for security # Database should not be exposed to proxy network for security
volumes: volumes:

View File

@@ -23,9 +23,9 @@ USER turftracker
# Expose port # Expose port
EXPOSE 3000 EXPOSE 3000
# Health check # Health check using Node.js script
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1 CMD node healthcheck.js
# Start the application # Start the application
CMD ["npm", "start"] CMD ["npm", "start"]

33
frontend/healthcheck.js Normal file
View File

@@ -0,0 +1,33 @@
const http = require('http');
const options = {
hostname: 'localhost',
port: 3000,
path: '/',
method: 'GET',
timeout: 3000
};
const req = http.request(options, (res) => {
// Accept any 2xx or 3xx status code (React dev server might redirect)
if (res.statusCode >= 200 && res.statusCode < 400) {
console.log('Health check passed');
process.exit(0);
} else {
console.log(`Health check failed with status: ${res.statusCode}`);
process.exit(1);
}
});
req.on('error', (err) => {
console.log('Health check error:', err.message);
process.exit(1);
});
req.on('timeout', () => {
console.log('Health check timeout');
req.destroy();
process.exit(1);
});
req.end();

View File

@@ -23,7 +23,6 @@ import {
CalendarDaysIcon as CalendarIconSolid, CalendarDaysIcon as CalendarIconSolid,
ClockIcon as ClockIconSolid, ClockIcon as ClockIconSolid,
CloudIcon as CloudIconSolid, CloudIcon as CloudIconSolid,
UserIcon as UserIconSolid,
} from '@heroicons/react/24/solid'; } from '@heroicons/react/24/solid';
import { useAuth } from '../../hooks/useAuth'; import { useAuth } from '../../hooks/useAuth';

View File

@@ -8,7 +8,6 @@ import {
ClockIcon, ClockIcon,
CloudIcon, CloudIcon,
PlusIcon, PlusIcon,
ArrowTrendingUpIcon,
} from '@heroicons/react/24/outline'; } from '@heroicons/react/24/outline';
import { useAuth } from '../../hooks/useAuth'; import { useAuth } from '../../hooks/useAuth';