updates again
This commit is contained in:
@@ -24,7 +24,7 @@ USER turftracker
|
||||
EXPOSE 5000
|
||||
|
||||
# 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
|
||||
|
||||
# Start the application
|
||||
|
||||
@@ -28,6 +28,7 @@ services:
|
||||
- "traefik.http.routers.turftracker-frontend.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.services.turftracker-frontend.loadbalancer.server.port=3000"
|
||||
- "traefik.docker.network=proxy"
|
||||
restart: unless-stopped
|
||||
|
||||
backend:
|
||||
build:
|
||||
@@ -62,6 +63,7 @@ services:
|
||||
- "traefik.http.routers.turftracker-backend.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.services.turftracker-backend.loadbalancer.server.port=5000"
|
||||
- "traefik.docker.network=proxy"
|
||||
restart: unless-stopped
|
||||
|
||||
db:
|
||||
image: postgres:15-alpine
|
||||
@@ -74,6 +76,7 @@ services:
|
||||
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
networks:
|
||||
- turftracker
|
||||
restart: unless-stopped
|
||||
# Database should not be exposed to proxy network for security
|
||||
|
||||
volumes:
|
||||
|
||||
@@ -23,9 +23,9 @@ USER turftracker
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
|
||||
# Health check using Node.js script
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD node healthcheck.js
|
||||
|
||||
# Start the application
|
||||
CMD ["npm", "start"]
|
||||
33
frontend/healthcheck.js
Normal file
33
frontend/healthcheck.js
Normal 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();
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
CalendarDaysIcon as CalendarIconSolid,
|
||||
ClockIcon as ClockIconSolid,
|
||||
CloudIcon as CloudIconSolid,
|
||||
UserIcon as UserIconSolid,
|
||||
} from '@heroicons/react/24/solid';
|
||||
|
||||
import { useAuth } from '../../hooks/useAuth';
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
ClockIcon,
|
||||
CloudIcon,
|
||||
PlusIcon,
|
||||
ArrowTrendingUpIcon,
|
||||
} from '@heroicons/react/24/outline';
|
||||
import { useAuth } from '../../hooks/useAuth';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user