Skip to content

Deadline-reminder schedule now provisioned in infra-terraform (prod) — recap #193

Description

@alexeygrigorev

Context

The recurring deadline-reminder schedule is now provisioned entirely in infra-as-code (DataTalksClub/infra-terraform), tracked in infra-terraform#1. The old CMP shell script + manual GitHub Actions workflow have already been removed from this repo — there is nothing for CMP to provision at runtime. This issue is just a recap so the CMP side knows what to keep working.

What was provisioned in Terraform

A new file cmp_deadline_reminder.tf adds:

  • An EventBridge rule running daily at 09:00 UTC (cron(0 9 * * ? *)).
  • An ECS target that launches the prod task as a one-off Fargate task, overriding the container command to:
    python manage.py send_deadline_reminders
    
  • An invocation role EventBridge assumes (ecs:RunTask on course-management-prod:* + iam:PassRole on the execution role).

Details:

  • Account 387546586013, region eu-west-1
  • Cluster: course-management-cluster
  • Task family: course-management-prod (the schedule references the family, so it always runs the latest active revision that CI/CD deploys — no pinning to a stale revision)
  • Container name in override: course-management-prod

What CMP needs to keep working

  • The management command python manage.py send_deadline_reminders must continue to exist and run to completion as a one-off task (it reconciles Datamailer recipient lists, triggers sends, and exits).
  • It runs against prod env/secrets, using the shared Datamailer instance (DATAMAILER_URL = https://datamailer.dtcdev.click, same host for dev and prod).
  • If the container name in the prod task definition ever changes from course-management-prod, the EventBridge containerOverrides[].name in cmp_deadline_reminder.tf must be updated to match — otherwise the override is silently ignored.

What does NOT need changing

  • No GitHub Actions / CI involvement. The CI deploy user (course-management-ci-cd-deploy-user) needs no scheduling permissions — no scheduler:*, iam:CreateRole, or iam:PassRole. terraform apply creates everything.

Notes

  • Schedule runs once per day at 09:00 UTC. To change the cadence or time, it's a one-line edit in cmp_deadline_reminder.tf (schedule_expression).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestinfraRequires AWS/CI/deploy/prod-environment work; not solvable in the app code alone

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions