diff --git a/.env.example b/.env.example index dddc66f..68e43d2 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,3 @@ -# Example Environment Variables - # --- PostgreSQL Config --- POSTGRES_USER=moss_user POSTGRES_PASSWORD=your_secure_password @@ -20,7 +18,17 @@ CELERY_RESULT_BACKEND_URL=redis://localhost:6379/1 # Select the "Public repositories" option for repository access # Generate one at: https://github.com/settings/personal-access-tokens GITHUB_API_TOKEN=ghp_YourGitHubTokenHere + # Email address for OpenAlex polite pool (helps with rate limits) # See: https://docs.openalex.org/how-to-use-the-api/rate-limits-and-authentication#the-polite-pool -OPENALEX_EMAIL=your.email@example.com -VITE_API_BASE_URL=http://0.0.0.0:8000/api/v1 \ No newline at end of file +OPENALEX_EMAIL=your.email + +# --- Windows Setup Notes --- +# Redis is not natively supported on Windows. You can install it via WSL (Ubuntu) or use Memurai (https://www.memurai.com/) +# After installing, ensure Redis is running before starting the Celery worker. + +# Celery logs are written to logs/moss_celery.log using a rotating file handler. +# Make sure the 'logs/' directory exists at the project root, or it will be created automatically. + +# To run the Celery worker manually (outside Docker), activate your virtual environment and run: +# uv run celery -A backend.celery_app worker -l info --pool solo diff --git a/backend/celery_app.py b/backend/celery_app.py index 52e3ff6..0e2420b 100644 --- a/backend/celery_app.py +++ b/backend/celery_app.py @@ -53,6 +53,10 @@ ) celery_handler_class = RotatingFileHandler handler_info = "RotatingFileHandler (standard fallback)" +import os + +log_dir = os.path.join(os.getcwd(), "logs") +os.makedirs(log_dir, exist_ok=True) # Apply the custom logging configuration using the selected handler. # Logs for Celery workers will be directed to 'moss_celery.log'. @@ -63,8 +67,9 @@ # Obtain the application's logger instance *after* the setup is complete. logger = logging.getLogger(__name__) -logger.info(f"Celery logging configured using: {handler_info}.") - +log_path = os.path.join(log_dir, "moss_celery.log") +logger.info(f"Celery logging configured using: {handler_info} → {log_path}") +# --- End of Logging Configuration --- # --- Prevent Celery from overriding custom logging setup --- # Connect a handler to Celery's 'setup_logging' signal. By providing a handler