Add scan cache tracking and improve health checks

- Track scanned FTP directories in MongoDB to avoid redundant scans -
Add endpoints to view and clear scan cache - Improve health check logic
for better startup and error reporting - Add readiness endpoint for
deployment probes - Add test script for health check improvements -
Increase logging verbosity for debugging
This commit is contained in:
rafaeldpsilva
2025-09-22 15:12:40 +01:00
parent c3ba7c0dc0
commit 41b8753a92
6 changed files with 440 additions and 95 deletions

View File

@@ -10,10 +10,10 @@ WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
libssl-dev \
libffi-dev \
build-essential \
curl \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
@@ -34,10 +34,10 @@ ENV PYTHONPATH="/app/src:$PYTHONPATH"
# Expose port
EXPOSE 8008
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
# Health check - allow more time for service initialization
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=5 \
CMD curl -f http://localhost:8008/health || exit 1
# Start the application from src directory
WORKDIR /app/src
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8008"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8008"]