Offline image server
An air-gapped install needs two things: a directory of image tarballs reachable on
the LAN, and pgcli_images_http_url pointing at it. The repository ships
scripts/export-images.sh for the first part: it reads the list from
docs/images.md or from the Ansible pgcli_images variable, pulls each image,
and saves it as a docker-archive tarball whose name matches the offline
manifest. pg http provides the second part.
Export the images
By default the script reads the image tables in docs/images.md and writes to
images/ under the repository root:
Using the Ansible list as the source is recommended: then each tarball name
comes from pgcli_images[].archive, so it cannot drift from what the playbooks
consume:
Both sources resolve to 44 images with the same image-to-filename mapping. Options:
| Option | Meaning |
|---|---|
--manifest FILE |
Use another Markdown image list (mutually exclusive with --ansible) |
--ansible FILE |
Read pgcli_images from an Ansible group_vars file and use its archive names |
-o, --output DIR |
Output directory; default images/ in the repository |
--platform ARCH |
Pull platform; default linux/amd64 (use linux/arm64 for ARM hosts) |
-n, --dry-run |
Print the plan without pulling or writing anything |
-f, --force |
Re-export tarballs that already exist |
Check the plan first:
On a host that needs a proxy, the script inherits the environment and podman pull uses the same egress:
See Egress proxy for running the proxy itself.
Naming and behaviour
- Names follow
<repository-basename>_<tag>.tar(:becomes_), for exampleghcr.io/mars-base/pgcli/pgcli-pg:18-2.59.3→pgcli-pg_18-2.59.3.tar. With--ansible, thearchivefield is used verbatim. - Existing tarballs without
--forceare reported asSKIP, so an interrupted run can simply be restarted. - Each archive is written to
.tmpand atomically renamed on success; a failure never leaves a partial file. One failed image does not stop the rest; the script exits non-zero and lists the failures at the end. - Images are pulled with
--platformbefore saving becausepodman savecannot write a multi-arch manifest list todocker-archive. - The 44 tarballs total several GB; make sure the output filesystem has room.
Start the HTTP server
pg http is pgcli’s built-in static file server. It runs as a detached host
process (no container) and supports HEAD/Range requests, which image
pre-checks and loading rely on.
To maintain the store from a browser, add the write-mode flags:
The listing then offers an upload form, a “new folder” form and per-file delete
buttons, so tarballs can be replaced or added without a shell. Uploads are
capped at 1 GiB per request by default; raise it with --max-upload if the
tarballs are larger. --admin-ip restricts the write controls to the listed
source addresses: everyone else sees the plain read-only listing and gets 403
on writes. These modes come with no authentication either — see
HTTP file server.
Add --auth (or --auth-env) to put the whole site behind HTTP Basic Auth —
listings, downloads and writes:
Accounts can also live in an htpasswd file:
pg http htpasswd images --file /srv/offline-images.htpasswd, then start with
--auth-file /srv/offline-images.htpasswd.
Note that the bundled Ansible tasks (ansible.builtin.uri for the HEAD
pre-check, ansible.builtin.get_url for downloads) do not send credentials.
If you enable Basic Auth on the image server, pass url_username /
url_password in your own overrides of those tasks, or keep this particular
server unauthenticated on a trusted network.
Enable it at boot if needed:
The server can also be managed entirely from Ansible: see
HTTP file server. playbooks/deploy-http.yaml reconciles
every pg http parameter from group_vars/http/main.yml (directory, write
modes, TLS, auth), syncs the pg and podman binaries, and registers the
autostart command above.
Caveats:
- There is no authentication unless you add
--auth. Use0.0.0.0only on a trusted network or behind a firewall.--tlsencrypts traffic but does not authenticate clients, and its self-signed certificate must be trusted by the clients. Combine--authwith--tlswhen the server leaves the host. - If the port is busy,
pg httptries the next free one (up to 100 attempts). Always checkpg http statusand keeppgcli_images_http_urlconsistent with the port actually bound. - Files must sit directly in the served directory: consumers request
<base>/<basename>with no path prefix.
Configure Ansible
Point the cluster at the server root in group_vars/all/main.yml:
With it set, scripts/install.sh runs with --skip-pull and the install phase
never contacts a registry. Two requirements follow:
- Every
archiveinpgcli_imagesmust match a filename on the server exactly. Exporting with--ansibleguarantees this. - All core images (entries without
auto_load) must be present. Before changing anything, the install play sendsHEADrequests to the server root and to every core archive; any miss aborts with the specific filename.
Images marked auto_load: true are fetched on demand: the first time an add-on
of that type is created. You can therefore export only the add-on images you
actually use. Manifest trimming and lazy loading are covered in
Offline and air-gapped installs.
If pgcli_proxy_url is set as well, the image server hostname is added to
NO_PROXY automatically, so LAN downloads never go through the proxy.
Verify
On one target host in the isolated network:
The first host should report loading the core images from
pgcli_images_http_url rather than pulling from a registry. When an add-on is
created for the first time, confirm that its tarball is downloaded on demand.
Updating images
When tags change, re-export from the new pgcli_images list; filenames change
with them, and old tarballs are not deleted automatically:
Existing files are skipped; add --force when a tarball must be pulled again.
The directory is flat, so removing stale tarballs that the manifest no longer
references does not affect images already in use.