# Address the Pigsty intranet repository over HTTP

> The local module connects to an admin node over HTTP on EL and Debian. Offline bootstrap registers a directory on disk.

---

LLMS index: [llms.txt](/llms.txt)

---

> **Decision date:** 2026-12-03<br>
> **Status** Released in [v1.12.0](https://github.com/pgsty/pig/releases/tag/v1.12.0), including offline path handling from `7696ed9ef744`.<br>
> **Current reference** [Adding repositories](/repo/#repo-add) and [offline bootstrap](/repo/#repo-boot).<br>
> **Scope** The intranet address used by `pig repo add` and `pig repo set`, and the file URL registered by `pig repo boot`.

## Decision {#decision}

Use the same HTTP endpoint for the built-in `local` module on EL, Debian and Ubuntu. The caller supplies the admin node's IPv4 address with `-I` or `--admin-ip`. The default is `127.0.0.1`.

## Context {#context}

In v1.11.0 the EL catalog pointed to `file:///www/pigsty`. Its Debian counterpart contained the Pigsty template variable `${admin_ip}`. Ansible resolves that variable in a Pigsty deployment. Standalone PIG passed it through to APT, which tried to resolve the literal hostname. [EL catalog](https://github.com/pgsty/pig/blob/365bf1282fdb2319e2367740e792ba59bcc04d04/cli/repo/assets/repo.yml#L2) · [Debian catalog](https://github.com/pgsty/pig/blob/365bf1282fdb2319e2367740e792ba59bcc04d04/cli/repo/assets/repo.yml#L48)

## Alternatives {#alternatives}

A file URL on both platforms would require each client to have its own copy of the repository. Switching EL from file to HTTP only when the flag is present would give an explicit `-I 127.0.0.1` a different meaning from its default.

## Contract {#contract}

PIG matches catalog signing policy against the original definition and selects the regional URL. It replaces the literal `${admin_ip}` token before checking APT trust conflicts or writing the module file. Fixed URLs retain their configured addresses. The intranet entries use `trusted=yes` on APT and `gpgcheck=0` on EL.

`repo boot` registers the extracted directory through an absolute file URL. It resolves a relative target against the caller's working directory and escapes characters that the package manager would interpret in a URL. It can run before an HTTP server is available. Both workflows write the same per-platform `local` module file.

## Impact {#impact}

On EL, `repo add local` writes the HTTP source from the built-in catalog. Without `-u`, this can run before the HTTP server starts. An existing catalog that explicitly names `file:///www/pigsty` keeps its filesystem source and its historical trust setting. To adopt the HTTP endpoint, replace that entry with the template or refresh a stock catalog after upgrading the CLI. Older PIG binaries lack the token expansion.

## Verification {#verification}

The focused tests and Linux acceptance binary use source revision `1b6e677a0e5502f50a78de3e2ea3c8999e4c47e1`.

```sh
go test ./cli/repo ./cmd -run 'Test(LocalRepoAdminIP|InvalidRepoAdminIP|RepoAdminIP)'
probe_dir=$(mktemp -d)
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -mod=readonly -o "$probe_dir/pig" .
```

With a Linux arm64 build, isolated Debian 12 and Rocky 9 clients ran `pig repo set local -I 127.0.0.2 --region default`. APT fetched the package index and DNF fetched primary metadata from that loopback address. Both clients produced identical files for the omitted address and an explicit `127.0.0.1`.

At `4f7f2815035b`, the Linux arm64 build above ran `pig repo boot -p pkg.tgz -d './weekly repo/#100%,$releasever'`. With networking disabled, APT on Debian 12 and DNF on Rocky 9 each installed a package from the extracted directory.

## Status {#status}

The implementation and native package-manager checks are complete. Published versions are listed in the [release notes](/release/).
