πŸ” Overview

TrackingDomainPipeline manages a pipeline of tracking domains used in Voluum campaigns.

It stores one active domain plus an ordered list of backups and automates failover:

  • monitoring via Google Safe Browsing / DNS / Google Search Console safety checks
  • blocking the active domain and switching to the next backup domain
  • optionally updating Voluum campaigns to use the new tracking domain
  • optionally creating an Affise switch request when switching
  • keeping an audit trail in pipe_log

Optionally, the pipeline can maintain a redirect mapping in a Redis β€œdomain bridge” when proxy mode is enabled.


πŸ“‘ Fields

FieldTypeDescription
active_domainstrCurrent active tracking domain.
backup_domainsJSON list[str]Ordered list of backup domains.
blocked_domainsJSON list[str]Domains blocked by monitoring (auto-managed).
unblocked_domainsJSON list[str]Domains unblocked later (auto-managed).
is_activeboolWhether this pipeline participates in monitoring/switching.
with_update_voluumboolIf enabled, switching also updates Voluum campaigns.
with_update_affiseboolIf enabled, switching creates an Affise switch request.
return_to_workboolIf enabled, unblocked domains are returned back into the pipeline.
with_proxyboolEnables redis-domain-bridge mapping behavior.
redirect_fromstrDomain that should redirect to active_domain (proxy use case).
ownerForeign Key UserOptional owner of the pipeline.
created_atdatetimeCreation timestamp.
updated_atdatetimeLast update timestamp.
last_switched_atdatetimeWhen the active domain was last switched.
changed_bystrActor identifier (system/user).
pipe_logJSON list[str]Human-readable pipeline log entries.

πŸ”’ Properties

PropertyTypeDescription
active_root_domainstr (optional)Root domain derived from active_domain.
next_domainstr (optional)First item of backup_domains (the next candidate).
last_blocked_domainstr (optional)Last item of blocked_domains.

🧩 Methods

MethodDescription
get_blocked_domains_map()Returns {root_domain -> [owners...]} for blocked domains across active pipelines.
add_backup_domain(domain, action_by="system")Appends a backup domain and writes to the pipeline log.
block_active_domain(reason, action_by="system", with_switch=True)Blocks the current active domain (moves it to blocked_domains) and optionally switches.
switch_domain(action_by="system")Promotes next_domain to active_domain, updates Voluum if enabled, and can enqueue an Affise switch request.
unblock_domain(domain, action_by="system")Moves a domain from blocked_domains to unblocked_domains and optionally returns it to work.
return_to_work_domain(domain, action_by="system")Moves a domain back into active_domain or backup_domains.
activate_pipeline(action_by="system")Sets is_active=True and sends a Telegram notification.
deactivate_pipeline(action_by="system")Sets is_active=False and sends a Telegram notification.
enable_update_voluum(...) / disable_update_voluum(...)Toggles Voluum campaign updates.
enable_return_to_work(...) / disable_return_to_work(...)Toggles automatic β€œreturn to work” behavior.

πŸ’‘ Notes

  • When with_proxy=True, redirect_from is set, and the pipeline is active, the mapping redirect_from β†’ active_domain is synced to Redis on save/delete.
  • When with_update_affise=True, switch_domain() creates an AffiseSwitchRequest with fields trafficback_url and url to update.
  • When return_to_work is switched from False to True, a signal attempts to return existing unblocked_domains back into the pipeline (only if they are not used elsewhere).