First commit Go counter service
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
# migadu_counters configuration
|
||||
# Install as /usr/local/etc/migadu_counters/config.toml (or pass -config PATH).
|
||||
|
||||
addr = ":5555" # API: POST /in, POST /out, GET /counters
|
||||
admin_addr = ":9095" # /health and /metrics, no auth
|
||||
auth_token = "…" # REQUIRED (or MIGADU_COUNTERS_AUTH_TOKEN); same value in mailqueuer's config
|
||||
allowed_cidrs = [] # optional source-IP allowlist for the API, e.g. ["10.0.0.0/8"]
|
||||
domains_cdb = "/usr/local/etc/rspamd/db/rspamd_domains_db"
|
||||
exempt = ["support@migadu.com", "contact@migadu.com"] # mail to/from these never counts
|
||||
count_junk = false # count /in requests flagged junk by mizu
|
||||
|
||||
# Counting runs off the request path: /in and /out validate, enqueue and
|
||||
# answer 202; workers drain the queue. A full queue answers 503 (dropped_total).
|
||||
queue_size = 10000
|
||||
workers = 8
|
||||
# Parsed CDB records cached per loaded table (some domains carry thousands of
|
||||
# per-mailbox overrides); 0 disables the cache.
|
||||
max_cached_domains = 20000
|
||||
|
||||
# HTTP server timeouts (seconds); handler_timeout bounds the synchronous part
|
||||
# of a request and each queued counting job.
|
||||
read_header_timeout = 5
|
||||
write_timeout = 30
|
||||
idle_timeout = 60
|
||||
handler_timeout = 4
|
||||
|
||||
[logging]
|
||||
output = "stderr" # daemon(8) -o captures it; or a file path (reopened on SIGHUP)
|
||||
format = "console" # or "json"
|
||||
level = "info"
|
||||
counting_output = "/var/log/migadu_counters/counting.log" # default: same as output; "off" disables
|
||||
counting_format = "text" # Lua-like lines (default) or "json"
|
||||
|
||||
[redis]
|
||||
db = 0 # must stay 0: migadu_web reads message counters from DB 0
|
||||
password = "…" # or MIGADU_COUNTERS_REDIS_PASSWORD
|
||||
pool_size = 32
|
||||
timeout_ms = 500
|
||||
# Sentinel mode (production): writes -> master, reads -> replicas
|
||||
master_name = "mymaster"
|
||||
sentinels = ["10.0.0.10:26379", "10.0.0.11:26379", "10.0.0.12:26379"]
|
||||
sentinel_password = ""
|
||||
# Static mode (used when sentinels is empty)
|
||||
# write_addr = "127.0.0.1:6379"
|
||||
# read_addrs = ["127.0.0.1:6379"]
|
||||
|
||||
[notify]
|
||||
# One URL per level; leave empty to disable notifications for that level.
|
||||
# Placeholders: $LEVEL $ID $FLOW $PERIOD $ADDRESS $COUNT $LIMIT (all URL-escaped).
|
||||
org_url = "https://admin.migadu.com/api/limits?level=$LEVEL&id=$ID&flow=$FLOW&period=$PERIOD&by=$ADDRESS&count=$COUNT"
|
||||
address_url = "https://admin.migadu.com/api/limits?level=$LEVEL&id=$ID&flow=$FLOW&period=$PERIOD&by=$ADDRESS&count=$COUNT"
|
||||
domain_url = "" # web app's D branch is still a TODO
|
||||
user = "…"
|
||||
password = "…" # or MIGADU_COUNTERS_NOTIFY_PASSWORD
|
||||
timeout_seconds = 5
|
||||
Reference in New Issue
Block a user