Hosting
The site
The registry runs as its own installation, or as a leaf site of an existing multisite installation: a siteaccess
(matched by the registry's host) that alone carries the extension, [ExtensionSettings] ActiveAccessExtensions[]=exp_package_registry
in settings/siteaccess/<siteaccess>/site.ini.append.php, its tables beside the site's in the same database
(ext:exp_package_registry:install-schema -s <siteaccess> adds the registry's tables only) and its settings in
settings/siteaccess/<siteaccess>/exppackageregistry.ini.append.php. Without expqueue in the installation, set
[Queue] Use=timer and install the scheduler with timer install --for-siteaccess=<siteaccess>.
The registry is an Exponential installation with this extension active, on its own host (packages.exponential.earth), on the same server as the site of its organisation. What it needs:
- PHP 8.1 or later with
zip,sodium(signatures),mbstring,json;giton the server; Composer ([Scan] Composer) for the audit check. - A database (any of the five engines); the tables come from
./console ext:exp_package_registry:install-schema. - A data directory outside the web root (
[Storage] DataDir, default<installation>/../exp_package_registry_data), writable by the site user and by the worker: git mirrors, dist zips, the signing keys (keys/registry.keyis secret, mode 0600), the metadata cache, CI work directories. Back it up with the database: the signing key and the zips of private packages exist nowhere else. - expqueue's worker (its systemd service, or its cron part) and the scheduler's timer
(
./console ext:exp_package_registry:timer install). - A TLS certificate for the host; Composer refuses plain HTTP.
Clean URLs and the vhost
The Composer and API paths live at the host's root, as on Packagist. No web server rule is needed for them:
expPackageRegistryRouter, a listener of the kernel's request/preinput event (settings/site.ini.append.php),
maps /packages.json, /p2/, /dists/, /downloads/, /packages/..., /search.json, /providers/,
/keys/registry.pub, /rest/ and /graphql to registry/serve/<path> before the kernel dispatches the request,
so they work the same under Apache, nginx, PHP-FPM and Velocity. The REST API is under /rest/ because the
kernel's own REST interface answers /api/. Set the site's IndexPage=/registry/list for its front page.
The one thing the vhost must do is pass Composer's Authorization header to PHP:
# Apache with PHP-FPM (Plesk: Additional Apache directives)
CGIPassAuth On
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1nginx and Velocity pass it as they are. Do not cache /p2/ of private packages in a front cache (the registry sends
Cache-Control: private for them).
share/php-server-router.php is a router for PHP's built-in server that does the same mapping (tests).
Without rewrites
With CleanURLs=disabled every URL lives below /registry/serve/, and the repository URL is
https://<host>/registry/serve.
Jobs
| What | How |
|---|---|
| crawl, build, scan | expqueue job types registry.crawl, registry.build, registry.scan (resources registry:git, registry:ci) |
| due crawls | the timer exp-package-registry-<hash>.timer runs ext:exp_package_registry:schedule every 15 minutes at nice 15 |
| without expqueue | [Queue] Use=inline: the work runs in the request or command that asks for it |