pkgproxy is a caching proxy for packages and images, built for snapcraft, rockcraft and charmcraft builds. Set it up once and your machines download each package, module or image from the internet only once. After that it comes from the local cache, so your second build skips the download. Handy too if you run CI, or create and throw away a lot of containers and VMs.
What is cached:
Packages, modules and images are checked against their published checksums before they go into the cache. Package lists are refreshed every few minutes. The cache is kept when the snap is updated, and pkgproxy never deletes anything from it on its own; the documentation (see below) says how to free disk space.
Getting started
The proxy starts after install and listens on port 3142 (3143 for LXD). Then point each tool you use at it with the matching command. Run one without the pipe first to see what it changes and why. If your shell cannot find pkgproxyctl, use pkgproxy.pkgproxyctl.
pkgproxyctl setup apt | sudo sh
pkgproxyctl setup snap | sudo sh
pkgproxyctl setup go | sh
pkgproxyctl setup docker | sudo sh
pkgproxyctl setup lxd | sh
pkgproxyctl setup lxd-remote | sh
pkgproxyctl setup snapcraft | sh
pkgproxyctl setup rockcraft | sh
pkgproxyctl setup charmcraft | sh
On a desktop, pkgproxy in the applications menu, or pkgproxy.open, opens its setup page in your browser.
setup lxd makes LXD containers use the proxy, and setup lxd-remote adds cached LXD image remotes. The LXD commands need no root, only membership in the lxd group. Each craft tool needs two: setup lxd-remote for its build images, and setup snapcraft, setup rockcraft or setup charmcraft for what its builds download. Add -undo to any setup command to get the commands that revert it.
pkgproxyctl stats shows what is in the cache and how much downloading it saved.
Working offline
What is in the cache keeps working without a network. pkgproxy goes offline by itself while the machine has no network, airplane mode included, and back online with it. To choose yourself:
sudo snap set pkgproxy offline-mode=offline
sudo snap set pkgproxy offline-mode=never
Configuration
To use a different port:
sudo snap set pkgproxy addr=:8080
sudo snap set pkgproxy lxd-tls-addr=:8443
Then run the setup commands again so your tools follow along. The documentation of the newest version, the other options included, is at https://zygoon.pl/pkgproxy/ For the version you have, which snap list pkgproxy shows, open the same file at that version's tag: https://gitlab.com/zygoon/pkgproxy/-/tags
You are about to open
Do you wish to proceed?
Thank you for your report. Information you provided will help us investigate further.
There was an error while sending your report. Please try again later.
Snaps are applications packaged with all their dependencies to run on all popular Linux distributions from a single build. They update automatically and roll back gracefully.
Snaps are discoverable and installable from the Snap Store, an app store with an audience of millions.
Snap can be installed from the command line. Open the Konsole terminal and enter the following:
sudo apt update
sudo apt install snapd
To install PkgProxy, simply use the following command:
sudo snap install pkgproxy
Browse and find snaps from the convenience of your desktop using the snap store snap.
Interested to find out more about snaps? Want to publish your own application? Visit snapcraft.io now.