Skip to content

refactor!: drop services.yaml + yq, hardcode the service registry#48

Merged
duynhne merged 3 commits into
mainfrom
feat/drop-services-yaml
Jun 15, 2026
Merged

refactor!: drop services.yaml + yq, hardcode the service registry#48
duynhne merged 3 commits into
mainfrom
feat/drop-services-yaml

Conversation

@duynhne

@duynhne duynhne commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

services.yaml was both a build-time registry and a runtime file parsed by duynhctl via mikefarah yq. The build already clones each service's main and builds binaries, so the registry only needs to exist at build time — and inlining it removes the runtime yq dependency entirely.

  • scripts/lib/common.sh: hardcoded registry as bash arrays; svc_list/svc_field/svc_field_list/svc_build_env keep their names + semantics, so fetch/build/render/stage are unchanged.
  • duynhctl + bash-completion: discover services from /opt/duynhlab/*/ and read PORT from /etc/duynhlab/<svc>.env — no services.yaml, no yq.
  • spec: drop Requires: yq and the %ghost /etc/duynhlab/services.yaml entry; init-service.sh/stage-all.sh stop shipping it.
  • Makefile + CI iterate svc_list; drop the yq install step.
  • Delete dead packages/rpm/scriptlets/.
  • Docs updated (README, AGENTS, 001/003/004/006/007).

BREAKING: /etc/duynhlab/services.yaml is no longer installed and the RPM no longer Requires yq. Adding a service now edits the registry in scripts/lib/common.sh (see docs/006-add-service.md).

Verified by dry-run (accessor unit-tests, render-systemd, duynhctl discovery fixture, bash -n). Full make build/test-install to run in CI.

duynhne added 2 commits June 15, 2026 14:09
services.yaml was a build-time registry AND a runtime file parsed by duynhctl
with mikefarah yq. The build already clones each service's main branch and
builds binaries, so the registry only needs to exist at build time — and a
hardcoded table removes the runtime yq dependency entirely.

- scripts/lib/common.sh: inline the 9-service registry as bash arrays; the
  svc_list/svc_field/svc_field_list/svc_build_env accessors keep their names and
  semantics, so fetch-sources/build-local/render-systemd/stage-all are unchanged.
- duynhctl + bash-completion: discover services from /opt/duynhlab/*/ and read
  PORT from /etc/duynhlab/<svc>.env — no services.yaml, no yq.
- spec: drop `Requires: yq` and the %ghost /etc/duynhlab/services.yaml entry.
- init-service.sh / stage-all.sh: stop shipping + copying services.yaml.
- Makefile + CI: iterate svc_list instead of `yq '.services[].name'`; drop the
  yq install step.
- delete dead packages/rpm/scriptlets/ (nFPM-era, referenced by nothing).
- docs (README, AGENTS, 001/003/004/006/007): registry is now the hardcoded
  block in scripts/lib/common.sh; runtime discovery is filesystem-based.

BREAKING CHANGE: /etc/duynhlab/services.yaml is no longer installed and the RPM
no longer Requires yq. Adding a service now edits the registry in
scripts/lib/common.sh (see docs/006-add-service.md).
Installing then `systemctl enable --now duynhlab-platform.target` now creates
every per-service database + roles and runs migrations automatically — no manual
`duynhdb bootstrap`/`migrate` loop.

- duynhlab-bootstrap.service: Type=oneshot, RemainAfterExit, TimeoutStartSec=3600,
  pulled in + ordered before duynhlab-infra.target (Requires=/After=), so the
  backends (After=infra) wait for a ready, migrated schema.
- lib/duynhlab-bootstrap: waits for PostgreSQL (pg_isready), then idempotent
  duynhdb bootstrap + migrate for all 8 backends.
- duynhdb bootstrap: local peer auth as the postgres OS user when SUPERUSER_DSN is
  unset (same-host DB); SUPERUSER_DSN still used for a remote DB.
- spec: ship + enable the unit; on upgrade %post restarts it so new migrations
  apply before backends restart; first-install message rewritten.
- ship etc/bootstrap.env.example; operators copy it to /etc/duynhlab/bootstrap.env
  only for a remote DB.
- docs (002/003/007 + README): bootstrap is automatic; manual duynhdb is the
  fallback / status path.
Base automatically changed from docs/install-prereqs-cleanup to main June 15, 2026 09:42
feat: auto-bootstrap the database via a systemd one-shot
@duynhne
duynhne merged commit 2b925bf into main Jun 15, 2026
1 check failed
@duynhne
duynhne deleted the feat/drop-services-yaml branch June 15, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant