mirror of
https://github.com/Haidra-Org/AI-Horde.git
synced 2026-11-06 05:17:31 +00:00
- horde/database/kudos_retention.py moves one partition one step per tick under the retention lock: statistic partitions are folded into daily rollups, their quarantined rows moved and an archive dump written or waived; currency partitions are checkpointed per user with daily statements, exported, verified against the manifest and the online rows, then dropped - KUDOS_RETENTION_POLICY is loaded from the environment at import and refuses windows below 30 days, partition widths outside 1 to 31 days, and a configured archive without a byte budget - Nothing is removed unless KUDOS_RETENTION_ENABLED is set; a drop grace period detaches a partition before dropping it, and KUDOS_RETENTION_HOLD_DROPS keeps drop-ready partitions attached - A unit that fails a guard is blocked with a reason until an operator unblocks it, waives its dump, recheckpoints from it or reattaches its partition; restore_archive_unit loads an archived unit back into a table - expire_idempotency_keys removes keys older than the key lifetime in batches - .env_template documents the retention and archive variables - tests/unit/test_kudos_retention.py and tests/integration/test_kudos_retention_end_to_end.py cover the step table, guards, operator paths and a full run against the managed object store
146 lines
8.6 KiB
Plaintext
146 lines
8.6 KiB
Plaintext
# SPDX-FileCopyrightText: 2022 Konstantinos Thoukydidis <mail@dbzer0.com>
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
# Horde Display
|
|
HORDE_TITLE="AI Horde"
|
|
HORDE_NOUN="Horde"
|
|
HORDE_URL="https://aihorde.net"
|
|
# The public source repository; the privacy document links it. Default: https://github.com/Haidra-Org/AI-Horde.
|
|
# HORDE_REPOSITORY="https://github.com/Haidra-Org/AI-Horde"
|
|
# Optional frontpage base URL; problem-user Discord alerts link to the moderation event under it.
|
|
# HORDE_MODERATION_FRONTPAGE_URL="https://aihorde.net"
|
|
HORDE_CONTACT_EMAIL="aihorde@dbzer0.com"
|
|
HORDE_LOGO="https://raw.githubusercontent.com/db0/Stable-Horde/main/img_stable/0.jpg"
|
|
HORDE_HTML_TERMS="terms_of_service.html"
|
|
HORDE_HTML_PRIVACY="privacy_policy.html"
|
|
HORDE_MARKDOWN_INDEX="index_stable.md"
|
|
# The elected image-reference publisher fetches through horde-model-reference in REPLICA mode.
|
|
# Fleet publication requires a PRIMARY; HMR's GitHub fallback is never published to Redis.
|
|
HORDE_MODEL_REFERENCE_PRIMARY_API_URL="https://models.aihorde.net/api"
|
|
# Where horde-model-reference writes its on-disk reference cache. Relative paths resolve against
|
|
# the process working directory, so set it explicitly for a deployment.
|
|
AIWORKER_CACHE_HOME="models"
|
|
# How long a cold-starting instance waits for the elected bootstrap publisher to populate Redis.
|
|
HORDE_MODEL_REFERENCE_BOOTSTRAP_TIMEOUT="195"
|
|
# Maximum duration of the fenced Redis publication lease used for one complete remote refresh.
|
|
HORDE_MODEL_REFERENCE_PUBLISH_LOCK_SECONDS="180"
|
|
# Categories whose pending (beta) models are merged over the canonical reference. Empty disables beta.
|
|
HORDE_BETA_MODEL_CATEGORIES="image_generation"
|
|
# A reader-level AI-Horde API key for the pending-model reads. The anonymous key is accepted.
|
|
HORDE_BETA_MODELS_API_KEY="0000000000"
|
|
HORDE_IMAGE_LLM_REFERENCE="https://raw.githubusercontent.com/db0/AI-Horde-text-model-reference/main/db.json"
|
|
# Set to 1 to prevent user specifying a worker who doesn't have them as prio
|
|
# When enabled. targeted worker request will also not use any kudos except some horde tax
|
|
HORDE_REQUIRE_MATCHED_TARGETING=0
|
|
# Set to 1 to make specifying a worker allow/denylist require upfront kudos
|
|
HORDE_UPFRONT_KUDOS_ON_WORKERLIST=0
|
|
# Limits on chat submits (POST /v2/generate/chat/async) from one ordinary address, in flask-limiter notation.
|
|
# Clients behind one egress address, such as the users of one chat front, share them. Unset, each follows the text
|
|
# submit limit (2/second and 90/minute); the text and image limits do not change.
|
|
# HORDE_CHAT_REQUEST_2SEC_LIMIT_PER_IP=2/second
|
|
# HORDE_CHAT_REQUEST_90MIN_LIMIT_PER_IP=90/minute
|
|
# Retention of moderation evidence (rejected prompts and worker reports), in days from capture. Worker report
|
|
# records (counted by the problem-job alerts) follow the address window and the ceiling too.
|
|
# The privacy document discloses these values. Invalid values stop startup.
|
|
# Prompt text is removed after this many days. "none" keeps it until the ceiling. Default: none.
|
|
# HORDE_MODERATION_TEXT_RETENTION_DAYS=none
|
|
# The address is removed after this many days; its pseudonym, keyed with secret_key, stays until the ceiling.
|
|
# "none" keeps the address until the ceiling. Default: 30.
|
|
# HORDE_MODERATION_IPADDR_RETENTION_DAYS=30
|
|
# After this many days an event is anonymized: its identifying values and address pseudonym are removed, while its
|
|
# reason, outcome, models, reporting worker and notes stay; worker report records are deleted. At most 365; it
|
|
# cannot be disabled, and neither window above may exceed it. Default: 365.
|
|
# The windows and the ceiling skip events with a moderator note and events and worker report records of a flagged or
|
|
# suspicious account; those are kept without limit. Wiping an account removes none of these records.
|
|
# HORDE_MODERATION_EVIDENCE_CEILING_DAYS=365
|
|
# Automatic timeout of one IP subject for model rejections, counted per subject over an hour. A positive whole
|
|
# number; an invalid value stops startup.
|
|
# Model rejections after which the next one times out the IP subject. Raid mode times out every one. Default: 5.
|
|
# HORDE_MODEL_REJECTION_TIMEOUT_THRESHOLD=5
|
|
# Worker suspicion history rows are deleted after this many days, at most 36500, unless the worker's account is
|
|
# flagged or suspicious. The ceiling does not apply, and the privacy document discloses the period. Default: unset,
|
|
# which keeps them indefinitely.
|
|
# HORDE_WORKER_SUSPICION_RETENTION_DAYS=365
|
|
# Google Oauth2
|
|
GOOGLE_CLIENT_ID=""
|
|
GLOOGLE_CLIENT_SECRET=""
|
|
GOOGLE_VERIFICATION_STRING=""
|
|
# Discord Oauth2
|
|
DISCORD_CLIENT_ID=""
|
|
DISCORD_CLIENT_SECRET=""
|
|
# Github Oauth2
|
|
GITHUB_CLIENT_ID=""
|
|
GITHUB_CLIENT_SECRET=""
|
|
# Patreon Creator Token
|
|
PATREON_CREATOR_ACCESS_TOKEN=""
|
|
# Put some random secure string. It salts stored API keys and keys the moderation address pseudonym, so never
|
|
# rotate it. Left unset or at this placeholder, moderation records store no address pseudonym.
|
|
secret_key="changeme"
|
|
# The FQDN of your redis DB loadblancer. This is used to store all caches. You can use the redis IP directly if you do not have an FQDN
|
|
REDIS_IP="redis.example.com"
|
|
REDIS_PORT=6379
|
|
# The IPs of your redis component DBs. We use this to write all caches, to facilitate failovers
|
|
REDIS_SERVERS='["127.0.0.1"]'
|
|
# Seconds a redis command or connection attempt may wait before it fails. Bounded so a stalled redis
|
|
# cannot pin request threads and their database transactions. Defaults: 5 and 3.
|
|
# REDIS_SOCKET_TIMEOUT=5
|
|
# REDIS_SOCKET_CONNECT_TIMEOUT=3
|
|
# If you have a postgresql DB available, set this to 0
|
|
USE_SQLITE = 1
|
|
# The FQDN of your postgres DB. You can use an IP address if you don't have an FQDN
|
|
POSTGRES_URL="postgres.example.com/postgres"
|
|
POSTGRES_PASS="changeme"
|
|
POSTGRES_USER="postgres"
|
|
# The user which will be the admin of this horde
|
|
ADMINS='["db0#1"]'
|
|
# How much Kudos a user needs to generate with their worker until they become trusted
|
|
KUDOS_TRUST_THRESHOLD=1
|
|
# AWS/Cloudflare R2 Info
|
|
AWS_ACCESS_KEY_ID=""
|
|
AWS_SECRET_ACCESS_KEY=""
|
|
AWS_DEFAULT_REGION=auto
|
|
# Shared AWS/Cloudflare R2 Info
|
|
SHARED_AWS_ACCESS_ID=""
|
|
SHARED_AWS_ACCESS_KEY=""
|
|
R2_TRANSIENT_ACCOUNT="https://a223539ccf6caa2d76459c9727d276e6.r2.cloudflarestorage.com"
|
|
R2_PERMANENT_ACCOUNT="https://a223539ccf6caa2d76459c9727d276e6.r2.cloudflarestorage.com"
|
|
R2_TRANSIENT_BUCKET="horde-transient"
|
|
R2_PERMANENT_BUCKET="horde-permanent"
|
|
R2_SOURCE_IMAGE_BUCKET="horde-source-images"
|
|
# Bucket for offloaded chat messages objects; defaults to R2_SOURCE_IMAGE_BUCKET, beside the request's images.
|
|
# R2_CHAT_MESSAGES_BUCKET="horde-chat-messages"
|
|
# Moderation evidence text store, a bucket of its own. Captured prompt text moves here from the database in the
|
|
# background; moderators read it through short-lived signed links. Unless the endpoint, bucket and both token
|
|
# variables are set, the text stays in the database and the listing carries it inline.
|
|
# R2_EVIDENCE_ACCOUNT="https://<account>.r2.cloudflarestorage.com"
|
|
# R2_EVIDENCE_BUCKET="horde-moderation-evidence"
|
|
# The signing region; R2 uses "auto", the default. Set it for another S3-compatible store.
|
|
# R2_EVIDENCE_REGION="auto"
|
|
# EVIDENCE_AWS_ACCESS_KEY_ID=""
|
|
# EVIDENCE_AWS_SECRET_ACCESS_KEY=""
|
|
# Kudos event retention. Exact currency and statistic events stay in the database for at least the window; older
|
|
# statistic events are reduced to daily rollups, older currency events are checkpointed and archived. Nothing is
|
|
# removed unless retention is enabled. Windows are days and cannot be below 30; the partition width is 1 to 31 days.
|
|
# KUDOS_RETENTION_ENABLED=false
|
|
# KUDOS_RETENTION_CURRENCY_DAYS=30
|
|
# KUDOS_RETENTION_STATISTICS_DAYS=30
|
|
# KUDOS_PARTITION_WIDTH_DAYS=7
|
|
# Archive bucket for currency exports and best-effort statistic dumps, S3-compatible, a bucket of its own. Unless the
|
|
# endpoint, bucket and both token variables are set there is no archive: statistics are still rolled up and removed,
|
|
# currency partitions stay online after their checkpoint. The budget is required when the archive is configured;
|
|
# only statistic dumps are evicted to stay within it.
|
|
# KUDOS_ARCHIVE_ACCOUNT="https://<endpoint>"
|
|
# KUDOS_ARCHIVE_BUCKET="horde-kudos-archive"
|
|
# KUDOS_ARCHIVE_REGION="auto"
|
|
# Key prefix for this deployment, so several deployments can share one bucket.
|
|
# KUDOS_ARCHIVE_PREFIX=""
|
|
# KUDOS_ARCHIVE_AWS_ACCESS_KEY_ID=""
|
|
# KUDOS_ARCHIVE_AWS_SECRET_ACCESS_KEY=""
|
|
# KUDOS_ARCHIVE_BUDGET_BYTES=10737418240
|
|
# Fill these in from https://www.google.com/recaptcha/ to enable recaptcha on registration
|
|
RECAPTCHA_SITE_KEY=""
|
|
RECAPTCHA_SECRET_KEY=""
|
|
# Provide a stripe API key to enable stripe integration. The API key needs read on product and customers.
|
|
STRIPE_API_KEY=""
|