Skip to content

Phase 3: Remove Legacy Cron-Based Background Job System #1834

@ad-m-ss

Description

@ad-m-ss

Phase 3: Remove Legacy Cron-Based Background Job System

Overview

Remove the legacy cron-based background job system after successful migration to Celery. This cleanup phase eliminates redundant infrastructure and completes the modernization of the background job system.

Scope

This issue focuses exclusively on removing the legacy cron system files and references. It does NOT include any task migration work (handled in Phase 2) or infrastructure setup (handled in Phase 1).

Current Legacy System Components

Cron Infrastructure Files (To Be Removed)

  • .contrib/docker/cron/set_crontab.sh - Cron job definition script
  • .contrib/docker/cron/run_locked.sh - File locking wrapper for cron jobs
  • Cron-related Docker service configurations (if any)
  • Environment variables for cron scheduling (COURT_SESSION_PARSER_SCHEDULE, etc.)

Docker Configuration Updates

  • Remove cron-related services from docker-compose.yml (if present)
  • Remove cron-related environment variables
  • Update Docker build process if cron was part of base image
  • Remove cron-related volumes or mounts

Documentation Updates

  • Remove cron-related documentation from CLAUDE.md
  • Remove cron-related make commands (if any)
  • Update development workflow documentation to reflect Celery-only approach

Implementation Tasks

1. Legacy File Removal

  • Remove .contrib/docker/cron/set_crontab.sh
  • Remove .contrib/docker/cron/run_locked.sh
  • Remove entire .contrib/docker/cron/ directory if no other files remain
  • Remove cron-related Docker configurations

2. Environment Variable Cleanup

  • Remove cron schedule environment variables:
    • EVENT_REMINDERS_SCHEDULE
    • OLD_CASES_REMINDER_SCHEDULE
    • COURT_SESSION_PARSER_SCHEDULE
    • CLEARSESSIONS_SCHEDULE
  • Update Docker environment files
  • Remove from docker-compose.yml environment sections

3. Docker Configuration Cleanup

  • Remove cron service definitions from docker-compose.yml (if any)
  • Remove cron-related volumes or bind mounts
  • Update base Docker images if cron was installed
  • Remove cron-related health checks or dependencies

4. Documentation Updates

  • Update CLAUDE.md to remove cron-related commands
  • Update development workflow documentation
  • Remove references to file locking mechanisms
  • Update troubleshooting sections that mentioned cron

5. Code References Cleanup

  • Search for and remove any code comments referencing cron system
  • Remove unused imports related to file locking (if any)
  • Clean up any configuration that was cron-specific

Files to Remove/Modify

Files to Remove

  • .contrib/docker/cron/set_crontab.sh
  • .contrib/docker/cron/run_locked.sh
  • .contrib/docker/cron/ directory (if empty after removal)

Files to Modify

  • docker-compose.yml - Remove cron-related configurations
  • docker-compose.override.yml - Remove cron overrides if any
  • CLAUDE.md - Remove cron documentation, update with Celery-only workflow
  • Docker environment files - Remove cron schedule variables
  • Makefile - Remove cron-related make targets if any

Files NOT to Modify

  • Management commands (kept for manual execution capability)
  • Django settings (Celery configuration only)
  • Application code (no changes needed)

Dependencies

Safety Requirements

Pre-Cleanup Verification

  • Confirm all Celery tasks are running successfully for at least 1 week
  • Verify Celery beat scheduling is working correctly
  • Confirm no critical failures in Celery task execution
  • Validate that all original cron job functions are preserved in Celery

Rollback Preparation

  • Create backup of all cron-related files before deletion
  • Document exact cron schedules for emergency restoration
  • Keep rollback procedure for re-enabling cron system if needed
  • Test rollback procedure in development environment

Related Issues

Dependencies (Must Be Completed First)

Infrastructure Issues

This issue represents the final cleanup phase after successful Celery migration.

Acceptance Criteria

  • All cron-related files are removed from the repository
  • No cron-related references remain in Docker configurations
  • Documentation reflects Celery-only background job system
  • Cron environment variables are cleaned up
  • Development workflow no longer mentions cron system
  • All background jobs continue running successfully via Celery
  • No regression in background job functionality
  • Clean git history with appropriate commit message

Verification Steps

  • grep -r "cron" . returns no configuration references (excluding this issue)
  • grep -r "SCHEDULE" . returns only Celery-related configurations
  • Docker containers start successfully without cron dependencies
  • All background jobs execute on schedule via Celery beat
  • No file locking mechanisms remain in the codebase

Non-Overlapping Scope Clarification

This issue is distinct from existing issues:

Timeline

This issue should be executed only after:

  1. All Phase 2 task migrations are completed
  2. Celery tasks have been running successfully for at least 1 week in production
  3. Team confidence in Celery system stability is high

Success Metrics

  • Clean Codebase: No legacy cron references remain
  • Simplified Infrastructure: Reduced Docker complexity
  • Maintained Functionality: All background jobs continue working via Celery
  • Documentation Accuracy: Development docs reflect current (Celery-only) system

References

  • Current cron system: .contrib/docker/cron/
  • Legacy documentation in CLAUDE.md (cron sections)
  • Docker configurations with cron environment variables

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions