Browse documentation
Fountain handbook

Verified extension catalog

Publish packages as pinned archives in a trusted catalog file, so administrators install exact, checksum-verified versions from site administration and forges can prepare them offline.

On this page

How the catalog works

A catalog is one read-only JSON file that you supply with the forge. It declares the packages that forge may install, each as an HTTPS archive with an exact size and SHA-256 checksum. Administrators choose only among those declared packages; there is no installation from arbitrary URLs.

When a declared package is enabled, Fountain downloads the archive, checks its size and checksum, keeps the verified bytes in .cache/packages/ under the package directory, unpacks it, checks that the manifest matches the catalog entry and only then starts it. A verified archive that is already cached is reused without a download, so cached packages also reinstall offline.

Create a package archive

The archive is a gzip-compressed USTAR tar file with the package's files at its root — extension.json, the executable and assets/ — not inside a top-level folder:

tar --format=ustar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner \
  -C hello -cf - extension.json backend assets | gzip -1n > hello-1.0.0.tar.gz
sha256sum hello-1.0.0.tar.gz
stat -c %s hello-1.0.0.tar.gz

Fountain rejects an archive unless:

  • It is exactly one gzip member containing a complete USTAR archive, with nothing but zero padding after it.
  • It contains only regular files and directories: no links, devices, FIFOs, sparse files or PAX and GNU extensions.
  • No entry is absolute, contains .. or a backslash, repeats a path, nests below a file or exceeds 255 bytes.
  • No top-level entry starts with a dot.
  • It has at most 10,000 entries and 512 MiB of file data.

Publish the archive at a stable HTTPS address. Never change the bytes behind a published address; publish a new version instead.

Write the catalog

{
  "version": 1,
  "packages": [
    {
      "id": "hello",
      "version": "1.0.0",
      "url": "https://downloads.example.com/hello-1.0.0.tar.gz",
      "size": 48213,
      "sha256": "0f343b0931126a20f133d67c2b018a3b5b0f3c1e8ad8f6b0f3c6d6a4d8c2b9e1",
      "required": false,
      "fountain_protocol": 1,
      "browser_contract": 1,
      "capabilities": ["native.actor.read"]
    }
  ]
}

Replace size and sha256 with the values printed for your archive. The file must hold one JSON object of at most 1 MiB with version and packages. Fountain decodes it strictly: unknown fields, duplicate keys, trailing data and wrong types are errors, and every field below except lifecycle_controller must be present.

Field Type Rules
version integer Catalog format version. Must be 1.
packages array At most 256 entries with unique id values.
id string Package ID: lowercase letters and digits in hyphen-separated groups, at most 64 bytes. Must equal the manifest id.
version string Package version, 1 to 64 characters from letters, digits, ., _, + and -, starting with a letter or digit. Must equal the manifest version.
url string https address with a host and no user information, query or fragment.
size integer Exact archive size in bytes, from 1 to 536870912 (512 MiB).
sha256 string Archive SHA-256 as 64 lowercase hexadecimal characters.
required boolean Whether the package is required. The set of required entries must equal REQUIRED_IDS exactly; see Required packages.
fountain_protocol integer Must equal the host's extension protocol, currently 1, and the manifest protocol.
browser_contract integer Must equal the host's browser contract version, currently 1.
capabilities array of strings Must list exactly the manifest's capabilities, in any order. Use [] for none.
lifecycle_controller string Optional. The ID of a required package that controls this package's external effects. It must name a required catalog entry that has no controller of its own, and must equal the manifest's lifecycle_controller.

An invalid entry makes the whole catalog invalid, and the forge refuses to start while extensions are enabled.

Install the catalog

The file must be:

  • At an absolute path.
  • A regular file, not a symbolic link.
  • Owned by root or by the forge's service user.
  • Not writable by group or others.
sudo install -m 0644 -o root -g root catalog.json /etc/fountain/catalog.json
[extensions]
ENABLED = true
CATALOG_PATH = /etc/fountain/catalog.json

In a container, mount the file read-only and point the setting at it:

-v /etc/fountain/catalog.json:/etc/fountain/catalog.json:ro \
-e FORGEJO__extensions__CATALOG_PATH=/etc/fountain/catalog.json

Restart the forge. The catalog is read once at startup; restart again after changing it.

Install a catalog package

Open Site administration → Extensions. Declared packages that are not installed appear with their catalog version, an available label and an Install and enable button.

Downloads follow at most five redirects, and every redirect must stay on HTTPS without user information or a fragment; a redirect may add a query string, such as a signed CDN address. Each download has 15 seconds to connect, 30 seconds to receive response headers and 5 minutes in total. Downloads connect directly and do not use proxy environment variables. Failures are reported by package ID only, as package download failed, package size mismatch, package checksum mismatch or package redirect rejected.

Prepare packages offline

extensions prepare stages a target release's required and enabled packages from the verified archive cache while the forge is stopped, so that a forge with no network access can move to a new catalog. It is cache-only and refuses to run without --offline. It never changes requested state and never starts a backend.

fountain extensions prepare --offline \
  --catalog /etc/fountain/catalog-next.json \
  --source-catalog /etc/fountain/catalog.json \
  --controller CONTROLLER_ID \
  --snapshot /var/lib/fountain/source-snapshot.json
Flag Meaning
--offline Required. Confirms there is no network fallback.
--catalog Absolute path to the target release's catalog.
--source-catalog Absolute path to the trusted catalog of the release currently installed.
--controller ID of the required lifecycle controller that owns the source snapshot.
--snapshot Absolute path to the frozen source snapshot produced by that controller.

The command prints one line per prepared package: ID, version and archive SHA-256, separated by tabs. It is intended for deployments whose packages are coordinated by a lifecycle controller.

Troubleshooting

Symptom What to check
extension catalog is unavailable at startup Path, ownership, permissions, size and strict format of the catalog file.
extension catalog does not match configuration at startup The entries marked required differ from REQUIRED_IDS, or a lifecycle_controller does not name a required entry without its own controller.
package checksum mismatch The bytes at url changed after the catalog was written. Publish a new version and update the catalog.
catalog changed; reload and retry The forge restarted with a different catalog after the page was loaded. Reload Extensions and try again.

Continue

Make a package mandatory for every start with Required packages.