Feature Request: Central software package cache for WinGet
-
Hi everyone,
First of all, thank you for your great work on the FOG Project!
I recently upgraded our school’s FOG server from 1.5.10 to 1.6.1 and am really impressed by the new features, especially the new FOG Agent and the integrated software management with WinGet. As a school IT administrator managing 138 Windows 11 computers, these improvements make my daily work much easier.
Feature request: Central software package cache
As far as I understand, each client currently downloads its installation packages directly from the internet when using WinGet. It would be very useful to have a central software package cache on the FOG server, similar to the existing agent update cache.
Ideally:
- The FOG server automatically checks for new software versions.
- Each installer is downloaded only once and its integrity is verified.
- Clients download the installers from the local FOG server.
- Existing software management and reporting remain unchanged.
- Outdated cached packages are automatically removed.
- Caching can optionally be enabled per software package.
This would significantly reduce internet bandwidth usage, especially in larger school environments.
Is there already a way to achieve this with FOG 1.6.1? Is such a feature planned, or would you recommend using a separate local WinGet repository?
Thanks again to the entire FOG team for developing and maintaining such a valuable open-source solution. The progress made with FOG 1.6 is really impressive!
Best regards from Germany!
-
@wbg 1.6.1 has no WinGet cache yet. Each Software entry has a Source field. The agent passes it to winget as
--source. So you can point an entry at a local source today, but the client must already have that source registered.Two options now:
- Chocolatey with an internal feed. A folder or a share is a valid Chocolatey source. Set the backend to Chocolatey and put the share path in Source.
- A self-hosted WinGet REST source (for example rewinged), with installer URLs that point at a local web server. Register it on the clients with
winget source add(a snapin works). Then put the source name in Source.
A built-in cache on the FOG server is a reasonable request. We are tracking it here: https://github.com/FOGProject/fogproject/issues/2236
-
@wbg The WinGet cache is built. It is on dev-branch now, and it reaches stable on December 11.
How it works: the FOG server downloads the installer once. It checks each file against the SHA-256 in the WinGet manifest. Hosts then install from the FOG server, not from the internet, and WinGet checks the SHA-256 again before it installs.
To use it:
- Update the server to dev-branch and run the installer. The installer creates the cache folder (
/opt/fog/softwarecache) and adds the PHP modules the cache needs. - Hosts need FOG Agent 0.1.31 or later. It is released, so agents that update from your server get it. An older agent ignores the cache and installs from the internet, as before.
- Edit a WinGet entry and turn on Cache on this server. The edit page shows the cache state.
- Keep the FOG Agent Release Sync service on. It runs the cache, on its normal schedule.
Limits:
- Only packages from the public
wingetsource. The server shares the cached files over plain HTTP with no sign-in, so do not use it for a package that holds a license key. - The server keeps every installer variant that a version lists (x64, ARM, MSI, EXE), because WinGet picks one on each host. The files go in
/opt/fog/softwarecache, and the server stops new downloads when less than 5 GiB is free. To use a bigger disk, mount it at that path and run the installer again. - If a check fails, hosts get the last cached version, with a warning in the Software Status details.
If you test it, please post what you see here, good or bad.
- Update the server to dev-branch and run the installer. The installer creates the cache folder (
-
This post is deleted! -
Hi @Tom-Elliott ,
I switched our FOG server to dev-branch and started testing the new WinGet cache.
Test environment:
- FOG Server 1.6.1.349 (dev-branch)
- FOG Agent 0.1.39
- Ubuntu 22.04.5 LTS
- 93 Windows 11 computers assigned to the 7-Zip software package
- 165 GB of free disk space
The upgrade completed successfully. All 12 FOG services are running, the required PHP extensions are installed, and the cache directories were created correctly.
Issue: Cached installers are immediately removed
I enabled caching for 7-Zip (Latest, Present, default source, architecture x64).
All six installer variants of version 26.06 were downloaded successfully. However, the service immediately removed all six installers and the generated manifest.
The final log entry was:
Software cache: 6 downloaded, 0 failed, 7 removedThe cache directories and the
softwareCachedatabase table are empty afterwards. The General tab also does not display any cache state information.I reproduced this behaviour multiple times.
Possible root cause
After investigating
src/Agent/SoftwareCache.php, I noticed that_record()uses the named PDO parameter:nowtwice in the INSERT statement:
:sha,:path,:state,:msg,:now,:nowHowever,
src/Db/PDODB.phpexplicitly disables prepared statement emulation:
\PDO::ATTR_EMULATE_PREPARES => falseI verified this behaviour with two read-only PHP/PDO queries directly on the FOG server:
- SELECT :now, :now — SQLSTATE[HY093]: Invalid parameter number
- SELECT :now, :cachedAt — OK
My assumption is that the cache database record is not saved successfully. Consequently,
_plan()finds no referenced manifests or installers, and_prune()removes all downloaded files.
Using a separate parameter such as:cachedAtmight resolve the issue.Additional findings
LibreOffice caching currently reports:
TheDocumentFoundation.LibreOffice: has package dependencies; caching is not supported for it yetRegular WinGet software management appears to continue working.
Thank you again for your work on this feature.