Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Example Environment Variables

# --- PostgreSQL Config ---
POSTGRES_USER=moss_user
POSTGRES_PASSWORD=your_secure_password
Expand All @@ -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
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
9 changes: 7 additions & 2 deletions backend/celery_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
Expand All @@ -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
Expand Down