timescale.info
Sign inSign up

How OpenChronology was built

Every merged pull request of openchronology/timeline-app, its first week of commits and its releases; and before them the 2020 PureScript editor, from snapshots of its deleted repositories in the Wayback Machine. Written to this server through the HTTP API.

327 moments · 2020-03-09T00:15:08Z CE – 2026-11-02T20:11:21Z CE · by @athan · @athan

#119 · Build the server as RPM packages for Rocky Linux, RHEL and Fedora

  • timeline-app
  • pull request
  • packages

Part of #116, the first of four PRs as agreed: **RPM**. FreeBSD, macOS (Homebrew tap) and Windows (self-contained installer) follow separately. ## Packages | Target | Base | PostgreSQL | Asset | | --- | --- | --- | --- | | Rocky Linux / RHEL 10 | `rockylinux/rockylinux:10` | the distribution's (16) | `openchronology-server-rocky10-amd64.rpm` | | Fedora 44 | `fedora:44` | the distribution's (18) | `openchronology-server-fedora44-amd64.rpm` | `deploy/rpm-server/Dockerfile` builds `och-convert` and pgmp on each distribution against its own GMP, SQLite and PostgreSQL. On Rocky, PostgreSQL's development files come from the CRB repository. It then stages the same layout as the .deb and runs `rpmbuild`. - The package requires `postgresql-server(:MODULE_COMPAT_ )`, so it installs only alongside the PostgreSQL its pgmp was built for. - It bundles the same pinned Node.js. Automatic dependency scanning is off for the bundled runtime and modules; GMP and SQLite are required explicitly. - The systemd units, configuration template, `openchronology-migrate`, the launcher and `och-import-logs` are the Debian package's (`deploy/debian-server`), shared rather than copied. ## Setup (`openchronology-setup`) RPM distributions don't initialize PostgreSQL the way Debian does, so the package's `%post` runs `/usr/sbin/openchronology-setup`. It mirrors the Debian postinst: - writes `/etc/openchronology/openchronology.env` with a new `AUTH_ENCRYPTION_KEY`; - **initializes PostgreSQL** if it isn't yet (`postgresql-setup --initdb` under systemd, otherwise `initdb` with peer authentication) and starts and enables it; - creates the role, the database and pgmp, migrates, and enables and starts `openchronology`. Upgrades stop the server in `%pre` and print the same advice as the .deb (settings new in this version, back up, `openchronology-migrate`). Removal stops and disables the services and prints how to delete the configuration, database and user. RPM has no purge, so the configuration is kept. Administrators can run `openchronology-setup` again, for example once PostgreSQL is running. **A real-system bug found by testing under systemd:** PostgreSQL's socket directory `/run/postgresql` is created by systemd-tmpfiles only at the *end* of the dnf transaction. Our setup runs before that, so PostgreSQL failed to start on a first install. The setup now creates that directory itself. ## Build, CI and download page - `scripts/server-deb.mjs` → `scripts/server-package.mjs`, which builds either format. - `server-targets.mjs` gains `format`, and `serverPackage()` uses the matching extension. - The CI matrix (`server-packages.yml`) builds and tests all four targets: `test/server-deb.mjs` or the new `test/server-rpm.mjs`. Release validation requires the new assets. - The download page adds Rocky/RHEL 10 and Fedora 44 cards with `curl -fLO … && sudo dnf install ./….rpm`, and a setup-guide link on each card. Fedora and Rocky browsers are recognized. - README and `README.RPM` updated; the RPM README covers SELinux (`httpd_can_network_connect`) and firewalld. ## Tests - **Fedora 44, locally:** `test/server-rpm.mjs` passes in a fresh container. It checks: - PostgreSQL initialized with peer authentication; - the role, pgmp and the schema; - the configuration's permissions and key; - the server answering `/healthz`, `/api/session` and `/api/plugins`; - `och-convert`'s libraries; - the upgrade advice with the key and data kept; - `openchronology-setup` running again; - removal keeping the configuration and data. - **Under real systemd, by hand:** in a booted Fedora 44 container, `dnf install` initialized and enabled PostgreSQL and started and enabled `openchronology`. Health was OK with the database connected, and `dnf remove` stopped it. - **Debian 13:** still builds and passes `test/server-deb.mjs` with the generalized script. - **Rocky Linux 10 is tested only on CI.** Its images need an x86-64-v3 CPU, which the development VM lacks. - Unit tests and `next-platform` pass.

Sources

Open #119 · Build the server as RPM packages for Rocky Linux, RHEL and Fedora in the timeline