feat/seed-demo #7

Merged
vmruiz merged 13 commits from feat/seed-demo into main 2026-08-23 17:57:20 +02:00
Owner
No description provided.
Adds a single-source-of-truth helper app.seed.seed_demo() and a
'python -m app.cli seed-demo' subcommand that populates the DB with
believable dummy data (sources, a local-folder service, and N items
across image/audio/video/text) so a fresh test stack has something to
look at.

Refs #5

Acceptance (issue #5):
- Idempotent by default: re-running on a populated DB is a no-op
- --reset wipes items/sources/services and re-seeds; requires --yes
- Default count is 200 items across 2 sources; --count and
  --source-count override
- --with-failures (default) guarantees at least one failed-status
  item; --no-failures omits them
- All titles prefixed 'Sample ' so they cannot be confused with real
  media
- Refuses to run against a non-localhost DATABASE_URL unless
  --allow-production is passed
- CLI reuses existing argparse style; one-line summary on success
- 14 new tests in tests/test_seed_demo.py; full suite still green
  (3 pre-existing test_job_recovery failures are expected without
  Redis, see #6)
ci: auto-deploy test environment on feat/** and fix/** branches
Some checks failed
Build and Deploy Test Environment / build-and-deploy-test (push) Failing after 23s
b99f9cba2e
Adds a Forgejo Actions workflow that mirrors deploy.yml but for
non-main branches: builds a sha-tagged test image, pushes it to
docker.celor.es, and stands up a side-by-side test stack at
/apps/forgejo/telegramarr-test with dummy secrets and AUTH_DEV_BYPASS.

The test stack is independent of production (/apps/forgejo/telegramarr)
so pushes to feature branches can be exercised by the maintainer
without affecting live users.

Refs #5
fix(ci): use Forgejo context vars in test-deploy workflow
Some checks failed
Build and Deploy Test Environment / build-and-deploy-test (push) Failing after 17s
81443d763e
$GITHUB_REF_NAME / $GITHUB_SHA / $GITHUB_OUTPUT are GitHub Actions
conventions. In Forgejo 15.0.2 these env vars are empty, so the previous
run #5 tagged the image as :test-- and failed at the build step in 23s.

Fix: use the Forgejo-native ${{ github.ref_name }} / ${{ github.sha }}
templates inside the `run:` block, and write outputs to $GITEA_OUTPUT.
Merge branch 'main' into feat/seed-demo
Some checks failed
Build and Deploy Test Environment / build-and-deploy-test (push) Failing after 17s
a05504200a
Bring in:
- Traefik host rule fix (docker-compose hardcodes celor.es)
- Parameterized preview deployments (preview.yml + preview-cleanup.yml)

Drops .forgejo/workflows/test-deploy.yml in favour of preview.yml.

No conflicts; this branch only adds app/seed.py, tests/test_seed_demo.py,
and the seed-demo subcommand in app/cli.py, none of which overlap with
main's changes.
preview.yml (added on main) supersedes this: previews are now provisioned
per PR with a random subdomain, so the shared telegramarr-test stack and
its associated feat/** push trigger are no longer needed.

Keeping this file around would also re-trigger the GITEA_OUTPUT /${} unbound
failure on every push to feat/** branches, since 'act' and minimal Forgejo
runner configs do not always export GITEA_OUTPUT.
ci: add dev-deploy workflow
Some checks failed
Deploy Dev Environment / deploy-dev (push) Failing after 22s
747a4e937a
Continuous deployment to a single, persistent dev stack at
/apps/forgejo/telegramarr-dev. Triggered by every push to any branch
except main (main deploys via deploy.yml). The running stack is always
overwritten with the latest commit of whichever branch was last pushed;
image tags stay immutable per (branch, sha) so any past commit can be
rebuilt by re-pushing.

Design notes:
- Reuses deploy/docker-compose.yml verbatim — it is fully env-var-driven
  (TELEGRAMARR_CONTAINER / APP_DOMAIN / TELEGRAMARR_EDGE_NETWORK / etc.),
  so the same compose covers prod, preview, and dev with no overrides.
- Uses $GITHUB_OUTPUT (verified exported on Forgejo 15.0.2 by run #5),
  with a defensive default to a mktemp file in case a future runner
  reconfiguration stops exporting it. $GITEA_OUTPUT is NOT exported on
  this runner (run #7 failure), so the previous test-deploy workflow's
  use of it was incorrect.
- Uses ${{ github.ref_name }} / ${{ github.sha }} templates rather than
  $GITHUB_REF_NAME / $GITHUB_SHA env vars, which are empty on this
  runner version.
- Runs seed-demo after every deploy so the dev UI is always populated;
  idempotent no-op on subsequent runs once data exists.
- Container / volume / network names are namespaced under
  'telegramarr-dev' via env vars, so dev does not collide with the prod
  or preview stacks on the same runner host.
ci: pre-create dev volumes before compose pull
Some checks failed
Deploy Dev Environment / deploy-dev (push) Failing after 21s
7b68f3f0bd
The base production compose has no top-level volumes: block, so the
named volumes referenced via TELEGRAMARR_*_VOLUME env vars are treated
as undefined external references and 'docker compose pull' fails with:

  service 'telegramarr' refers to undefined volume
  telegramarr-dev-data: invalid compose project

Production sidesteps this because the volumes were created out of band
when the stack was first deployed; preview sidesteps it via
deploy/docker-compose.preview.yml which declares its own volumes block.
The dev stack is brand-new, so we create the four named volumes here.

Future cleanup: add a top-level volumes block to deploy/docker-compose.yml
(env-var-driven, matching the rest of the file) and drop this step.
ci: isolate development branch deployments
Some checks failed
Deploy Development Branch / deploy-dev (push) Failing after 51s
334815dec3
ci: allow seeding isolated dev database
All checks were successful
Deploy Development Branch / deploy-dev (push) Successful in 45s
84e2526411
ci: use stable random development URLs
All checks were successful
Deploy Development Branch / deploy-dev (push) Successful in 1m18s
f7ba9bfcdf
ci: connect Traefik to development networks
All checks were successful
Deploy Development Branch / deploy-dev (push) Successful in 44s
c6a2fe8aa8
seed: ensure default admin user (admin@local/admin) on every run
All checks were successful
Deploy Development Branch / deploy-dev (push) Successful in 49s
835240af9d
The seed-demo CLI now creates a local administrator the first time it
runs against a database, so a freshly provisioned environment is
immediately usable without going through OIDC or running a separate
local create-user command. The default credentials are intentionally
weak for development convenience; the CLI banners the values and
points at 'local set-password' for rotation.

- New DEFAULT_ADMIN_EMAIL / DEFAULT_ADMIN_PASSWORD constants in app/seed.
- New _ensure_default_admin helper, idempotent and role_locked so a
  later OIDC login cannot silently demote the seeded administrator.
- SeedResult gains created_admin so callers/tests can distinguish a
  fresh install from a re-run.
- --reset still only wipes demo tables; the admin survives.
- The CLI surfaces the credentials on first creation and stays quiet
  on subsequent runs.
ci: stabilize branch deployment identity
All checks were successful
Deploy Development Branch / deploy-dev (push) Successful in 2m2s
Clean Up Development Branch / cleanup-dev (pull_request) Successful in 52s
a54abc910f
vmruiz merged commit 622cb2b3c0 into main 2026-08-23 17:57:20 +02:00
vmruiz referenced this pull request from a commit 2026-08-23 17:57:22 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
vmruiz/telegramarr!7
No description provided.