164 Commits
Author SHA1 Message Date
tazlin fd36046967 chore: emphasize role of '-i' server cli flag 2026-07-05 14:58:47 -04:00
tazlin 415277541a feat: build out test framework, CI test stack, and load-surfaced hardening
Establishes additional unit/integration testing, the CI to run it, and the runtime fixes those tests surfaced

Testing
- Add unit (ORM/function) and integration (API route) tiers over a shared dependency runtime that auto-provisions Postgres, Redis, and S3-compatible object storage (Garage) via testcontainers, with an external-deps mode.
- Add fixtures/factories plus coverage for user roles, kudos pricing, worker.can_generate, countermeasures, WP activation, and adversarial malformed-input route sweeps.
- Modularize the locust suite into locustsuite/ and add a stability-only smoke gate (check_smoke_results.py).

CI / tooling
- Rework pr/main/trusted-fork/publish workflows around composite actions (setup-test-python, start-test-stack) and a Dockerized PG+Redis+Garage stack.
- Bump the Python floor to 3.12 (+3.13 matrix) and consolidate on uv.

Runtime hardening
- Make telemetry activation opt-in (telemetry_enabled): the image stays telemetry-capable but a bare server.py is inert unless an OTLP endpoint or AI_HORDE_TELEMETRY_ENABLED is set.
- Turn NUL bytes, out-of-range user ids, and duplicate worker names into clean 4xx responses instead of session-poisoning 500s.
- Fix get_anon() to resolve the anon account by oauth_id (re-enabling the kudos-transfer guards); shrink and instrument the SQLAlchemy pool (15/5) to expose connection-hold inefficiency as pool timeouts rather than PG refusals.
2026-07-05 13:36:59 -04:00
tazlin 93d0ce49c6 fix: remove telemetry references 2026-07-05 13:36:59 -04:00
tazlin c8e2faf300 style: auto-applied lint fixes 2026-07-05 13:36:59 -04:00
tazlin fc5a05170f refactor: main namespace importable; integration and unit tests
- Reworks many import-time behaviors to their own functions. This is to facilitate making the AI-Horde 'package' importable without side-effects - this makes unit testing possible.
- Moves existing integration tests to 	ests/integration
- Create unit tests for constants, exceptions, imports, and utility functions.
2026-07-05 13:36:59 -04:00
tazlin f40ae696ac chore: make waitress threads configurable via CLI
Add CLI options to configure Waitress worker threads and connection limit and update the server to use CLI-provided values.

- Introduces `--waitress_threads` (default 45, the previously hard coded value) and `--waitress_connection_limit` (default 1024, also the same prior)
- Replaces the hard-coded threads/connection_limit in server startup with values taken from args.
2026-04-04 16:10:56 +02:00
db0 ba11a8cbe4 feat: allow setting listen address 2025-04-09 18:10:39 +02:00
Lina Ceballosanddb0 2a75039034 NGI - Updating licensing aspects according to REUSE (#440)
* creating LICENSES directory

* adding headers with copyright and license info to various files

* fix: switch to AGPL 3-or-later

* feat: added all missing licenses

* chore: linting

* ci: Added reuse lint job

---------

Co-authored-by: db0 <mail@dbzer0.com>
2024-08-10 14:00:03 +02:00
Divided by Zer0 c99bc84075 feat: adds waitress / db metrics to heartbeat (#425)
* feat: adds waitress / db metrics to heartbeat

* feat: auto-whitelist service accounts

* chore: linting
2024-06-20 12:29:26 +02:00
Divided by Zer0 43a602e48f Chore: run black and ruff (#364)
* Run black
* Run ruff
* Added 3 tests
2024-02-12 19:27:24 +01:00
Namwon Kim 153b1a0865 docker image build (#260)
* docker image build

* Added Docker image usage method
2023-07-12 09:52:54 +02:00
Namwon Kim 90339c0cad Dynamic loading of dotenv files based on environment variables (#255) 2023-07-06 08:22:41 +02:00
Divided by Zer0 3ff8d32407 Migrate to an SQL DB ORM (#87)
Refactored to an ORM
2022-12-05 17:57:50 +01:00
Divided by Zer0 d2c38cc9d0 Workers failing jobs are put into maintenance
Allows custom maintenance messages

Threshold to be put into maintenance in an hour increased
Workers put into maintenance for failing jobs use custom maintenance message

added thread locking for wp

shutdown should always activate maintenance

better concurrency calculation for anon
increased requirement for dropped jobs
more logging about cancelled gens
update last_aborted_job every hour
allows 'any model' to  work again
removed_overseer
2022-11-25 17:28:15 +01:00
Divided by Zer0 62c29b807f raiding countermeasures (#40)
* Added worker invite mode
* separation between admin and mods
* removed mods from .env
* discord link
* mods_can_see_paused
* avoid_url_breaking_from_quotes
* Generalized things per sec suspicion threshold
* ip check
* merged modes into one endpoints
* profanity filter
* worker count
* moved dicts and lists internally to classes
* added worker ip control
* Added find_user
* Can now see which workers the user owns
* User details by default show worker count
* Privileged user details show worker ids
* Can set workers names, info and user usernames
* Allows assigning monthly_kudos
* moderators gain 100000 kudos per month
* Uses redis for ip safety caching
* allows to explicitly request trusted workers
* prevent anon from renaming stuff
* disabled APIv1
* news
* offloaded seed gen to horde
* frontpage update
2022-10-11 12:42:40 +02:00
Divided by Zer0 e9288ec5cd Switch REST API to flask-restx and added APIv2 (#9)
* Refactored code to be able to handle multiple Hordes
* Switched to flask-restx for API
* Refactored API to be able to handle multiple API versions
* Added API documentation
* Added limiter per endpoint
2022-09-27 16:08:03 +02:00
Divided by Zer0 bd6d2d9a1d Management endpoints
*  Switch to redis for limiter storage
* A user and server management endpoints
* Added maintenance mode
* limiter now correctly handles foreign IPs
2022-09-22 15:51:28 +02:00
Divided by Zer0 22d20a4ba7 Waitress threads (#4)
More power for waitress
2022-09-21 16:27:04 +02:00
Divided by Zer0 cf893b3452 Added Working Prompt Queue Stats
Increased anon concurrent requests and allows for future expanding individual user concurrency
2022-09-20 13:26:45 +02:00
Divided by Zer0 c18d613fd4 feat: Allows async generations (#1)
Limited steps to 100
2022-09-20 00:07:41 +02:00
Divided by Zer0 7a6cba9150 fix: bugs introduced by performance API 2022-09-19 17:34:21 +02:00
Divided by Zer0 8313abfc15 added stats class 2022-09-19 13:22:56 +02:00
Divided by Zer0 c889394bfa oops 2022-09-19 01:25:59 +02:00
Divided by Zer0 525587d575 convert pixels to pixelsteps 2022-09-19 01:16:13 +02:00
Divided by Zer0 153456d30a user the more accurate pixelsteps for contributions 2022-09-19 00:32:34 +02:00
Divided by Zer0 35c90f6f99 oops 2022-09-18 14:44:41 +02:00
Divided by Zer0 195bbfa5e8 avoids user errors 2022-09-18 14:34:55 +02:00
Divided by Zer0 1abc0b642f catch breaks regparse 2022-09-17 17:33:10 +02:00
Divided by Zer0 8d471618e7 test 2022-09-17 04:58:02 +02:00
Divided by Zer0 ad831d0082 test 2022-09-17 04:56:48 +02:00
Divided by Zer0 61680fcbe7 test 2022-09-17 04:56:03 +02:00
Divided by Zer0 d8205ec0ef server sends back the seed 2022-09-16 17:35:49 +02:00
Divided by Zer0 5d6382f446 return kudos, not pixels 2022-09-16 17:29:30 +02:00
Divided by Zer0 12bbbc3671 prevent access via port 2022-09-16 14:30:00 +02:00
Divided by Zer0 26d5696b8d prevent access via port 2022-09-16 14:29:19 +02:00
Divided by Zer0 21eb5327c2 google-verification 2022-09-15 12:50:02 +02:00
Divided by Zer0 66936a5483 fix 2022-09-14 18:47:49 +02:00
Divided by Zer0 e9b54e0f82 default_to_kpx 2022-09-14 18:41:11 +02:00
Divided by Zer0 8e17032cdb fix: 2022-09-14 18:25:16 +02:00
Divided by Zer0 60621ae8f4 readme 2022-09-14 18:17:35 +02:00
Divided by Zer0 152283b80e servers 2022-09-14 17:18:02 +02:00
Divided by Zer0 d2b295ca92 reject invalid sizes 2022-09-14 15:47:12 +02:00
Divided by Zer0 fdb4fc1190 oops 2022-09-14 15:37:07 +02:00
Divided by Zer0 ac1dc6efad test.py 2022-09-14 15:35:27 +02:00
Divided by Zer0 c1188a1938 title 2022-09-14 13:39:59 +02:00
Divided by Zer0 38ef860d3f adjustments 2022-09-14 01:38:26 +02:00
Divided by Zer0 83c480a62f initial refactor for SD Horde 2022-09-13 23:59:08 +02:00
Divided by Zer0 485c715b36 Added verbosity switches 2022-09-12 16:24:17 +02:00
Divided by Zer0 766c042a33 converted server to loguru 2022-09-12 15:45:29 +02:00
Divided by Zer0 dba0321c66 Added kudos transfer REST 2022-09-10 17:19:39 +02:00