Skip to content

0.3.0: multiple pkg repositories per host, failed check-ins reported, reporting website

Latest

Choose a tag to compare

@dlangille dlangille released this 20 Nov 20:37

Multiple pkg repositories per host

With pkgbase, a host uses several pkg repositories at once: FreeBSD-base for the base system, and FreeBSD-ports or a local repository for everything else. SamDrucker now records every enabled repository on each host, and which repository each package came from. Closes #1 and #6.

The client still sends everything a 0.2.x client sends, and adds two keys:

  • repos - every enabled repository (pkg repos -e), keyed by name
  • package_repos - the installed packages, grouped by repository

repo is still one URL (the first enabled repository), so a 0.3.0 client works with a 0.2.x server. A 0.3.0 server accepts check-ins from 0.2.x and 0.3.0beta clients.

A repository is identified by its URL, not its name: the same name (FreeBSD-base, local) points at different URLs on different hosts. Each host's name and priority for a repository are kept in host_repo.

New in the database:

  • table repo: one row per repository URL
  • table host_repo: each host's enabled repositories, with that host's name and priority for each one
  • column host_package.repo_id
  • functions ReposOnHost(host), PackagesOnHostShowRepo(host) and HostsWithPackageShowRepo(package)

host.repo is still filled in, and the existing query functions return what they did before.

Failed check-ins are reported

Until now, the client threw away the server's reply, so a failed check-in went unnoticed. Now, when curl cannot reach the server, the server returns an HTTP error, or samdrucker.php replies with an error message, the client:

  • prints the reason on stderr
  • logs it to syslog (tag samdrucker, user.err)
  • exits 1, which the periodic script reports in the daily mail

The client needs the reply for this, so it ignores any --output in CURL_OPTIONS. The sample configuration no longer has --output /dev/null.

Reporting website

New, in servers/php/web/: a read-only website for browsing hosts, packages and repositories. You can download any table as CSV, TSV or JSON. See servers/php/web/README.md to install it.

Upgrading

Back up the database first. Then run these scripts, in this order, as the owner of the tables:

  1. PostgreSQL/updates-2026.11.19.sql
  2. PostgreSQL/procedures.sql
  3. PostgreSQL/updates-website.sql (only if you install the website)

If you are upgrading from a release before 0.2.4, run PostgreSQL/updates-2020.08.28.sql first.

Upgrade the server before the clients. If a client is upgraded first, nothing breaks: a 0.2.x server ignores the new keys, and the repositories are simply not recorded until the server is upgraded.

The client now needs /usr/libexec/flua from the base system, and installs samdrucker.repo-to-json.stdin next to samdrucker.sh.

Files added since 0.2.7

  • PostgreSQL/test-multiple-repos.sql
  • PostgreSQL/updates-2026.11.19.sql
  • PostgreSQL/updates-website.sql
  • clients/samdrucker.repo-to-json.stdin
  • servers/php/web/ (README.md, nginx-config.conf, samdruckerweb.conf.sample, include/common.php, and www/: host.php, index.php, package.php, packages.php, repos.php, samdrucker.css, samdrucker.js)

No files were deleted or renamed. There are no file changes since 0.3.0beta12.