only restart issue and logout issue debugging added

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-15 07:14:06 +00:00
parent 9ec87ed932
commit 68942410ae
8 changed files with 317 additions and 2 deletions

View File

@@ -12,9 +12,15 @@ RUN npm install
# Copy source code (will be mounted as volume, but needed for initial setup)
COPY . .
# Copy startup script
COPY container_startup.sh /app/
RUN chmod +x /app/container_startup.sh
# Expose Vite dev server port
EXPOSE 5173
# Use startup script as entrypoint to log container lifecycle
# Start Vite dev server with host binding for Docker
ENTRYPOINT ["/app/container_startup.sh"]
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "5173"]

View File

@@ -0,0 +1,44 @@
#!/bin/sh
# Frontend Container Startup Logger
# Logs container lifecycle events for debugging restarts
echo "=========================================="
echo "[CONTAINER-STARTUP] $(date '+%Y-%m-%d %H:%M:%S')"
echo "Container: igny8_frontend"
echo "Hostname: $(hostname)"
echo "PID: $$"
echo "=========================================="
# Log environment info
echo "[INFO] Node version: $(node --version 2>&1)"
echo "[INFO] NPM version: $(npm --version 2>&1)"
echo "[INFO] Vite backend URL: ${VITE_BACKEND_URL:-not set}"
echo "[INFO] Working directory: $(pwd)"
# Check if this is a restart
if [ -f /tmp/container_pid ]; then
PREV_PID=$(cat /tmp/container_pid)
echo "[WARNING] Previous container PID found: $PREV_PID"
echo "[WARNING] This appears to be a RESTART event"
echo "[WARNING] Check Docker logs for SIGTERM/SIGKILL signals"
else
echo "[INFO] First startup (no previous PID file found)"
fi
# Save current PID
echo $$ > /tmp/container_pid
# Check for git directory changes (common restart trigger)
if [ -d "/app/.git" ]; then
echo "[INFO] Git directory detected in /app/.git"
echo "[WARNING] Git operations may trigger container restarts due to Vite file watching"
echo "[INFO] Last git commit: $(cd /app && git log -1 --format='%h %s' 2>/dev/null || echo 'N/A')"
fi
echo "=========================================="
echo "[CONTAINER-STARTUP] Initialization complete"
echo "[CONTAINER-STARTUP] Starting Vite dev server..."
echo "=========================================="
# Execute the CMD passed to the script
exec "$@"

View File

@@ -190,6 +190,15 @@ export default defineConfig(({ mode, command }) => {
allowedHosts: true,
watch: {
usePolling: true, // Needed for file watching in Docker
ignored: [
'**/node_modules/**',
'**/.git/**', // CRITICAL: Ignore git directory to prevent restart on commits
'**/dist/**',
'**/build/**',
'**/.vscode/**',
'**/.idea/**',
],
interval: 1000, // Poll every 1 second (default is 100ms)
},
hmr: {
// Behind reverse proxy - explicitly set host and port to public domain