Skip to content

Conversation

@cex-trader
Copy link

Description

This MR fixes critical Docker deployment issues and improves the containerized setup:

  1. Missing Dependency: Adds google-auth-oauthlib package which is required by horilla_backup module but was missing from requirements.txt, causing ModuleNotFoundError during application startup.

  2. Translation Compilation: Installs gettext tools in Dockerfile and adds automatic translation file compilation in entrypoint.sh, fixing the language selection feature that wasn't working due to missing compiled .mo files.

  3. Startup Reliability: Improves entrypoint.sh with database connection wait logic and better error handling to ensure migrations and static file collection complete successfully before starting the server.

Dependencies Required:

  • google-auth-oauthlib (new dependency)
  • gettext system package (for translation compilation)

Ticket Link

N/A

Summary of Changes

  • Add google-auth-oauthlib to requirements.txt
  • Install gettext package in Dockerfile runtime stage
  • Add database connection wait logic in entrypoint.sh
  • Add automatic translation file compilation (compilemessages) in entrypoint.sh
  • Add --noinput flags to migration commands for non-interactive execution
  • Improve error handling for admin user creation (skip if already exists)

Additional implementation details (OPTIONAL)

  • Database wait loop uses psycopg2 connection test to ensure database is ready before migrations
  • Translation compilation uses || echo fallback to prevent startup failure if some translations fail
  • All migration and collection commands use --noinput flag for Docker compatibility
  • Added set -e at the beginning of entrypoint.sh for better error handling

Deployment Notes (OPTIONAL)

  • No breaking changes - this is a bug fix and improvement
  • Existing Docker deployments will need to rebuild images to get the fixes
  • Translation files will be automatically compiled on container startup
  • First-time deployments will benefit from improved database wait logic
  • The gettext package adds ~10MB to the Docker image size

Screenshot

Before

Error during startup:

ModuleNotFoundError: No module named 'google_auth_oauthlib'

Language selection not working:

  • Translation files existed but were not compiled (missing .mo files)
  • Language switcher in UI had no effect

Potential race conditions:

  • Server might start before database is fully ready
  • Migrations could fail silently

After

Successful startup:

  • All dependencies installed correctly
  • Translation files compiled automatically
  • Language selection works properly

Improved reliability:

  • Database connection verified before migrations
  • Better error handling throughout startup process
  • Non-interactive execution suitable for Docker environments

- Add google-auth-oauthlib to requirements.txt (required by horilla_backup module)
- Install gettext tools in Dockerfile for translation compilation
- Improve entrypoint.sh with database wait logic and automatic translation compilation
- Fix language selection not working due to missing compiled translation files
@cex-trader cex-trader force-pushed the fix/docker-translation-and-dependencies branch from 74cbaa8 to 45016db Compare December 31, 2025 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant