#!/bin/bash # BookWyrm Worker Container Entrypoint # Simplified - init containers handle Redis readiness set -e echo "[$(date +'%Y-%m-%d %H:%M:%S')] Starting BookWyrm Worker Container..." # Only handle worker-specific tasks (Redis handled by init container) # Create temp directory for worker processes mkdir -p /tmp/bookwyrm chown bookwyrm:bookwyrm /tmp/bookwyrm # Clean up any stale supervisor sockets and pid files rm -f /tmp/bookwyrm-supervisor.sock rm -f /tmp/supervisord-worker.pid # Test Celery connectivity (quick verification) echo "[$(date +'%Y-%m-%d %H:%M:%S')] Testing Celery broker connectivity..." python -c " from celery import Celery import os app = Celery('bookwyrm') app.config_from_object('django.conf:settings', namespace='CELERY') try: # Test broker connection with app.connection() as conn: conn.ensure_connection(max_retries=3) print('✓ Celery broker connection successful') except Exception as e: print(f'✗ Celery broker connection failed: {e}') exit(1) " echo "[$(date +'%Y-%m-%d %H:%M:%S')] BookWyrm worker container initialization completed" echo "[$(date +'%Y-%m-%d %H:%M:%S')] Starting worker services..." # Execute the provided command (usually supervisord) exec "$@"