diff --git a/docker-compose.yml b/docker-compose.yml index b658f25..bbc14fc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -120,6 +120,15 @@ services: - ANYTIME_MAILBOX_OTP_CODE=${ANYTIME_MAILBOX_OTP_CODE} - ANYTIME_MAILBOX_OTP_POLL_SECONDS=${ANYTIME_MAILBOX_OTP_POLL_SECONDS:-6} - ANYTIME_MAILBOX_OTP_TIMEOUT_SECONDS=${ANYTIME_MAILBOX_OTP_TIMEOUT_SECONDS:-180} + # Listmonk source campaign IDs cloned by scripts.build_trucking_campaigns + # for the daily trucking deficiency-flag segments. Set in .env after + # running scripts/create_deficiency_source_campaigns.py on prod. + - CAMPAIGN_FOR_HIRE_ID=${CAMPAIGN_FOR_HIRE_ID} + - CAMPAIGN_IRP_IFTA_ID=${CAMPAIGN_IRP_IFTA_ID} + - CAMPAIGN_INTRASTATE_ID=${CAMPAIGN_INTRASTATE_ID} + - CAMPAIGN_WEIGHT_TAX_ID=${CAMPAIGN_WEIGHT_TAX_ID} + - CAMPAIGN_EMISSIONS_ID=${CAMPAIGN_EMISSIONS_ID} + - CAMPAIGN_HAZMAT_ID=${CAMPAIGN_HAZMAT_ID} volumes: - worker-data:/app/data depends_on: diff --git a/infra/ansible/inventory/group_vars/all.yml b/infra/ansible/inventory/group_vars/all.yml index 1e78060..ccdb5f4 100644 --- a/infra/ansible/inventory/group_vars/all.yml +++ b/infra/ansible/inventory/group_vars/all.yml @@ -90,6 +90,15 @@ listmonk_smtp_pass: "{{ vault_listmonk_smtp_pass }}" listmonk_admin_user: "{{ vault_listmonk_admin_user }}" listmonk_admin_password: "{{ vault_listmonk_admin_password }}" +# Listmonk draft source campaigns cloned by scripts.build_trucking_campaigns +# for daily trucking deficiency-flag sends. +trucking_campaign_for_hire_id: 309 +trucking_campaign_irp_ifta_id: 310 +trucking_campaign_intrastate_id: 271 +trucking_campaign_weight_tax_id: 272 +trucking_campaign_emissions_id: 273 +trucking_campaign_hazmat_id: 274 + # ── Common packages ─────────────────────────────────────────────────────────── common_packages: - curl diff --git a/infra/ansible/roles/app/templates/app.env.j2 b/infra/ansible/roles/app/templates/app.env.j2 index d17f84a..8dd4cc5 100644 --- a/infra/ansible/roles/app/templates/app.env.j2 +++ b/infra/ansible/roles/app/templates/app.env.j2 @@ -66,6 +66,18 @@ ADMIN_EMAIL={{ smtp_admin_email }} LISTMONK_URL=http://listmonk:9000 LISTMONK_ADMIN_USER={{ listmonk_admin_user }} LISTMONK_ADMIN_PASSWORD={{ listmonk_admin_password }} +LISTMONK_USER={{ listmonk_admin_user }} +LISTMONK_PASS={{ listmonk_admin_password }} +LISTMONK_PASSWORD={{ listmonk_admin_password }} + +# Source campaign IDs cloned by the daily trucking campaign builder. Create/fetch +# them with: python3 scripts/create_deficiency_source_campaigns.py +CAMPAIGN_FOR_HIRE_ID={{ trucking_campaign_for_hire_id | default('') }} +CAMPAIGN_IRP_IFTA_ID={{ trucking_campaign_irp_ifta_id | default('') }} +CAMPAIGN_INTRASTATE_ID={{ trucking_campaign_intrastate_id | default('') }} +CAMPAIGN_WEIGHT_TAX_ID={{ trucking_campaign_weight_tax_id | default('') }} +CAMPAIGN_EMISSIONS_ID={{ trucking_campaign_emissions_id | default('') }} +CAMPAIGN_HAZMAT_ID={{ trucking_campaign_hazmat_id | default('') }} # ── Umami analytics ────────────────────────────────────────────────────────── UMAMI_DB_PASSWORD={{ umami_db_password }} diff --git a/scripts/create_deficiency_source_campaigns.py b/scripts/create_deficiency_source_campaigns.py index e21e0d9..2738775 100644 --- a/scripts/create_deficiency_source_campaigns.py +++ b/scripts/create_deficiency_source_campaigns.py @@ -15,9 +15,17 @@ Usage (inside the workers container on prod): from __future__ import annotations import argparse +import os import sys -import build_trucking_campaigns as b # reuse lm_api + auth + segment defs +# Allow both supported invocation styles: +# python -m scripts.create_deficiency_source_campaigns +# python3 scripts/create_deficiency_source_campaigns.py +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if ROOT not in sys.path: + sys.path.insert(0, ROOT) + +from scripts import build_trucking_campaigns as b # reuse lm_api + auth + segment defs FROM_EMAIL = "Performance West " TEMPLATE_ID = 6 # same wrapper template as the MCS-150 source campaign diff --git a/scripts/tests/check_campaign_segments.py b/scripts/tests/check_campaign_segments.py index c702871..8fd6b53 100644 --- a/scripts/tests/check_campaign_segments.py +++ b/scripts/tests/check_campaign_segments.py @@ -20,6 +20,8 @@ import sys ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) BTC = os.path.join(ROOT, "scripts/build_trucking_campaigns.py") +if ROOT not in sys.path: + sys.path.insert(0, ROOT) def main() -> int: