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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ The following environment variables can be specified:
The role **must** be one of the following:

* `HASHER` - Services the `/h/*` API endpoints for hashing. Note that hashing can be resource intensive.
* `MATCHER` - Services the `/m/*` API endpoints for matching.
* `MATCHER` - Services the `/m/*` API endpoints for matching. The matcher can additionally have the following environment variables:
* `HMA_INDEX_CACHE_INTERVAL_SECONDS` (default `30`) - The interval to cache the internal index at.
* `CURATOR` - Services the `/c/*` API endpoints for managing content, banks, exchanges, etc.
* `CRON` - Runs scheduled tasks and builds the internal index for the matcher(s). There should be no more than one of these running at a time.
* `CRON` - Runs scheduled tasks and builds the internal index for the matcher(s). There should be no more than one of these running at a time. The cron worker can additionally have the following environment variables:
* `HMA_FETCHER_INTERVAL_SECONDS` (default `240` (4 minutes)) - The interval to fetch from exchanges at. This is set to `30` seconds in hma-matrix's `compose.yaml`.
* `HMA_INDEXER_INTERVAL_SECONDS` (default `60` (1 minute)) - The interval to rebuild the internal index at.
* `UI` - Services the `/ui/*` endpoints. Note that the UI might not function if an API key is set. The UI worker is the only worker that's not required to run a complete HMA instance.

The above can then be provided to the hma-matrix Docker image to run a worker:
Expand Down
1 change: 1 addition & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ services:
environment:
<<: *hma-config
HMA_WORKER_ROLE: "CRON"
HMA_FETCHER_INTERVAL_SECONDS: "30"
worker_ui:
<<: *hma-common
depends_on: ["worker_cron"]
Expand Down
6 changes: 3 additions & 3 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@
elif role == "CRON": # There should only be ONE of these
TASK_FETCHER = True
TASK_INDEXER = True
TASK_FETCHER_INTERVAL_SECONDS = 60 * 4
TASK_INDEXER_INTERVAL_SECONDS = 60
TASK_FETCHER_INTERVAL_SECONDS = int(os.environ.get("HMA_FETCHER_INTERVAL_SECONDS", 60 * 4))
TASK_INDEXER_INTERVAL_SECONDS = int(os.environ.get("HMA_INDEXER_INTERVAL_SECONDS", 60))
elif role == "HASHER":
ROLE_HASHER = True
elif role == "MATCHER":
ROLE_MATCHER = True
ROLE_HASHER = False # Can be combined, but not recommended for larger deployments
TASK_INDEX_CACHE = True
TASK_INDEX_CACHE_INTERVAL_SECONDS = 30
TASK_INDEX_CACHE_INTERVAL_SECONDS = int(os.environ.get("HMA_INDEX_CACHE_INTERVAL_SECONDS", 30))
else:
sys.exit("Unknown role: " + role)

Expand Down