Skip to content

Release v2.1.1

Latest

Choose a tag to compare

@huypq02 huypq02 released this 17 Jan 16:53

Release Notes - v2.1.1

Release Date: January 17, 2026
Type: Hotfix Release

Overview

This hotfix release addresses critical deployment issues encountered when running the application in containerized environments (Docker/Render) with non-root users.

Fixes

🐛 Container Permission Issues

Problem: Application failed to start in production due to permission errors when running as non-root user.

Issues Fixed:

  1. NLTK Data Download Failures

    • Error: PermissionError: [Errno 13] Permission denied: '/home/app'
    • Root Cause: NLTK attempted to download language resources to /home/app/nltk_data at runtime, which is not writable by the app user
    • Solution: Pre-download NLTK data (punkt, punkt_tab, stopwords) during Docker build as root user to /usr/local/share/nltk_data/
    • Impact: Faster startup time, no runtime network calls, eliminates permission errors
  2. Matplotlib Cache Directory Errors

    • Error: mkdir -p failed for path /home/app/.config/matplotlib: Permission denied
    • Root Cause: Matplotlib tried to create cache directory in user home directory
    • Solution: Set MPLCONFIGDIR=/tmp/matplotlib environment variable
    • Impact: Matplotlib can now write cache files to writable /tmp directory
  3. Fontconfig Cache Errors

    • Error: Fontconfig error: No writable cache directories
    • Root Cause: Fontconfig (used by matplotlib for font rendering) couldn't write cache
    • Solution: Set XDG_CACHE_HOME=/tmp/.cache environment variable
    • Impact: Eliminates font cache warnings, improves matplotlib performance

🚀 CI/CD Improvements

CD Workflow Enhancement

  • Added conditional check to deploy only when CI tests pass
  • Change: Added if: ${{ github.event.workflow_run.conclusion == 'success' }} to deployment job
  • Impact: Prevents deploying broken builds to production

Technical Details

Dockerfile Changes

# Pre-download NLTK data as root before switching to non-root user
RUN pip install --no-cache-dir -r requirements.txt && \
    python -c "import nltk; \
    nltk.download('punkt', download_dir='/usr/local/share/nltk_data'); \
    nltk.download('punkt_tab', download_dir='/usr/local/share/nltk_data'); \
    nltk.download('stopwords', download_dir='/usr/local/share/nltk_data')"

# Set cache directories to /tmp to avoid permission issues
ENV MPLCONFIGDIR=/tmp/matplotlib
ENV XDG_CACHE_HOME=/tmp/.cache

Files Modified

  • Dockerfile - Added NLTK pre-download and cache environment variables
  • .github/workflows/cd.yml - Added success-only deployment condition

Testing

✅ Verified on Render deployment platform
✅ Confirmed NLTK resources load successfully
✅ Matplotlib/fontconfig errors eliminated
✅ Application starts without permission errors

Upgrade Notes

  • No breaking changes
  • No database migrations required
  • No API changes
  • Simply redeploy using the updated Docker image

Full Changelog: v2.1.0...v2.1.1