Fedora Account System authentication support and fedora-messaging integration to Happiness Packets https://happinesspackets.fedorainfracloud.org/
  • Python 66.4%
  • HTML 23.2%
  • CSS 7.4%
  • JavaScript 2.2%
  • Dockerfile 0.8%
Find a file
Justin Wheeler 51d6014997
All checks were successful
CI / lint (pull_request) Successful in 22s
CI / test (pull_request) Successful in 50s
CI / lint (push) Successful in 16s
CI / test (push) Successful in 40s
💚 ci: Switch test suite to SQLite, remove service container deps
The Forgejo Actions CI `test` job has never passed — all 24 runs show
failure. Two root causes: the Forgejo `podman` runner's service
container networking doesn't reliably expose the PostgreSQL hostname,
and the CI pipeline doesn't provision RabbitMQ, causing
`fedora_messaging.api.publish()` to raise `ConnectionException`.

Since the codebase uses zero PostgreSQL-specific features, the test
database backend can safely be switched to SQLite in-memory. This
eliminates all external service dependencies for tests.

Changes to test infrastructure:
- Override `DATABASES` in `tsting.py` to use SQLite in-memory
- Add Celery memory broker settings to prevent Redis connections
- Add `CRISPY_ALLOWED_TEMPLATE_PACKS` for `bootstrap5` compatibility
- Set dummy `ADMIN_USERNAME`/`ADMIN_PASSWORD` for FAS `AccountSystem`
- Create `conftest.py` with autouse fixtures to mock `publish()`,
  `AccountSystem.people_query()`, and provide a stub `STATIC_ROOT`

Changes to CI pipeline:
- Remove `postgres:15` and `redis:7` service containers
- Remove `gcc`/`libpq-dev` system dependency step

Bug fixes surfaced by the new test environment:
- Replace stale `import ckeditor.fields` in migration 0007 with
  `models.TextField` (old `django-ckeditor` removed in Phase 5)
- Pass `link_rel=None` to `nh3.clean()` to fix `ValueError` when `'rel'`
  is in `allowed_attributes` (nh3 >= 0.2.18 API change)

Closes #281.

Assisted-by: Claude Opus 4.6 (1M context)
Signed-off-by: Justin Wheeler <jwheel@fedoraproject.org>
2026-06-20 18:34:22 -04:00
.forgejo 💚 ci: Switch test suite to SQLite, remove service container deps 2026-06-20 18:34:22 -04:00
assets 🧹 frontend: Final cleanup — reorganize assets, update stale references 2026-05-10 13:45:01 -04:00
docs dependencies: Migrate docs deps to root directory 2020-02-12 14:44:47 -05:00
happinesspacket_schema_package 💚 ci: Fix lint and test job failures 2026-05-10 16:58:30 +02:00
happinesspackets 💚 ci: Switch test suite to SQLite, remove service container deps 2026-06-20 18:34:22 -04:00
openshift Add configuration files for local deployment on minishift 2019-08-18 00:42:17 +05:30
templates 🧹 frontend: Final cleanup — reorganize assets, update stale references 2026-05-10 13:45:01 -04:00
.containerignore 🔧 containers: Replace Docker with Podman and UBI-based Containerfile 2026-03-29 02:26:18 -04:00
.coveragerc Port code from Github to Pagure 2018-03-21 12:45:07 -05:00
.env.example 🔧 settings: Refactor to 12-factor env vars, eliminate config files 2026-03-31 11:30:42 -04:00
.gitignore 🔧 settings: Refactor to 12-factor env vars, eliminate config files 2026-03-31 11:30:42 -04:00
AGENTS.md 📝 docs: Update AGENTS.md and README.md for current project state 2026-05-11 06:21:43 -04:00
config.toml Integrate fedora-messaging 2019-03-12 14:42:12 +00:00
conftest.py 💚 ci: Switch test suite to SQLite, remove service container deps 2026-06-20 18:34:22 -04:00
Containerfile 🐛 Containerfile: Write requirements to /tmp in builder stage 2026-05-10 16:00:40 +02:00
fas-admin-details.json.example Remove invalid JSON from fas-admin-details.json.example 2019-03-24 19:27:41 -04:00
LICENSE Port code from Github to Pagure 2018-03-21 12:45:07 -05:00
manage.py Port code from Github to Pagure 2018-03-21 12:45:07 -05:00
podman-compose.yml 🔧 containers: Add persistent volume for RabbitMQ data 2026-05-10 16:05:15 +02:00
poetry.lock ⬆️ frontend: Migrate CKEditor 4 → CKEditor 5 2026-05-10 12:47:01 -04:00
pyproject.toml ⬆️ frontend: Migrate CKEditor 4 → CKEditor 5 2026-05-10 12:47:01 -04:00
README.md 📝 docs: Update AGENTS.md and README.md for current project state 2026-05-11 06:21:43 -04:00

fedora-happiness-packets

License

Fedora Happiness Packets is a Django web application that enables Fedora community members to send anonymous appreciation messages. It integrates with the Fedora Account System (FAS) for user lookup, Fedora OIDC for authentication, and fedora-messaging for publishing events to the Fedora message bus.

Current stack: Django 5.1, Python 3.123.14, Poetry, PostgreSQL, Redis, Celery, Bootstrap 5.3, CKEditor 5.

Modernization Roadmap

This project was dormant from 2021 to 2026 and is undergoing an incremental modernization effort to bring it back into production as an OpenShift-native containerized application within Fedora's infrastructure.

Completed

  • Phase 0: Dead code removal and housekeeping
  • Phase 1: Django 2.0 → 5.1 upgrade (four incremental LTS steps) and deprecated package replacement
  • Phase 2: Pipenv → Poetry migration, pyproject.toml, v1.0.0 release
  • Phase 2.5: Forgejo Actions CI pipeline (lint + test)
  • Phase 3: Containerfile and Podman migration (replace Docker)
  • Phase 4: Settings refactoring (12-factor env vars, eliminate config files)
  • Phase 5: Frontend modernization (Bootstrap 5.3, self-hosted fonts, CKEditor 5, jQuery removed)

Upcoming

  • Phase 6: OpenShift-native manifests (Kustomize, health probes, Routes)
  • Phase 7: Search backend replacement (Haystack/Whoosh → PostgreSQL full-text search)
  • Phase 8: Fedora integration updates (OIDC JWKS discovery, FAS/Noggin API, Redis → Valkey)
  • Phase 9: Forgejo Package Registry and CI/CD (container images, RPM packaging)
  • Phase 10: Production hardening (CSP, HSTS, observability, Celery tuning)

Development

Prerequisites

Quick start

# Install dependencies
poetry install --without docs

# Copy environment template
cp .env.example .env

# Start services (PostgreSQL, Redis, Celery, RabbitMQ)
podman-compose up --build

# Run migrations (in a separate terminal)
podman-compose exec web python manage.py migrate

See .env.example for all available environment variables.

Testing and linting

# Run all tests with coverage
poetry run pytest

# Run a specific test file
poetry run pytest happinesspackets/messaging/tests/test_views.py

# Lint
poetry run ruff check .

Note: Tests that require a database will fail without a running PostgreSQL instance. Use podman-compose or configure DB_HOST to point to an available database.

The test settings module is happinesspackets.settings.tsting (intentionally misspelled to avoid import during test discovery).

Where to find us

Contributing

Contributions are welcome. Please file issues and pull requests on our Forgejo repository.

See AGENTS.md for detailed architecture documentation and conventions.

This project is licensed under the Apache License 2.0.